Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 #[derive(Clone)]
12 /// An enum which can either contain a u64 or not
13 pub enum COption_DurationZ {
14         /// When we're in this state, this COption_DurationZ contains a u64
15         Some(u64),
16         /// When we're in this state, this COption_DurationZ contains nothing
17         None
18 }
19 impl COption_DurationZ {
20         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21                 if let Self::None = self { false } else { true }
22         }
23         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
24                 !self.is_some()
25         }
26         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
27                 if let Self::Some(v) = self { v } else { unreachable!() }
28         }
29 }
30 #[no_mangle]
31 /// Constructs a new COption_DurationZ containing a u64
32 pub extern "C" fn COption_DurationZ_some(o: u64) -> COption_DurationZ {
33         COption_DurationZ::Some(o)
34 }
35 #[no_mangle]
36 /// Constructs a new COption_DurationZ containing nothing
37 pub extern "C" fn COption_DurationZ_none() -> COption_DurationZ {
38         COption_DurationZ::None
39 }
40 #[no_mangle]
41 /// Frees any resources associated with the u64, if we are in the Some state
42 pub extern "C" fn COption_DurationZ_free(_res: COption_DurationZ) { }
43 #[no_mangle]
44 /// Creates a new COption_DurationZ which has the same data as `orig`
45 /// but with all dynamically-allocated buffers duplicated in new buffers.
46 pub extern "C" fn COption_DurationZ_clone(orig: &COption_DurationZ) -> COption_DurationZ { Clone::clone(&orig) }
47 #[repr(C)]
48 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
49 /// This corresponds to std::vector in C++
50 pub struct CVec_BlindedPathZ {
51         /// The elements in the array.
52         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
53         pub data: *mut crate::lightning::blinded_path::BlindedPath,
54         /// The number of elements pointed to by `data`.
55         pub datalen: usize
56 }
57 impl CVec_BlindedPathZ {
58         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
59                 if self.datalen == 0 { return Vec::new(); }
60                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
61                 self.data = core::ptr::null_mut();
62                 self.datalen = 0;
63                 ret
64         }
65         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
66                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
67         }
68 }
69 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
70         fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
71                 let datalen = v.len();
72                 let data = Box::into_raw(v.into_boxed_slice());
73                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
74         }
75 }
76 #[no_mangle]
77 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
78 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
79 impl Drop for CVec_BlindedPathZ {
80         fn drop(&mut self) {
81                 if self.datalen == 0 { return; }
82                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
83         }
84 }
85 impl Clone for CVec_BlindedPathZ {
86         fn clone(&self) -> Self {
87                 let mut res = Vec::new();
88                 if self.datalen == 0 { return Self::from(res); }
89                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
90                 Self::from(res)
91         }
92 }
93 #[repr(C)]
94 #[derive(Clone)]
95 /// An enum which can either contain a u64 or not
96 pub enum COption_u64Z {
97         /// When we're in this state, this COption_u64Z contains a u64
98         Some(u64),
99         /// When we're in this state, this COption_u64Z contains nothing
100         None
101 }
102 impl COption_u64Z {
103         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
104                 if let Self::None = self { false } else { true }
105         }
106         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
107                 !self.is_some()
108         }
109         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
110                 if let Self::Some(v) = self { v } else { unreachable!() }
111         }
112 }
113 #[no_mangle]
114 /// Constructs a new COption_u64Z containing a u64
115 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
116         COption_u64Z::Some(o)
117 }
118 #[no_mangle]
119 /// Constructs a new COption_u64Z containing nothing
120 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
121         COption_u64Z::None
122 }
123 #[no_mangle]
124 /// Frees any resources associated with the u64, if we are in the Some state
125 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
126 #[no_mangle]
127 /// Creates a new COption_u64Z which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
130 #[repr(C)]
131 /// The contents of CResult_NoneAPIErrorZ
132 pub union CResult_NoneAPIErrorZPtr {
133         /// Note that this value is always NULL, as there are no contents in the OK variant
134         pub result: *mut core::ffi::c_void,
135         /// A pointer to the contents in the error state.
136         /// Reading from this pointer when `result_ok` is set is undefined.
137         pub err: *mut crate::lightning::util::errors::APIError,
138 }
139 #[repr(C)]
140 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
141 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
143 pub struct CResult_NoneAPIErrorZ {
144         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
145         /// `err` or `result` depending on the state of `result_ok`.
146         pub contents: CResult_NoneAPIErrorZPtr,
147         /// Whether this CResult_NoneAPIErrorZ represents a success state.
148         pub result_ok: bool,
149 }
150 #[no_mangle]
151 /// Creates a new CResult_NoneAPIErrorZ in the success state.
152 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
153         CResult_NoneAPIErrorZ {
154                 contents: CResult_NoneAPIErrorZPtr {
155                         result: core::ptr::null_mut(),
156                 },
157                 result_ok: true,
158         }
159 }
160 #[no_mangle]
161 /// Creates a new CResult_NoneAPIErrorZ in the error state.
162 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
163         CResult_NoneAPIErrorZ {
164                 contents: CResult_NoneAPIErrorZPtr {
165                         err: Box::into_raw(Box::new(e)),
166                 },
167                 result_ok: false,
168         }
169 }
170 /// Checks if the given object is currently in the success state
171 #[no_mangle]
172 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
173         o.result_ok
174 }
175 #[no_mangle]
176 /// Frees any resources used by the CResult_NoneAPIErrorZ.
177 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
178 impl Drop for CResult_NoneAPIErrorZ {
179         fn drop(&mut self) {
180                 if self.result_ok {
181                 } else {
182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
184                         }
185                 }
186         }
187 }
188 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
189         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
190                 let contents = if o.result_ok {
191                         let _ = unsafe { Box::from_raw(o.contents.result) };
192                         o.contents.result = core::ptr::null_mut();
193                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
194                 } else {
195                         let err = unsafe { o.contents.err };
196                         unsafe { o.contents.err = core::ptr::null_mut(); }
197                         CResult_NoneAPIErrorZPtr { err }
198                 };
199                 Self {
200                         contents,
201                         result_ok: o.result_ok,
202                 }
203         }
204 }
205 impl Clone for CResult_NoneAPIErrorZ {
206         fn clone(&self) -> Self {
207                 if self.result_ok {
208                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
209                                 result: core::ptr::null_mut()
210                         } }
211                 } else {
212                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
213                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
214                         } }
215                 }
216         }
217 }
218 #[no_mangle]
219 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
220 /// but with all dynamically-allocated buffers duplicated in new buffers.
221 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
222 #[repr(C)]
223 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
224 /// This corresponds to std::vector in C++
225 pub struct CVec_CResult_NoneAPIErrorZZ {
226         /// The elements in the array.
227         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
228         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
229         /// The number of elements pointed to by `data`.
230         pub datalen: usize
231 }
232 impl CVec_CResult_NoneAPIErrorZZ {
233         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
234                 if self.datalen == 0 { return Vec::new(); }
235                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
236                 self.data = core::ptr::null_mut();
237                 self.datalen = 0;
238                 ret
239         }
240         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
241                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
242         }
243 }
244 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
245         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
246                 let datalen = v.len();
247                 let data = Box::into_raw(v.into_boxed_slice());
248                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
249         }
250 }
251 #[no_mangle]
252 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
253 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
254 impl Drop for CVec_CResult_NoneAPIErrorZZ {
255         fn drop(&mut self) {
256                 if self.datalen == 0 { return; }
257                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
258         }
259 }
260 impl Clone for CVec_CResult_NoneAPIErrorZZ {
261         fn clone(&self) -> Self {
262                 let mut res = Vec::new();
263                 if self.datalen == 0 { return Self::from(res); }
264                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
265                 Self::from(res)
266         }
267 }
268 #[repr(C)]
269 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
270 /// This corresponds to std::vector in C++
271 pub struct CVec_APIErrorZ {
272         /// The elements in the array.
273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
274         pub data: *mut crate::lightning::util::errors::APIError,
275         /// The number of elements pointed to by `data`.
276         pub datalen: usize
277 }
278 impl CVec_APIErrorZ {
279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
280                 if self.datalen == 0 { return Vec::new(); }
281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
282                 self.data = core::ptr::null_mut();
283                 self.datalen = 0;
284                 ret
285         }
286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
288         }
289 }
290 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
291         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
292                 let datalen = v.len();
293                 let data = Box::into_raw(v.into_boxed_slice());
294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
295         }
296 }
297 #[no_mangle]
298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
299 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
300 impl Drop for CVec_APIErrorZ {
301         fn drop(&mut self) {
302                 if self.datalen == 0 { return; }
303                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
304         }
305 }
306 impl Clone for CVec_APIErrorZ {
307         fn clone(&self) -> Self {
308                 let mut res = Vec::new();
309                 if self.datalen == 0 { return Self::from(res); }
310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
311                 Self::from(res)
312         }
313 }
314 #[repr(C)]
315 /// A dynamically-allocated array of u8s of arbitrary size.
316 /// This corresponds to std::vector in C++
317 pub struct CVec_u8Z {
318         /// The elements in the array.
319         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
320         pub data: *mut u8,
321         /// The number of elements pointed to by `data`.
322         pub datalen: usize
323 }
324 impl CVec_u8Z {
325         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
326                 if self.datalen == 0 { return Vec::new(); }
327                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
328                 self.data = core::ptr::null_mut();
329                 self.datalen = 0;
330                 ret
331         }
332         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
333                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
334         }
335 }
336 impl From<Vec<u8>> for CVec_u8Z {
337         fn from(v: Vec<u8>) -> Self {
338                 let datalen = v.len();
339                 let data = Box::into_raw(v.into_boxed_slice());
340                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
341         }
342 }
343 #[no_mangle]
344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
345 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
346 impl Drop for CVec_u8Z {
347         fn drop(&mut self) {
348                 if self.datalen == 0 { return; }
349                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
350         }
351 }
352 impl Clone for CVec_u8Z {
353         fn clone(&self) -> Self {
354                 let mut res = Vec::new();
355                 if self.datalen == 0 { return Self::from(res); }
356                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
357                 Self::from(res)
358         }
359 }
360 #[repr(C)]
361 #[derive(Clone)]
362 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
363 pub enum COption_CVec_u8ZZ {
364         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
365         Some(crate::c_types::derived::CVec_u8Z),
366         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
367         None
368 }
369 impl COption_CVec_u8ZZ {
370         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
371                 if let Self::None = self { false } else { true }
372         }
373         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
374                 !self.is_some()
375         }
376         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
377                 if let Self::Some(v) = self { v } else { unreachable!() }
378         }
379 }
380 #[no_mangle]
381 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
382 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
383         COption_CVec_u8ZZ::Some(o)
384 }
385 #[no_mangle]
386 /// Constructs a new COption_CVec_u8ZZ containing nothing
387 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
388         COption_CVec_u8ZZ::None
389 }
390 #[no_mangle]
391 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
392 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
393 #[no_mangle]
394 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
395 /// but with all dynamically-allocated buffers duplicated in new buffers.
396 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
397 #[repr(C)]
398 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
399 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
400         /// A pointer to the contents in the success state.
401         /// Reading from this pointer when `result_ok` is not set is undefined.
402         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
403         /// A pointer to the contents in the error state.
404         /// Reading from this pointer when `result_ok` is set is undefined.
405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
406 }
407 #[repr(C)]
408 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
409 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
411 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
412         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
413         /// `err` or `result` depending on the state of `result_ok`.
414         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
415         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
416         pub result_ok: bool,
417 }
418 #[no_mangle]
419 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
420 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
421         CResult_RecipientOnionFieldsDecodeErrorZ {
422                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
423                         result: Box::into_raw(Box::new(o)),
424                 },
425                 result_ok: true,
426         }
427 }
428 #[no_mangle]
429 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
430 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
431         CResult_RecipientOnionFieldsDecodeErrorZ {
432                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
433                         err: Box::into_raw(Box::new(e)),
434                 },
435                 result_ok: false,
436         }
437 }
438 /// Checks if the given object is currently in the success state
439 #[no_mangle]
440 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
441         o.result_ok
442 }
443 #[no_mangle]
444 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
445 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
446 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
447         fn drop(&mut self) {
448                 if self.result_ok {
449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
451                         }
452                 } else {
453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
455                         }
456                 }
457         }
458 }
459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
461                 let contents = if o.result_ok {
462                         let result = unsafe { o.contents.result };
463                         unsafe { o.contents.result = core::ptr::null_mut() };
464                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
465                 } else {
466                         let err = unsafe { o.contents.err };
467                         unsafe { o.contents.err = core::ptr::null_mut(); }
468                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
469                 };
470                 Self {
471                         contents,
472                         result_ok: o.result_ok,
473                 }
474         }
475 }
476 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
477         fn clone(&self) -> Self {
478                 if self.result_ok {
479                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
481                         } }
482                 } else {
483                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
485                         } }
486                 }
487         }
488 }
489 #[no_mangle]
490 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
491 /// but with all dynamically-allocated buffers duplicated in new buffers.
492 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
493 #[repr(C)]
494 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
495 pub enum COption_HTLCClaimZ {
496         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
497         Some(crate::lightning::ln::chan_utils::HTLCClaim),
498         /// When we're in this state, this COption_HTLCClaimZ contains nothing
499         None
500 }
501 impl COption_HTLCClaimZ {
502         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
503                 if let Self::None = self { false } else { true }
504         }
505         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
506                 !self.is_some()
507         }
508         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
509                 if let Self::Some(v) = self { v } else { unreachable!() }
510         }
511 }
512 #[no_mangle]
513 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
514 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
515         COption_HTLCClaimZ::Some(o)
516 }
517 #[no_mangle]
518 /// Constructs a new COption_HTLCClaimZ containing nothing
519 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
520         COption_HTLCClaimZ::None
521 }
522 #[no_mangle]
523 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
524 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
525 #[repr(C)]
526 /// The contents of CResult_NoneNoneZ
527 pub union CResult_NoneNoneZPtr {
528         /// Note that this value is always NULL, as there are no contents in the OK variant
529         pub result: *mut core::ffi::c_void,
530         /// Note that this value is always NULL, as there are no contents in the Err variant
531         pub err: *mut core::ffi::c_void,
532 }
533 #[repr(C)]
534 /// A CResult_NoneNoneZ represents the result of a fallible operation,
535 /// containing a () on success and a () on failure.
536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
537 pub struct CResult_NoneNoneZ {
538         /// The contents of this CResult_NoneNoneZ, accessible via either
539         /// `err` or `result` depending on the state of `result_ok`.
540         pub contents: CResult_NoneNoneZPtr,
541         /// Whether this CResult_NoneNoneZ represents a success state.
542         pub result_ok: bool,
543 }
544 #[no_mangle]
545 /// Creates a new CResult_NoneNoneZ in the success state.
546 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
547         CResult_NoneNoneZ {
548                 contents: CResult_NoneNoneZPtr {
549                         result: core::ptr::null_mut(),
550                 },
551                 result_ok: true,
552         }
553 }
554 #[no_mangle]
555 /// Creates a new CResult_NoneNoneZ in the error state.
556 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
557         CResult_NoneNoneZ {
558                 contents: CResult_NoneNoneZPtr {
559                         err: core::ptr::null_mut(),
560                 },
561                 result_ok: false,
562         }
563 }
564 /// Checks if the given object is currently in the success state
565 #[no_mangle]
566 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
567         o.result_ok
568 }
569 #[no_mangle]
570 /// Frees any resources used by the CResult_NoneNoneZ.
571 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
572 impl Drop for CResult_NoneNoneZ {
573         fn drop(&mut self) {
574                 if self.result_ok {
575                 } else {
576                 }
577         }
578 }
579 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
580         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
581                 let contents = if o.result_ok {
582                         let _ = unsafe { Box::from_raw(o.contents.result) };
583                         o.contents.result = core::ptr::null_mut();
584                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
585                 } else {
586                         let _ = unsafe { Box::from_raw(o.contents.err) };
587                         o.contents.err = core::ptr::null_mut();
588                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
589                 };
590                 Self {
591                         contents,
592                         result_ok: o.result_ok,
593                 }
594         }
595 }
596 impl Clone for CResult_NoneNoneZ {
597         fn clone(&self) -> Self {
598                 if self.result_ok {
599                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
600                                 result: core::ptr::null_mut()
601                         } }
602                 } else {
603                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
604                                 err: core::ptr::null_mut()
605                         } }
606                 }
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
611 /// but with all dynamically-allocated buffers duplicated in new buffers.
612 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
613 #[repr(C)]
614 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
615 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
616         /// A pointer to the contents in the success state.
617         /// Reading from this pointer when `result_ok` is not set is undefined.
618         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
619         /// A pointer to the contents in the error state.
620         /// Reading from this pointer when `result_ok` is set is undefined.
621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
622 }
623 #[repr(C)]
624 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
625 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
627 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
628         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
629         /// `err` or `result` depending on the state of `result_ok`.
630         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
631         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
632         pub result_ok: bool,
633 }
634 #[no_mangle]
635 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
636 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
637         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
638                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
639                         result: Box::into_raw(Box::new(o)),
640                 },
641                 result_ok: true,
642         }
643 }
644 #[no_mangle]
645 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
646 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
647         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
648                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
649                         err: Box::into_raw(Box::new(e)),
650                 },
651                 result_ok: false,
652         }
653 }
654 /// Checks if the given object is currently in the success state
655 #[no_mangle]
656 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
657         o.result_ok
658 }
659 #[no_mangle]
660 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
661 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
662 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
663         fn drop(&mut self) {
664                 if self.result_ok {
665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
667                         }
668                 } else {
669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
671                         }
672                 }
673         }
674 }
675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
677                 let contents = if o.result_ok {
678                         let result = unsafe { o.contents.result };
679                         unsafe { o.contents.result = core::ptr::null_mut() };
680                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
681                 } else {
682                         let err = unsafe { o.contents.err };
683                         unsafe { o.contents.err = core::ptr::null_mut(); }
684                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
685                 };
686                 Self {
687                         contents,
688                         result_ok: o.result_ok,
689                 }
690         }
691 }
692 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
693         fn clone(&self) -> Self {
694                 if self.result_ok {
695                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
697                         } }
698                 } else {
699                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
701                         } }
702                 }
703         }
704 }
705 #[no_mangle]
706 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
707 /// but with all dynamically-allocated buffers duplicated in new buffers.
708 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
709 #[repr(C)]
710 /// The contents of CResult_TxCreationKeysDecodeErrorZ
711 pub union CResult_TxCreationKeysDecodeErrorZPtr {
712         /// A pointer to the contents in the success state.
713         /// Reading from this pointer when `result_ok` is not set is undefined.
714         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
715         /// A pointer to the contents in the error state.
716         /// Reading from this pointer when `result_ok` is set is undefined.
717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
718 }
719 #[repr(C)]
720 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
721 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
723 pub struct CResult_TxCreationKeysDecodeErrorZ {
724         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
725         /// `err` or `result` depending on the state of `result_ok`.
726         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
727         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
728         pub result_ok: bool,
729 }
730 #[no_mangle]
731 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
732 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
733         CResult_TxCreationKeysDecodeErrorZ {
734                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
735                         result: Box::into_raw(Box::new(o)),
736                 },
737                 result_ok: true,
738         }
739 }
740 #[no_mangle]
741 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
742 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
743         CResult_TxCreationKeysDecodeErrorZ {
744                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
745                         err: Box::into_raw(Box::new(e)),
746                 },
747                 result_ok: false,
748         }
749 }
750 /// Checks if the given object is currently in the success state
751 #[no_mangle]
752 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
753         o.result_ok
754 }
755 #[no_mangle]
756 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
757 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
758 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
759         fn drop(&mut self) {
760                 if self.result_ok {
761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
763                         }
764                 } else {
765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
767                         }
768                 }
769         }
770 }
771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
773                 let contents = if o.result_ok {
774                         let result = unsafe { o.contents.result };
775                         unsafe { o.contents.result = core::ptr::null_mut() };
776                         CResult_TxCreationKeysDecodeErrorZPtr { result }
777                 } else {
778                         let err = unsafe { o.contents.err };
779                         unsafe { o.contents.err = core::ptr::null_mut(); }
780                         CResult_TxCreationKeysDecodeErrorZPtr { err }
781                 };
782                 Self {
783                         contents,
784                         result_ok: o.result_ok,
785                 }
786         }
787 }
788 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
789         fn clone(&self) -> Self {
790                 if self.result_ok {
791                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
792                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
793                         } }
794                 } else {
795                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
797                         } }
798                 }
799         }
800 }
801 #[no_mangle]
802 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
803 /// but with all dynamically-allocated buffers duplicated in new buffers.
804 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
805 #[repr(C)]
806 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
807 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
808         /// A pointer to the contents in the success state.
809         /// Reading from this pointer when `result_ok` is not set is undefined.
810         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
811         /// A pointer to the contents in the error state.
812         /// Reading from this pointer when `result_ok` is set is undefined.
813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
814 }
815 #[repr(C)]
816 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
817 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
819 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
820         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
821         /// `err` or `result` depending on the state of `result_ok`.
822         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
823         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
824         pub result_ok: bool,
825 }
826 #[no_mangle]
827 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
828 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
829         CResult_ChannelPublicKeysDecodeErrorZ {
830                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
831                         result: Box::into_raw(Box::new(o)),
832                 },
833                 result_ok: true,
834         }
835 }
836 #[no_mangle]
837 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
838 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
839         CResult_ChannelPublicKeysDecodeErrorZ {
840                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
841                         err: Box::into_raw(Box::new(e)),
842                 },
843                 result_ok: false,
844         }
845 }
846 /// Checks if the given object is currently in the success state
847 #[no_mangle]
848 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
849         o.result_ok
850 }
851 #[no_mangle]
852 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
853 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
854 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
855         fn drop(&mut self) {
856                 if self.result_ok {
857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
859                         }
860                 } else {
861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
863                         }
864                 }
865         }
866 }
867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
869                 let contents = if o.result_ok {
870                         let result = unsafe { o.contents.result };
871                         unsafe { o.contents.result = core::ptr::null_mut() };
872                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
873                 } else {
874                         let err = unsafe { o.contents.err };
875                         unsafe { o.contents.err = core::ptr::null_mut(); }
876                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
877                 };
878                 Self {
879                         contents,
880                         result_ok: o.result_ok,
881                 }
882         }
883 }
884 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
885         fn clone(&self) -> Self {
886                 if self.result_ok {
887                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
888                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
889                         } }
890                 } else {
891                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
893                         } }
894                 }
895         }
896 }
897 #[no_mangle]
898 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
899 /// but with all dynamically-allocated buffers duplicated in new buffers.
900 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
901 #[repr(C)]
902 #[derive(Clone)]
903 /// An enum which can either contain a u32 or not
904 pub enum COption_u32Z {
905         /// When we're in this state, this COption_u32Z contains a u32
906         Some(u32),
907         /// When we're in this state, this COption_u32Z contains nothing
908         None
909 }
910 impl COption_u32Z {
911         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
912                 if let Self::None = self { false } else { true }
913         }
914         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
915                 !self.is_some()
916         }
917         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
918                 if let Self::Some(v) = self { v } else { unreachable!() }
919         }
920 }
921 #[no_mangle]
922 /// Constructs a new COption_u32Z containing a u32
923 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
924         COption_u32Z::Some(o)
925 }
926 #[no_mangle]
927 /// Constructs a new COption_u32Z containing nothing
928 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
929         COption_u32Z::None
930 }
931 #[no_mangle]
932 /// Frees any resources associated with the u32, if we are in the Some state
933 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
934 #[no_mangle]
935 /// Creates a new COption_u32Z which has the same data as `orig`
936 /// but with all dynamically-allocated buffers duplicated in new buffers.
937 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
938 #[repr(C)]
939 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
940 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
941         /// A pointer to the contents in the success state.
942         /// Reading from this pointer when `result_ok` is not set is undefined.
943         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
944         /// A pointer to the contents in the error state.
945         /// Reading from this pointer when `result_ok` is set is undefined.
946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
947 }
948 #[repr(C)]
949 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
950 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
952 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
953         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
954         /// `err` or `result` depending on the state of `result_ok`.
955         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
956         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
957         pub result_ok: bool,
958 }
959 #[no_mangle]
960 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
961 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
962         CResult_HTLCOutputInCommitmentDecodeErrorZ {
963                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
964                         result: Box::into_raw(Box::new(o)),
965                 },
966                 result_ok: true,
967         }
968 }
969 #[no_mangle]
970 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
971 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
972         CResult_HTLCOutputInCommitmentDecodeErrorZ {
973                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
974                         err: Box::into_raw(Box::new(e)),
975                 },
976                 result_ok: false,
977         }
978 }
979 /// Checks if the given object is currently in the success state
980 #[no_mangle]
981 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
982         o.result_ok
983 }
984 #[no_mangle]
985 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
986 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
987 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
988         fn drop(&mut self) {
989                 if self.result_ok {
990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
992                         }
993                 } else {
994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
996                         }
997                 }
998         }
999 }
1000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
1002                 let contents = if o.result_ok {
1003                         let result = unsafe { o.contents.result };
1004                         unsafe { o.contents.result = core::ptr::null_mut() };
1005                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
1006                 } else {
1007                         let err = unsafe { o.contents.err };
1008                         unsafe { o.contents.err = core::ptr::null_mut(); }
1009                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
1010                 };
1011                 Self {
1012                         contents,
1013                         result_ok: o.result_ok,
1014                 }
1015         }
1016 }
1017 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1018         fn clone(&self) -> Self {
1019                 if self.result_ok {
1020                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
1022                         } }
1023                 } else {
1024                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1026                         } }
1027                 }
1028         }
1029 }
1030 #[no_mangle]
1031 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
1032 /// but with all dynamically-allocated buffers duplicated in new buffers.
1033 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
1034 #[repr(C)]
1035 /// An enum which can either contain a  or not
1036 pub enum COption_NoneZ {
1037         /// When we're in this state, this COption_NoneZ contains a 
1038         Some,
1039         /// When we're in this state, this COption_NoneZ contains nothing
1040         None
1041 }
1042 impl COption_NoneZ {
1043         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1044                 if let Self::None = self { false } else { true }
1045         }
1046         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1047                 !self.is_some()
1048         }
1049 }
1050 #[no_mangle]
1051 /// Constructs a new COption_NoneZ containing a 
1052 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
1053         COption_NoneZ::Some
1054 }
1055 #[no_mangle]
1056 /// Constructs a new COption_NoneZ containing nothing
1057 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
1058         COption_NoneZ::None
1059 }
1060 #[no_mangle]
1061 /// Frees any resources associated with the , if we are in the Some state
1062 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
1063 #[repr(C)]
1064 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1065 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1066         /// A pointer to the contents in the success state.
1067         /// Reading from this pointer when `result_ok` is not set is undefined.
1068         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
1069         /// A pointer to the contents in the error state.
1070         /// Reading from this pointer when `result_ok` is set is undefined.
1071         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1072 }
1073 #[repr(C)]
1074 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1075 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1077 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1078         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1079         /// `err` or `result` depending on the state of `result_ok`.
1080         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
1081         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1082         pub result_ok: bool,
1083 }
1084 #[no_mangle]
1085 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
1086 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1087         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1088                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1089                         result: Box::into_raw(Box::new(o)),
1090                 },
1091                 result_ok: true,
1092         }
1093 }
1094 #[no_mangle]
1095 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
1096 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1097         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1098                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1099                         err: Box::into_raw(Box::new(e)),
1100                 },
1101                 result_ok: false,
1102         }
1103 }
1104 /// Checks if the given object is currently in the success state
1105 #[no_mangle]
1106 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
1107         o.result_ok
1108 }
1109 #[no_mangle]
1110 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
1111 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
1112 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1113         fn drop(&mut self) {
1114                 if self.result_ok {
1115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1117                         }
1118                 } else {
1119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1121                         }
1122                 }
1123         }
1124 }
1125 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1126         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1127                 let contents = if o.result_ok {
1128                         let result = unsafe { o.contents.result };
1129                         unsafe { o.contents.result = core::ptr::null_mut() };
1130                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
1131                 } else {
1132                         let err = unsafe { o.contents.err };
1133                         unsafe { o.contents.err = core::ptr::null_mut(); }
1134                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
1135                 };
1136                 Self {
1137                         contents,
1138                         result_ok: o.result_ok,
1139                 }
1140         }
1141 }
1142 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1143         fn clone(&self) -> Self {
1144                 if self.result_ok {
1145                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1146                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1147                         } }
1148                 } else {
1149                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1150                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1151                         } }
1152                 }
1153         }
1154 }
1155 #[no_mangle]
1156 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1157 /// but with all dynamically-allocated buffers duplicated in new buffers.
1158 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1159 #[repr(C)]
1160 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1161 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
1162         /// A pointer to the contents in the success state.
1163         /// Reading from this pointer when `result_ok` is not set is undefined.
1164         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
1165         /// A pointer to the contents in the error state.
1166         /// Reading from this pointer when `result_ok` is set is undefined.
1167         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1168 }
1169 #[repr(C)]
1170 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1171 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1173 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
1174         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1175         /// `err` or `result` depending on the state of `result_ok`.
1176         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
1177         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1178         pub result_ok: bool,
1179 }
1180 #[no_mangle]
1181 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
1182 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1183         CResult_ChannelTransactionParametersDecodeErrorZ {
1184                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1185                         result: Box::into_raw(Box::new(o)),
1186                 },
1187                 result_ok: true,
1188         }
1189 }
1190 #[no_mangle]
1191 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
1192 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1193         CResult_ChannelTransactionParametersDecodeErrorZ {
1194                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1195                         err: Box::into_raw(Box::new(e)),
1196                 },
1197                 result_ok: false,
1198         }
1199 }
1200 /// Checks if the given object is currently in the success state
1201 #[no_mangle]
1202 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
1203         o.result_ok
1204 }
1205 #[no_mangle]
1206 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
1207 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
1208 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
1209         fn drop(&mut self) {
1210                 if self.result_ok {
1211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1213                         }
1214                 } else {
1215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1217                         }
1218                 }
1219         }
1220 }
1221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
1222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1223                 let contents = if o.result_ok {
1224                         let result = unsafe { o.contents.result };
1225                         unsafe { o.contents.result = core::ptr::null_mut() };
1226                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1227                 } else {
1228                         let err = unsafe { o.contents.err };
1229                         unsafe { o.contents.err = core::ptr::null_mut(); }
1230                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1231                 };
1232                 Self {
1233                         contents,
1234                         result_ok: o.result_ok,
1235                 }
1236         }
1237 }
1238 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1239         fn clone(&self) -> Self {
1240                 if self.result_ok {
1241                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1242                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1243                         } }
1244                 } else {
1245                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1246                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1247                         } }
1248                 }
1249         }
1250 }
1251 #[no_mangle]
1252 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1253 /// but with all dynamically-allocated buffers duplicated in new buffers.
1254 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1255 #[repr(C)]
1256 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1257 /// This corresponds to std::vector in C++
1258 pub struct CVec_SignatureZ {
1259         /// The elements in the array.
1260         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1261         pub data: *mut crate::c_types::Signature,
1262         /// The number of elements pointed to by `data`.
1263         pub datalen: usize
1264 }
1265 impl CVec_SignatureZ {
1266         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1267                 if self.datalen == 0 { return Vec::new(); }
1268                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1269                 self.data = core::ptr::null_mut();
1270                 self.datalen = 0;
1271                 ret
1272         }
1273         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1274                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1275         }
1276 }
1277 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1278         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1279                 let datalen = v.len();
1280                 let data = Box::into_raw(v.into_boxed_slice());
1281                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1282         }
1283 }
1284 #[no_mangle]
1285 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1286 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1287 impl Drop for CVec_SignatureZ {
1288         fn drop(&mut self) {
1289                 if self.datalen == 0 { return; }
1290                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1291         }
1292 }
1293 impl Clone for CVec_SignatureZ {
1294         fn clone(&self) -> Self {
1295                 let mut res = Vec::new();
1296                 if self.datalen == 0 { return Self::from(res); }
1297                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1298                 Self::from(res)
1299         }
1300 }
1301 #[repr(C)]
1302 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1303 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1304         /// A pointer to the contents in the success state.
1305         /// Reading from this pointer when `result_ok` is not set is undefined.
1306         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1307         /// A pointer to the contents in the error state.
1308         /// Reading from this pointer when `result_ok` is set is undefined.
1309         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1310 }
1311 #[repr(C)]
1312 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1313 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1315 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1316         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1317         /// `err` or `result` depending on the state of `result_ok`.
1318         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1319         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1320         pub result_ok: bool,
1321 }
1322 #[no_mangle]
1323 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1324 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1325         CResult_HolderCommitmentTransactionDecodeErrorZ {
1326                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1327                         result: Box::into_raw(Box::new(o)),
1328                 },
1329                 result_ok: true,
1330         }
1331 }
1332 #[no_mangle]
1333 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1334 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1335         CResult_HolderCommitmentTransactionDecodeErrorZ {
1336                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1337                         err: Box::into_raw(Box::new(e)),
1338                 },
1339                 result_ok: false,
1340         }
1341 }
1342 /// Checks if the given object is currently in the success state
1343 #[no_mangle]
1344 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1345         o.result_ok
1346 }
1347 #[no_mangle]
1348 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1349 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1350 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1351         fn drop(&mut self) {
1352                 if self.result_ok {
1353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1355                         }
1356                 } else {
1357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1359                         }
1360                 }
1361         }
1362 }
1363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1365                 let contents = if o.result_ok {
1366                         let result = unsafe { o.contents.result };
1367                         unsafe { o.contents.result = core::ptr::null_mut() };
1368                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1369                 } else {
1370                         let err = unsafe { o.contents.err };
1371                         unsafe { o.contents.err = core::ptr::null_mut(); }
1372                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1373                 };
1374                 Self {
1375                         contents,
1376                         result_ok: o.result_ok,
1377                 }
1378         }
1379 }
1380 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1381         fn clone(&self) -> Self {
1382                 if self.result_ok {
1383                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1385                         } }
1386                 } else {
1387                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1389                         } }
1390                 }
1391         }
1392 }
1393 #[no_mangle]
1394 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1395 /// but with all dynamically-allocated buffers duplicated in new buffers.
1396 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1397 #[repr(C)]
1398 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1399 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1400         /// A pointer to the contents in the success state.
1401         /// Reading from this pointer when `result_ok` is not set is undefined.
1402         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1403         /// A pointer to the contents in the error state.
1404         /// Reading from this pointer when `result_ok` is set is undefined.
1405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1406 }
1407 #[repr(C)]
1408 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1409 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1411 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1412         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1413         /// `err` or `result` depending on the state of `result_ok`.
1414         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1415         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1416         pub result_ok: bool,
1417 }
1418 #[no_mangle]
1419 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1420 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1421         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1422                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1423                         result: Box::into_raw(Box::new(o)),
1424                 },
1425                 result_ok: true,
1426         }
1427 }
1428 #[no_mangle]
1429 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1430 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1431         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1432                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1433                         err: Box::into_raw(Box::new(e)),
1434                 },
1435                 result_ok: false,
1436         }
1437 }
1438 /// Checks if the given object is currently in the success state
1439 #[no_mangle]
1440 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1441         o.result_ok
1442 }
1443 #[no_mangle]
1444 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1445 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1446 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1447         fn drop(&mut self) {
1448                 if self.result_ok {
1449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1451                         }
1452                 } else {
1453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1455                         }
1456                 }
1457         }
1458 }
1459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1461                 let contents = if o.result_ok {
1462                         let result = unsafe { o.contents.result };
1463                         unsafe { o.contents.result = core::ptr::null_mut() };
1464                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1465                 } else {
1466                         let err = unsafe { o.contents.err };
1467                         unsafe { o.contents.err = core::ptr::null_mut(); }
1468                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1469                 };
1470                 Self {
1471                         contents,
1472                         result_ok: o.result_ok,
1473                 }
1474         }
1475 }
1476 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1477         fn clone(&self) -> Self {
1478                 if self.result_ok {
1479                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1481                         } }
1482                 } else {
1483                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1485                         } }
1486                 }
1487         }
1488 }
1489 #[no_mangle]
1490 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1491 /// but with all dynamically-allocated buffers duplicated in new buffers.
1492 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1493 #[repr(C)]
1494 /// The contents of CResult_TrustedClosingTransactionNoneZ
1495 pub union CResult_TrustedClosingTransactionNoneZPtr {
1496         /// A pointer to the contents in the success state.
1497         /// Reading from this pointer when `result_ok` is not set is undefined.
1498         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1499         /// Note that this value is always NULL, as there are no contents in the Err variant
1500         pub err: *mut core::ffi::c_void,
1501 }
1502 #[repr(C)]
1503 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_TrustedClosingTransactionNoneZ {
1507         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1508         /// `err` or `result` depending on the state of `result_ok`.
1509         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1510         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1511         pub result_ok: bool,
1512 }
1513 #[no_mangle]
1514 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1515 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1516         CResult_TrustedClosingTransactionNoneZ {
1517                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1518                         result: Box::into_raw(Box::new(o)),
1519                 },
1520                 result_ok: true,
1521         }
1522 }
1523 #[no_mangle]
1524 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1525 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1526         CResult_TrustedClosingTransactionNoneZ {
1527                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1528                         err: core::ptr::null_mut(),
1529                 },
1530                 result_ok: false,
1531         }
1532 }
1533 /// Checks if the given object is currently in the success state
1534 #[no_mangle]
1535 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1536         o.result_ok
1537 }
1538 #[no_mangle]
1539 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1540 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1541 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1542         fn drop(&mut self) {
1543                 if self.result_ok {
1544                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1545                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1546                         }
1547                 } else {
1548                 }
1549         }
1550 }
1551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1553                 let contents = if o.result_ok {
1554                         let result = unsafe { o.contents.result };
1555                         unsafe { o.contents.result = core::ptr::null_mut() };
1556                         CResult_TrustedClosingTransactionNoneZPtr { result }
1557                 } else {
1558                         let _ = unsafe { Box::from_raw(o.contents.err) };
1559                         o.contents.err = core::ptr::null_mut();
1560                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1561                 };
1562                 Self {
1563                         contents,
1564                         result_ok: o.result_ok,
1565                 }
1566         }
1567 }
1568 #[repr(C)]
1569 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1570 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1571         /// A pointer to the contents in the success state.
1572         /// Reading from this pointer when `result_ok` is not set is undefined.
1573         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1574         /// A pointer to the contents in the error state.
1575         /// Reading from this pointer when `result_ok` is set is undefined.
1576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1577 }
1578 #[repr(C)]
1579 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1580 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1582 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1583         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1584         /// `err` or `result` depending on the state of `result_ok`.
1585         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1586         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1587         pub result_ok: bool,
1588 }
1589 #[no_mangle]
1590 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1591 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1592         CResult_CommitmentTransactionDecodeErrorZ {
1593                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1594                         result: Box::into_raw(Box::new(o)),
1595                 },
1596                 result_ok: true,
1597         }
1598 }
1599 #[no_mangle]
1600 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1601 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1602         CResult_CommitmentTransactionDecodeErrorZ {
1603                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1604                         err: Box::into_raw(Box::new(e)),
1605                 },
1606                 result_ok: false,
1607         }
1608 }
1609 /// Checks if the given object is currently in the success state
1610 #[no_mangle]
1611 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1612         o.result_ok
1613 }
1614 #[no_mangle]
1615 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1616 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1617 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1618         fn drop(&mut self) {
1619                 if self.result_ok {
1620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1622                         }
1623                 } else {
1624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1626                         }
1627                 }
1628         }
1629 }
1630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1632                 let contents = if o.result_ok {
1633                         let result = unsafe { o.contents.result };
1634                         unsafe { o.contents.result = core::ptr::null_mut() };
1635                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1636                 } else {
1637                         let err = unsafe { o.contents.err };
1638                         unsafe { o.contents.err = core::ptr::null_mut(); }
1639                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1640                 };
1641                 Self {
1642                         contents,
1643                         result_ok: o.result_ok,
1644                 }
1645         }
1646 }
1647 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1648         fn clone(&self) -> Self {
1649                 if self.result_ok {
1650                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1651                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1652                         } }
1653                 } else {
1654                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1656                         } }
1657                 }
1658         }
1659 }
1660 #[no_mangle]
1661 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1662 /// but with all dynamically-allocated buffers duplicated in new buffers.
1663 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1664 #[repr(C)]
1665 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1666 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1667         /// A pointer to the contents in the success state.
1668         /// Reading from this pointer when `result_ok` is not set is undefined.
1669         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1670         /// Note that this value is always NULL, as there are no contents in the Err variant
1671         pub err: *mut core::ffi::c_void,
1672 }
1673 #[repr(C)]
1674 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1675 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1677 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1678         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1679         /// `err` or `result` depending on the state of `result_ok`.
1680         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1681         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1682         pub result_ok: bool,
1683 }
1684 #[no_mangle]
1685 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1686 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1687         CResult_TrustedCommitmentTransactionNoneZ {
1688                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1689                         result: Box::into_raw(Box::new(o)),
1690                 },
1691                 result_ok: true,
1692         }
1693 }
1694 #[no_mangle]
1695 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1696 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1697         CResult_TrustedCommitmentTransactionNoneZ {
1698                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1699                         err: core::ptr::null_mut(),
1700                 },
1701                 result_ok: false,
1702         }
1703 }
1704 /// Checks if the given object is currently in the success state
1705 #[no_mangle]
1706 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1707         o.result_ok
1708 }
1709 #[no_mangle]
1710 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1711 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1712 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1713         fn drop(&mut self) {
1714                 if self.result_ok {
1715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1717                         }
1718                 } else {
1719                 }
1720         }
1721 }
1722 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1723         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1724                 let contents = if o.result_ok {
1725                         let result = unsafe { o.contents.result };
1726                         unsafe { o.contents.result = core::ptr::null_mut() };
1727                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1728                 } else {
1729                         let _ = unsafe { Box::from_raw(o.contents.err) };
1730                         o.contents.err = core::ptr::null_mut();
1731                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1732                 };
1733                 Self {
1734                         contents,
1735                         result_ok: o.result_ok,
1736                 }
1737         }
1738 }
1739 #[repr(C)]
1740 /// The contents of CResult_CVec_SignatureZNoneZ
1741 pub union CResult_CVec_SignatureZNoneZPtr {
1742         /// A pointer to the contents in the success state.
1743         /// Reading from this pointer when `result_ok` is not set is undefined.
1744         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1745         /// Note that this value is always NULL, as there are no contents in the Err variant
1746         pub err: *mut core::ffi::c_void,
1747 }
1748 #[repr(C)]
1749 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1750 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1751 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1752 pub struct CResult_CVec_SignatureZNoneZ {
1753         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1754         /// `err` or `result` depending on the state of `result_ok`.
1755         pub contents: CResult_CVec_SignatureZNoneZPtr,
1756         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1757         pub result_ok: bool,
1758 }
1759 #[no_mangle]
1760 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1761 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1762         CResult_CVec_SignatureZNoneZ {
1763                 contents: CResult_CVec_SignatureZNoneZPtr {
1764                         result: Box::into_raw(Box::new(o)),
1765                 },
1766                 result_ok: true,
1767         }
1768 }
1769 #[no_mangle]
1770 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1771 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1772         CResult_CVec_SignatureZNoneZ {
1773                 contents: CResult_CVec_SignatureZNoneZPtr {
1774                         err: core::ptr::null_mut(),
1775                 },
1776                 result_ok: false,
1777         }
1778 }
1779 /// Checks if the given object is currently in the success state
1780 #[no_mangle]
1781 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1782         o.result_ok
1783 }
1784 #[no_mangle]
1785 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1786 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1787 impl Drop for CResult_CVec_SignatureZNoneZ {
1788         fn drop(&mut self) {
1789                 if self.result_ok {
1790                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1791                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1792                         }
1793                 } else {
1794                 }
1795         }
1796 }
1797 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1798         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1799                 let contents = if o.result_ok {
1800                         let result = unsafe { o.contents.result };
1801                         unsafe { o.contents.result = core::ptr::null_mut() };
1802                         CResult_CVec_SignatureZNoneZPtr { result }
1803                 } else {
1804                         let _ = unsafe { Box::from_raw(o.contents.err) };
1805                         o.contents.err = core::ptr::null_mut();
1806                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1807                 };
1808                 Self {
1809                         contents,
1810                         result_ok: o.result_ok,
1811                 }
1812         }
1813 }
1814 impl Clone for CResult_CVec_SignatureZNoneZ {
1815         fn clone(&self) -> Self {
1816                 if self.result_ok {
1817                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1818                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1819                         } }
1820                 } else {
1821                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1822                                 err: core::ptr::null_mut()
1823                         } }
1824                 }
1825         }
1826 }
1827 #[no_mangle]
1828 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1829 /// but with all dynamically-allocated buffers duplicated in new buffers.
1830 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1831 #[repr(C)]
1832 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1833 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1834         /// A pointer to the contents in the success state.
1835         /// Reading from this pointer when `result_ok` is not set is undefined.
1836         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1837         /// A pointer to the contents in the error state.
1838         /// Reading from this pointer when `result_ok` is set is undefined.
1839         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1840 }
1841 #[repr(C)]
1842 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1843 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1845 pub struct CResult_ShutdownScriptDecodeErrorZ {
1846         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1847         /// `err` or `result` depending on the state of `result_ok`.
1848         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1849         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1850         pub result_ok: bool,
1851 }
1852 #[no_mangle]
1853 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1854 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1855         CResult_ShutdownScriptDecodeErrorZ {
1856                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1857                         result: Box::into_raw(Box::new(o)),
1858                 },
1859                 result_ok: true,
1860         }
1861 }
1862 #[no_mangle]
1863 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1864 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1865         CResult_ShutdownScriptDecodeErrorZ {
1866                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1867                         err: Box::into_raw(Box::new(e)),
1868                 },
1869                 result_ok: false,
1870         }
1871 }
1872 /// Checks if the given object is currently in the success state
1873 #[no_mangle]
1874 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1875         o.result_ok
1876 }
1877 #[no_mangle]
1878 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1879 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1880 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1881         fn drop(&mut self) {
1882                 if self.result_ok {
1883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1885                         }
1886                 } else {
1887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1889                         }
1890                 }
1891         }
1892 }
1893 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1895                 let contents = if o.result_ok {
1896                         let result = unsafe { o.contents.result };
1897                         unsafe { o.contents.result = core::ptr::null_mut() };
1898                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1899                 } else {
1900                         let err = unsafe { o.contents.err };
1901                         unsafe { o.contents.err = core::ptr::null_mut(); }
1902                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1903                 };
1904                 Self {
1905                         contents,
1906                         result_ok: o.result_ok,
1907                 }
1908         }
1909 }
1910 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1911         fn clone(&self) -> Self {
1912                 if self.result_ok {
1913                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1914                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1915                         } }
1916                 } else {
1917                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1918                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1919                         } }
1920                 }
1921         }
1922 }
1923 #[no_mangle]
1924 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1925 /// but with all dynamically-allocated buffers duplicated in new buffers.
1926 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1927 #[repr(C)]
1928 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1929 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1930         /// A pointer to the contents in the success state.
1931         /// Reading from this pointer when `result_ok` is not set is undefined.
1932         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1933         /// A pointer to the contents in the error state.
1934         /// Reading from this pointer when `result_ok` is set is undefined.
1935         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1936 }
1937 #[repr(C)]
1938 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1939 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1941 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1942         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1943         /// `err` or `result` depending on the state of `result_ok`.
1944         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1945         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1946         pub result_ok: bool,
1947 }
1948 #[no_mangle]
1949 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1950 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1951         CResult_ShutdownScriptInvalidShutdownScriptZ {
1952                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1953                         result: Box::into_raw(Box::new(o)),
1954                 },
1955                 result_ok: true,
1956         }
1957 }
1958 #[no_mangle]
1959 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1960 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1961         CResult_ShutdownScriptInvalidShutdownScriptZ {
1962                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1963                         err: Box::into_raw(Box::new(e)),
1964                 },
1965                 result_ok: false,
1966         }
1967 }
1968 /// Checks if the given object is currently in the success state
1969 #[no_mangle]
1970 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1971         o.result_ok
1972 }
1973 #[no_mangle]
1974 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1975 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1976 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1977         fn drop(&mut self) {
1978                 if self.result_ok {
1979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1981                         }
1982                 } else {
1983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1985                         }
1986                 }
1987         }
1988 }
1989 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1990         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1991                 let contents = if o.result_ok {
1992                         let result = unsafe { o.contents.result };
1993                         unsafe { o.contents.result = core::ptr::null_mut() };
1994                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1995                 } else {
1996                         let err = unsafe { o.contents.err };
1997                         unsafe { o.contents.err = core::ptr::null_mut(); }
1998                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1999                 };
2000                 Self {
2001                         contents,
2002                         result_ok: o.result_ok,
2003                 }
2004         }
2005 }
2006 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
2007         fn clone(&self) -> Self {
2008                 if self.result_ok {
2009                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2010                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2011                         } }
2012                 } else {
2013                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2014                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
2015                         } }
2016                 }
2017         }
2018 }
2019 #[no_mangle]
2020 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
2021 /// but with all dynamically-allocated buffers duplicated in new buffers.
2022 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
2023 #[repr(C)]
2024 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
2025 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
2026         /// A pointer to the contents in the success state.
2027         /// Reading from this pointer when `result_ok` is not set is undefined.
2028         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
2029         /// A pointer to the contents in the error state.
2030         /// Reading from this pointer when `result_ok` is set is undefined.
2031         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2032 }
2033 #[repr(C)]
2034 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
2035 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
2036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2037 pub struct CResult_BlindedPayInfoDecodeErrorZ {
2038         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
2039         /// `err` or `result` depending on the state of `result_ok`.
2040         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
2041         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
2042         pub result_ok: bool,
2043 }
2044 #[no_mangle]
2045 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
2046 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
2047         CResult_BlindedPayInfoDecodeErrorZ {
2048                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2049                         result: Box::into_raw(Box::new(o)),
2050                 },
2051                 result_ok: true,
2052         }
2053 }
2054 #[no_mangle]
2055 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
2056 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
2057         CResult_BlindedPayInfoDecodeErrorZ {
2058                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2059                         err: Box::into_raw(Box::new(e)),
2060                 },
2061                 result_ok: false,
2062         }
2063 }
2064 /// Checks if the given object is currently in the success state
2065 #[no_mangle]
2066 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
2067         o.result_ok
2068 }
2069 #[no_mangle]
2070 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
2071 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
2072 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
2073         fn drop(&mut self) {
2074                 if self.result_ok {
2075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2077                         }
2078                 } else {
2079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2081                         }
2082                 }
2083         }
2084 }
2085 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
2086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
2087                 let contents = if o.result_ok {
2088                         let result = unsafe { o.contents.result };
2089                         unsafe { o.contents.result = core::ptr::null_mut() };
2090                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
2091                 } else {
2092                         let err = unsafe { o.contents.err };
2093                         unsafe { o.contents.err = core::ptr::null_mut(); }
2094                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
2095                 };
2096                 Self {
2097                         contents,
2098                         result_ok: o.result_ok,
2099                 }
2100         }
2101 }
2102 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
2103         fn clone(&self) -> Self {
2104                 if self.result_ok {
2105                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2106                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
2107                         } }
2108                 } else {
2109                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2111                         } }
2112                 }
2113         }
2114 }
2115 #[no_mangle]
2116 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
2117 /// but with all dynamically-allocated buffers duplicated in new buffers.
2118 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
2119 #[repr(C)]
2120 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2121 pub enum COption_WriteableScoreZ {
2122         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2123         Some(crate::lightning::routing::scoring::WriteableScore),
2124         /// When we're in this state, this COption_WriteableScoreZ contains nothing
2125         None
2126 }
2127 impl COption_WriteableScoreZ {
2128         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2129                 if let Self::None = self { false } else { true }
2130         }
2131         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2132                 !self.is_some()
2133         }
2134         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2135                 if let Self::Some(v) = self { v } else { unreachable!() }
2136         }
2137 }
2138 #[no_mangle]
2139 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2140 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2141         COption_WriteableScoreZ::Some(o)
2142 }
2143 #[no_mangle]
2144 /// Constructs a new COption_WriteableScoreZ containing nothing
2145 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2146         COption_WriteableScoreZ::None
2147 }
2148 #[no_mangle]
2149 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2150 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2151 #[repr(C)]
2152 /// The contents of CResult_NoneErrorZ
2153 pub union CResult_NoneErrorZPtr {
2154         /// Note that this value is always NULL, as there are no contents in the OK variant
2155         pub result: *mut core::ffi::c_void,
2156         /// A pointer to the contents in the error state.
2157         /// Reading from this pointer when `result_ok` is set is undefined.
2158         pub err: *mut crate::c_types::IOError,
2159 }
2160 #[repr(C)]
2161 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2162 /// containing a () on success and a crate::c_types::IOError on failure.
2163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2164 pub struct CResult_NoneErrorZ {
2165         /// The contents of this CResult_NoneErrorZ, accessible via either
2166         /// `err` or `result` depending on the state of `result_ok`.
2167         pub contents: CResult_NoneErrorZPtr,
2168         /// Whether this CResult_NoneErrorZ represents a success state.
2169         pub result_ok: bool,
2170 }
2171 #[no_mangle]
2172 /// Creates a new CResult_NoneErrorZ in the success state.
2173 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2174         CResult_NoneErrorZ {
2175                 contents: CResult_NoneErrorZPtr {
2176                         result: core::ptr::null_mut(),
2177                 },
2178                 result_ok: true,
2179         }
2180 }
2181 #[no_mangle]
2182 /// Creates a new CResult_NoneErrorZ in the error state.
2183 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2184         CResult_NoneErrorZ {
2185                 contents: CResult_NoneErrorZPtr {
2186                         err: Box::into_raw(Box::new(e)),
2187                 },
2188                 result_ok: false,
2189         }
2190 }
2191 /// Checks if the given object is currently in the success state
2192 #[no_mangle]
2193 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2194         o.result_ok
2195 }
2196 #[no_mangle]
2197 /// Frees any resources used by the CResult_NoneErrorZ.
2198 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2199 impl Drop for CResult_NoneErrorZ {
2200         fn drop(&mut self) {
2201                 if self.result_ok {
2202                 } else {
2203                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2204                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2205                         }
2206                 }
2207         }
2208 }
2209 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2210         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2211                 let contents = if o.result_ok {
2212                         let _ = unsafe { Box::from_raw(o.contents.result) };
2213                         o.contents.result = core::ptr::null_mut();
2214                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2215                 } else {
2216                         let err = unsafe { o.contents.err };
2217                         unsafe { o.contents.err = core::ptr::null_mut(); }
2218                         CResult_NoneErrorZPtr { err }
2219                 };
2220                 Self {
2221                         contents,
2222                         result_ok: o.result_ok,
2223                 }
2224         }
2225 }
2226 impl Clone for CResult_NoneErrorZ {
2227         fn clone(&self) -> Self {
2228                 if self.result_ok {
2229                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2230                                 result: core::ptr::null_mut()
2231                         } }
2232                 } else {
2233                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2234                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2235                         } }
2236                 }
2237         }
2238 }
2239 #[no_mangle]
2240 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2241 /// but with all dynamically-allocated buffers duplicated in new buffers.
2242 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2243 #[repr(C)]
2244 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2245 /// This corresponds to std::vector in C++
2246 pub struct CVec_ChannelDetailsZ {
2247         /// The elements in the array.
2248         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2249         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2250         /// The number of elements pointed to by `data`.
2251         pub datalen: usize
2252 }
2253 impl CVec_ChannelDetailsZ {
2254         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2255                 if self.datalen == 0 { return Vec::new(); }
2256                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2257                 self.data = core::ptr::null_mut();
2258                 self.datalen = 0;
2259                 ret
2260         }
2261         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2262                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2263         }
2264 }
2265 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2266         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2267                 let datalen = v.len();
2268                 let data = Box::into_raw(v.into_boxed_slice());
2269                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2270         }
2271 }
2272 #[no_mangle]
2273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2274 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2275 impl Drop for CVec_ChannelDetailsZ {
2276         fn drop(&mut self) {
2277                 if self.datalen == 0 { return; }
2278                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2279         }
2280 }
2281 impl Clone for CVec_ChannelDetailsZ {
2282         fn clone(&self) -> Self {
2283                 let mut res = Vec::new();
2284                 if self.datalen == 0 { return Self::from(res); }
2285                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2286                 Self::from(res)
2287         }
2288 }
2289 #[repr(C)]
2290 /// The contents of CResult_RouteLightningErrorZ
2291 pub union CResult_RouteLightningErrorZPtr {
2292         /// A pointer to the contents in the success state.
2293         /// Reading from this pointer when `result_ok` is not set is undefined.
2294         pub result: *mut crate::lightning::routing::router::Route,
2295         /// A pointer to the contents in the error state.
2296         /// Reading from this pointer when `result_ok` is set is undefined.
2297         pub err: *mut crate::lightning::ln::msgs::LightningError,
2298 }
2299 #[repr(C)]
2300 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2301 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2303 pub struct CResult_RouteLightningErrorZ {
2304         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2305         /// `err` or `result` depending on the state of `result_ok`.
2306         pub contents: CResult_RouteLightningErrorZPtr,
2307         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2308         pub result_ok: bool,
2309 }
2310 #[no_mangle]
2311 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2312 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2313         CResult_RouteLightningErrorZ {
2314                 contents: CResult_RouteLightningErrorZPtr {
2315                         result: Box::into_raw(Box::new(o)),
2316                 },
2317                 result_ok: true,
2318         }
2319 }
2320 #[no_mangle]
2321 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2322 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2323         CResult_RouteLightningErrorZ {
2324                 contents: CResult_RouteLightningErrorZPtr {
2325                         err: Box::into_raw(Box::new(e)),
2326                 },
2327                 result_ok: false,
2328         }
2329 }
2330 /// Checks if the given object is currently in the success state
2331 #[no_mangle]
2332 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2333         o.result_ok
2334 }
2335 #[no_mangle]
2336 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2337 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2338 impl Drop for CResult_RouteLightningErrorZ {
2339         fn drop(&mut self) {
2340                 if self.result_ok {
2341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2343                         }
2344                 } else {
2345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2347                         }
2348                 }
2349         }
2350 }
2351 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2353                 let contents = if o.result_ok {
2354                         let result = unsafe { o.contents.result };
2355                         unsafe { o.contents.result = core::ptr::null_mut() };
2356                         CResult_RouteLightningErrorZPtr { result }
2357                 } else {
2358                         let err = unsafe { o.contents.err };
2359                         unsafe { o.contents.err = core::ptr::null_mut(); }
2360                         CResult_RouteLightningErrorZPtr { err }
2361                 };
2362                 Self {
2363                         contents,
2364                         result_ok: o.result_ok,
2365                 }
2366         }
2367 }
2368 impl Clone for CResult_RouteLightningErrorZ {
2369         fn clone(&self) -> Self {
2370                 if self.result_ok {
2371                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2372                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2373                         } }
2374                 } else {
2375                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2377                         } }
2378                 }
2379         }
2380 }
2381 #[no_mangle]
2382 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2383 /// but with all dynamically-allocated buffers duplicated in new buffers.
2384 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2385 #[repr(C)]
2386 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2387 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2388         /// A pointer to the contents in the success state.
2389         /// Reading from this pointer when `result_ok` is not set is undefined.
2390         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2391         /// A pointer to the contents in the error state.
2392         /// Reading from this pointer when `result_ok` is set is undefined.
2393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2394 }
2395 #[repr(C)]
2396 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2397 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2399 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2400         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2401         /// `err` or `result` depending on the state of `result_ok`.
2402         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2403         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2404         pub result_ok: bool,
2405 }
2406 #[no_mangle]
2407 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2408 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2409         CResult_InFlightHtlcsDecodeErrorZ {
2410                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2411                         result: Box::into_raw(Box::new(o)),
2412                 },
2413                 result_ok: true,
2414         }
2415 }
2416 #[no_mangle]
2417 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2418 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2419         CResult_InFlightHtlcsDecodeErrorZ {
2420                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2421                         err: Box::into_raw(Box::new(e)),
2422                 },
2423                 result_ok: false,
2424         }
2425 }
2426 /// Checks if the given object is currently in the success state
2427 #[no_mangle]
2428 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2429         o.result_ok
2430 }
2431 #[no_mangle]
2432 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2433 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2434 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2435         fn drop(&mut self) {
2436                 if self.result_ok {
2437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2439                         }
2440                 } else {
2441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2443                         }
2444                 }
2445         }
2446 }
2447 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2449                 let contents = if o.result_ok {
2450                         let result = unsafe { o.contents.result };
2451                         unsafe { o.contents.result = core::ptr::null_mut() };
2452                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
2453                 } else {
2454                         let err = unsafe { o.contents.err };
2455                         unsafe { o.contents.err = core::ptr::null_mut(); }
2456                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
2457                 };
2458                 Self {
2459                         contents,
2460                         result_ok: o.result_ok,
2461                 }
2462         }
2463 }
2464 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2465         fn clone(&self) -> Self {
2466                 if self.result_ok {
2467                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2468                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2469                         } }
2470                 } else {
2471                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2473                         } }
2474                 }
2475         }
2476 }
2477 #[no_mangle]
2478 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2479 /// but with all dynamically-allocated buffers duplicated in new buffers.
2480 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2481 #[repr(C)]
2482 /// The contents of CResult_RouteHopDecodeErrorZ
2483 pub union CResult_RouteHopDecodeErrorZPtr {
2484         /// A pointer to the contents in the success state.
2485         /// Reading from this pointer when `result_ok` is not set is undefined.
2486         pub result: *mut crate::lightning::routing::router::RouteHop,
2487         /// A pointer to the contents in the error state.
2488         /// Reading from this pointer when `result_ok` is set is undefined.
2489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2490 }
2491 #[repr(C)]
2492 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2493 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2495 pub struct CResult_RouteHopDecodeErrorZ {
2496         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2497         /// `err` or `result` depending on the state of `result_ok`.
2498         pub contents: CResult_RouteHopDecodeErrorZPtr,
2499         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2500         pub result_ok: bool,
2501 }
2502 #[no_mangle]
2503 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2504 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2505         CResult_RouteHopDecodeErrorZ {
2506                 contents: CResult_RouteHopDecodeErrorZPtr {
2507                         result: Box::into_raw(Box::new(o)),
2508                 },
2509                 result_ok: true,
2510         }
2511 }
2512 #[no_mangle]
2513 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2514 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2515         CResult_RouteHopDecodeErrorZ {
2516                 contents: CResult_RouteHopDecodeErrorZPtr {
2517                         err: Box::into_raw(Box::new(e)),
2518                 },
2519                 result_ok: false,
2520         }
2521 }
2522 /// Checks if the given object is currently in the success state
2523 #[no_mangle]
2524 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2525         o.result_ok
2526 }
2527 #[no_mangle]
2528 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2529 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2530 impl Drop for CResult_RouteHopDecodeErrorZ {
2531         fn drop(&mut self) {
2532                 if self.result_ok {
2533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2535                         }
2536                 } else {
2537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2539                         }
2540                 }
2541         }
2542 }
2543 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2545                 let contents = if o.result_ok {
2546                         let result = unsafe { o.contents.result };
2547                         unsafe { o.contents.result = core::ptr::null_mut() };
2548                         CResult_RouteHopDecodeErrorZPtr { result }
2549                 } else {
2550                         let err = unsafe { o.contents.err };
2551                         unsafe { o.contents.err = core::ptr::null_mut(); }
2552                         CResult_RouteHopDecodeErrorZPtr { err }
2553                 };
2554                 Self {
2555                         contents,
2556                         result_ok: o.result_ok,
2557                 }
2558         }
2559 }
2560 impl Clone for CResult_RouteHopDecodeErrorZ {
2561         fn clone(&self) -> Self {
2562                 if self.result_ok {
2563                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2564                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2565                         } }
2566                 } else {
2567                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2569                         } }
2570                 }
2571         }
2572 }
2573 #[no_mangle]
2574 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2575 /// but with all dynamically-allocated buffers duplicated in new buffers.
2576 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2577 #[repr(C)]
2578 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
2579 /// This corresponds to std::vector in C++
2580 pub struct CVec_BlindedHopZ {
2581         /// The elements in the array.
2582         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2583         pub data: *mut crate::lightning::blinded_path::BlindedHop,
2584         /// The number of elements pointed to by `data`.
2585         pub datalen: usize
2586 }
2587 impl CVec_BlindedHopZ {
2588         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
2589                 if self.datalen == 0 { return Vec::new(); }
2590                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2591                 self.data = core::ptr::null_mut();
2592                 self.datalen = 0;
2593                 ret
2594         }
2595         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
2596                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2597         }
2598 }
2599 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
2600         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
2601                 let datalen = v.len();
2602                 let data = Box::into_raw(v.into_boxed_slice());
2603                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2604         }
2605 }
2606 #[no_mangle]
2607 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2608 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
2609 impl Drop for CVec_BlindedHopZ {
2610         fn drop(&mut self) {
2611                 if self.datalen == 0 { return; }
2612                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2613         }
2614 }
2615 impl Clone for CVec_BlindedHopZ {
2616         fn clone(&self) -> Self {
2617                 let mut res = Vec::new();
2618                 if self.datalen == 0 { return Self::from(res); }
2619                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2620                 Self::from(res)
2621         }
2622 }
2623 #[repr(C)]
2624 /// The contents of CResult_BlindedTailDecodeErrorZ
2625 pub union CResult_BlindedTailDecodeErrorZPtr {
2626         /// A pointer to the contents in the success state.
2627         /// Reading from this pointer when `result_ok` is not set is undefined.
2628         pub result: *mut crate::lightning::routing::router::BlindedTail,
2629         /// A pointer to the contents in the error state.
2630         /// Reading from this pointer when `result_ok` is set is undefined.
2631         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2632 }
2633 #[repr(C)]
2634 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
2635 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
2636 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2637 pub struct CResult_BlindedTailDecodeErrorZ {
2638         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
2639         /// `err` or `result` depending on the state of `result_ok`.
2640         pub contents: CResult_BlindedTailDecodeErrorZPtr,
2641         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
2642         pub result_ok: bool,
2643 }
2644 #[no_mangle]
2645 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
2646 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
2647         CResult_BlindedTailDecodeErrorZ {
2648                 contents: CResult_BlindedTailDecodeErrorZPtr {
2649                         result: Box::into_raw(Box::new(o)),
2650                 },
2651                 result_ok: true,
2652         }
2653 }
2654 #[no_mangle]
2655 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
2656 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
2657         CResult_BlindedTailDecodeErrorZ {
2658                 contents: CResult_BlindedTailDecodeErrorZPtr {
2659                         err: Box::into_raw(Box::new(e)),
2660                 },
2661                 result_ok: false,
2662         }
2663 }
2664 /// Checks if the given object is currently in the success state
2665 #[no_mangle]
2666 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
2667         o.result_ok
2668 }
2669 #[no_mangle]
2670 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
2671 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
2672 impl Drop for CResult_BlindedTailDecodeErrorZ {
2673         fn drop(&mut self) {
2674                 if self.result_ok {
2675                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2676                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2677                         }
2678                 } else {
2679                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2680                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2681                         }
2682                 }
2683         }
2684 }
2685 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
2686         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
2687                 let contents = if o.result_ok {
2688                         let result = unsafe { o.contents.result };
2689                         unsafe { o.contents.result = core::ptr::null_mut() };
2690                         CResult_BlindedTailDecodeErrorZPtr { result }
2691                 } else {
2692                         let err = unsafe { o.contents.err };
2693                         unsafe { o.contents.err = core::ptr::null_mut(); }
2694                         CResult_BlindedTailDecodeErrorZPtr { err }
2695                 };
2696                 Self {
2697                         contents,
2698                         result_ok: o.result_ok,
2699                 }
2700         }
2701 }
2702 impl Clone for CResult_BlindedTailDecodeErrorZ {
2703         fn clone(&self) -> Self {
2704                 if self.result_ok {
2705                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
2706                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
2707                         } }
2708                 } else {
2709                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
2710                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2711                         } }
2712                 }
2713         }
2714 }
2715 #[no_mangle]
2716 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
2717 /// but with all dynamically-allocated buffers duplicated in new buffers.
2718 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
2719 #[repr(C)]
2720 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2721 /// This corresponds to std::vector in C++
2722 pub struct CVec_RouteHopZ {
2723         /// The elements in the array.
2724         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2725         pub data: *mut crate::lightning::routing::router::RouteHop,
2726         /// The number of elements pointed to by `data`.
2727         pub datalen: usize
2728 }
2729 impl CVec_RouteHopZ {
2730         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2731                 if self.datalen == 0 { return Vec::new(); }
2732                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2733                 self.data = core::ptr::null_mut();
2734                 self.datalen = 0;
2735                 ret
2736         }
2737         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2738                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2739         }
2740 }
2741 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2742         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2743                 let datalen = v.len();
2744                 let data = Box::into_raw(v.into_boxed_slice());
2745                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2746         }
2747 }
2748 #[no_mangle]
2749 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2750 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2751 impl Drop for CVec_RouteHopZ {
2752         fn drop(&mut self) {
2753                 if self.datalen == 0 { return; }
2754                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2755         }
2756 }
2757 impl Clone for CVec_RouteHopZ {
2758         fn clone(&self) -> Self {
2759                 let mut res = Vec::new();
2760                 if self.datalen == 0 { return Self::from(res); }
2761                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2762                 Self::from(res)
2763         }
2764 }
2765 #[repr(C)]
2766 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
2767 /// This corresponds to std::vector in C++
2768 pub struct CVec_PathZ {
2769         /// The elements in the array.
2770         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2771         pub data: *mut crate::lightning::routing::router::Path,
2772         /// The number of elements pointed to by `data`.
2773         pub datalen: usize
2774 }
2775 impl CVec_PathZ {
2776         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
2777                 if self.datalen == 0 { return Vec::new(); }
2778                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2779                 self.data = core::ptr::null_mut();
2780                 self.datalen = 0;
2781                 ret
2782         }
2783         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
2784                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2785         }
2786 }
2787 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
2788         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
2789                 let datalen = v.len();
2790                 let data = Box::into_raw(v.into_boxed_slice());
2791                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2792         }
2793 }
2794 #[no_mangle]
2795 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2796 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
2797 impl Drop for CVec_PathZ {
2798         fn drop(&mut self) {
2799                 if self.datalen == 0 { return; }
2800                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2801         }
2802 }
2803 impl Clone for CVec_PathZ {
2804         fn clone(&self) -> Self {
2805                 let mut res = Vec::new();
2806                 if self.datalen == 0 { return Self::from(res); }
2807                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2808                 Self::from(res)
2809         }
2810 }
2811 #[repr(C)]
2812 /// The contents of CResult_RouteDecodeErrorZ
2813 pub union CResult_RouteDecodeErrorZPtr {
2814         /// A pointer to the contents in the success state.
2815         /// Reading from this pointer when `result_ok` is not set is undefined.
2816         pub result: *mut crate::lightning::routing::router::Route,
2817         /// A pointer to the contents in the error state.
2818         /// Reading from this pointer when `result_ok` is set is undefined.
2819         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2820 }
2821 #[repr(C)]
2822 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2823 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2825 pub struct CResult_RouteDecodeErrorZ {
2826         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2827         /// `err` or `result` depending on the state of `result_ok`.
2828         pub contents: CResult_RouteDecodeErrorZPtr,
2829         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2830         pub result_ok: bool,
2831 }
2832 #[no_mangle]
2833 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2834 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2835         CResult_RouteDecodeErrorZ {
2836                 contents: CResult_RouteDecodeErrorZPtr {
2837                         result: Box::into_raw(Box::new(o)),
2838                 },
2839                 result_ok: true,
2840         }
2841 }
2842 #[no_mangle]
2843 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2844 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2845         CResult_RouteDecodeErrorZ {
2846                 contents: CResult_RouteDecodeErrorZPtr {
2847                         err: Box::into_raw(Box::new(e)),
2848                 },
2849                 result_ok: false,
2850         }
2851 }
2852 /// Checks if the given object is currently in the success state
2853 #[no_mangle]
2854 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2855         o.result_ok
2856 }
2857 #[no_mangle]
2858 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2859 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2860 impl Drop for CResult_RouteDecodeErrorZ {
2861         fn drop(&mut self) {
2862                 if self.result_ok {
2863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2865                         }
2866                 } else {
2867                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2868                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2869                         }
2870                 }
2871         }
2872 }
2873 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2874         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2875                 let contents = if o.result_ok {
2876                         let result = unsafe { o.contents.result };
2877                         unsafe { o.contents.result = core::ptr::null_mut() };
2878                         CResult_RouteDecodeErrorZPtr { result }
2879                 } else {
2880                         let err = unsafe { o.contents.err };
2881                         unsafe { o.contents.err = core::ptr::null_mut(); }
2882                         CResult_RouteDecodeErrorZPtr { err }
2883                 };
2884                 Self {
2885                         contents,
2886                         result_ok: o.result_ok,
2887                 }
2888         }
2889 }
2890 impl Clone for CResult_RouteDecodeErrorZ {
2891         fn clone(&self) -> Self {
2892                 if self.result_ok {
2893                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2894                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2895                         } }
2896                 } else {
2897                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2898                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2899                         } }
2900                 }
2901         }
2902 }
2903 #[no_mangle]
2904 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2905 /// but with all dynamically-allocated buffers duplicated in new buffers.
2906 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2907 #[repr(C)]
2908 /// The contents of CResult_RouteParametersDecodeErrorZ
2909 pub union CResult_RouteParametersDecodeErrorZPtr {
2910         /// A pointer to the contents in the success state.
2911         /// Reading from this pointer when `result_ok` is not set is undefined.
2912         pub result: *mut crate::lightning::routing::router::RouteParameters,
2913         /// A pointer to the contents in the error state.
2914         /// Reading from this pointer when `result_ok` is set is undefined.
2915         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2916 }
2917 #[repr(C)]
2918 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2919 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2921 pub struct CResult_RouteParametersDecodeErrorZ {
2922         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2923         /// `err` or `result` depending on the state of `result_ok`.
2924         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2925         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2926         pub result_ok: bool,
2927 }
2928 #[no_mangle]
2929 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2930 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2931         CResult_RouteParametersDecodeErrorZ {
2932                 contents: CResult_RouteParametersDecodeErrorZPtr {
2933                         result: Box::into_raw(Box::new(o)),
2934                 },
2935                 result_ok: true,
2936         }
2937 }
2938 #[no_mangle]
2939 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2940 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2941         CResult_RouteParametersDecodeErrorZ {
2942                 contents: CResult_RouteParametersDecodeErrorZPtr {
2943                         err: Box::into_raw(Box::new(e)),
2944                 },
2945                 result_ok: false,
2946         }
2947 }
2948 /// Checks if the given object is currently in the success state
2949 #[no_mangle]
2950 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2951         o.result_ok
2952 }
2953 #[no_mangle]
2954 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2955 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2956 impl Drop for CResult_RouteParametersDecodeErrorZ {
2957         fn drop(&mut self) {
2958                 if self.result_ok {
2959                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2960                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2961                         }
2962                 } else {
2963                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2964                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2965                         }
2966                 }
2967         }
2968 }
2969 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2970         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2971                 let contents = if o.result_ok {
2972                         let result = unsafe { o.contents.result };
2973                         unsafe { o.contents.result = core::ptr::null_mut() };
2974                         CResult_RouteParametersDecodeErrorZPtr { result }
2975                 } else {
2976                         let err = unsafe { o.contents.err };
2977                         unsafe { o.contents.err = core::ptr::null_mut(); }
2978                         CResult_RouteParametersDecodeErrorZPtr { err }
2979                 };
2980                 Self {
2981                         contents,
2982                         result_ok: o.result_ok,
2983                 }
2984         }
2985 }
2986 impl Clone for CResult_RouteParametersDecodeErrorZ {
2987         fn clone(&self) -> Self {
2988                 if self.result_ok {
2989                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2990                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2991                         } }
2992                 } else {
2993                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2994                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2995                         } }
2996                 }
2997         }
2998 }
2999 #[no_mangle]
3000 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3001 /// but with all dynamically-allocated buffers duplicated in new buffers.
3002 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3003 #[repr(C)]
3004 /// A dynamically-allocated array of u64s of arbitrary size.
3005 /// This corresponds to std::vector in C++
3006 pub struct CVec_u64Z {
3007         /// The elements in the array.
3008         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3009         pub data: *mut u64,
3010         /// The number of elements pointed to by `data`.
3011         pub datalen: usize
3012 }
3013 impl CVec_u64Z {
3014         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3015                 if self.datalen == 0 { return Vec::new(); }
3016                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3017                 self.data = core::ptr::null_mut();
3018                 self.datalen = 0;
3019                 ret
3020         }
3021         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3022                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3023         }
3024 }
3025 impl From<Vec<u64>> for CVec_u64Z {
3026         fn from(v: Vec<u64>) -> Self {
3027                 let datalen = v.len();
3028                 let data = Box::into_raw(v.into_boxed_slice());
3029                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3030         }
3031 }
3032 #[no_mangle]
3033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3034 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
3035 impl Drop for CVec_u64Z {
3036         fn drop(&mut self) {
3037                 if self.datalen == 0 { return; }
3038                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3039         }
3040 }
3041 impl Clone for CVec_u64Z {
3042         fn clone(&self) -> Self {
3043                 let mut res = Vec::new();
3044                 if self.datalen == 0 { return Self::from(res); }
3045                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3046                 Self::from(res)
3047         }
3048 }
3049 #[repr(C)]
3050 /// The contents of CResult_PaymentParametersDecodeErrorZ
3051 pub union CResult_PaymentParametersDecodeErrorZPtr {
3052         /// A pointer to the contents in the success state.
3053         /// Reading from this pointer when `result_ok` is not set is undefined.
3054         pub result: *mut crate::lightning::routing::router::PaymentParameters,
3055         /// A pointer to the contents in the error state.
3056         /// Reading from this pointer when `result_ok` is set is undefined.
3057         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3058 }
3059 #[repr(C)]
3060 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_PaymentParametersDecodeErrorZ {
3064         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3065         /// `err` or `result` depending on the state of `result_ok`.
3066         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
3067         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3068         pub result_ok: bool,
3069 }
3070 #[no_mangle]
3071 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
3073         CResult_PaymentParametersDecodeErrorZ {
3074                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3075                         result: Box::into_raw(Box::new(o)),
3076                 },
3077                 result_ok: true,
3078         }
3079 }
3080 #[no_mangle]
3081 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
3083         CResult_PaymentParametersDecodeErrorZ {
3084                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3085                         err: Box::into_raw(Box::new(e)),
3086                 },
3087                 result_ok: false,
3088         }
3089 }
3090 /// Checks if the given object is currently in the success state
3091 #[no_mangle]
3092 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
3093         o.result_ok
3094 }
3095 #[no_mangle]
3096 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
3097 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
3098 impl Drop for CResult_PaymentParametersDecodeErrorZ {
3099         fn drop(&mut self) {
3100                 if self.result_ok {
3101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3103                         }
3104                 } else {
3105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3107                         }
3108                 }
3109         }
3110 }
3111 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
3112         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3113                 let contents = if o.result_ok {
3114                         let result = unsafe { o.contents.result };
3115                         unsafe { o.contents.result = core::ptr::null_mut() };
3116                         CResult_PaymentParametersDecodeErrorZPtr { result }
3117                 } else {
3118                         let err = unsafe { o.contents.err };
3119                         unsafe { o.contents.err = core::ptr::null_mut(); }
3120                         CResult_PaymentParametersDecodeErrorZPtr { err }
3121                 };
3122                 Self {
3123                         contents,
3124                         result_ok: o.result_ok,
3125                 }
3126         }
3127 }
3128 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3129         fn clone(&self) -> Self {
3130                 if self.result_ok {
3131                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3132                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3133                         } }
3134                 } else {
3135                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3136                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3137                         } }
3138                 }
3139         }
3140 }
3141 #[no_mangle]
3142 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3143 /// but with all dynamically-allocated buffers duplicated in new buffers.
3144 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3145 #[repr(C)]
3146 /// A tuple of 2 elements. See the individual fields for the types contained.
3147 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3148         /// The element at position 0
3149         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3150         /// The element at position 1
3151         pub b: crate::lightning::blinded_path::BlindedPath,
3152 }
3153 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3154         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3155                 Self {
3156                         a: tup.0,
3157                         b: tup.1,
3158                 }
3159         }
3160 }
3161 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3162         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3163                 (self.a, self.b)
3164         }
3165 }
3166 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3167         fn clone(&self) -> Self {
3168                 Self {
3169                         a: Clone::clone(&self.a),
3170                         b: Clone::clone(&self.b),
3171                 }
3172         }
3173 }
3174 #[no_mangle]
3175 /// Creates a new tuple which has the same data as `orig`
3176 /// but with all dynamically-allocated buffers duplicated in new buffers.
3177 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3178 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3179 #[no_mangle]
3180 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3181         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3182 }
3183
3184 #[no_mangle]
3185 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3186 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3187 #[repr(C)]
3188 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3189 /// This corresponds to std::vector in C++
3190 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3191         /// The elements in the array.
3192         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3193         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3194         /// The number of elements pointed to by `data`.
3195         pub datalen: usize
3196 }
3197 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3198         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3199                 if self.datalen == 0 { return Vec::new(); }
3200                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3201                 self.data = core::ptr::null_mut();
3202                 self.datalen = 0;
3203                 ret
3204         }
3205         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3206                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3207         }
3208 }
3209 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3210         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3211                 let datalen = v.len();
3212                 let data = Box::into_raw(v.into_boxed_slice());
3213                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3214         }
3215 }
3216 #[no_mangle]
3217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3218 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3219 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3220         fn drop(&mut self) {
3221                 if self.datalen == 0 { return; }
3222                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3223         }
3224 }
3225 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3226         fn clone(&self) -> Self {
3227                 let mut res = Vec::new();
3228                 if self.datalen == 0 { return Self::from(res); }
3229                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3230                 Self::from(res)
3231         }
3232 }
3233 #[repr(C)]
3234 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3235 /// This corresponds to std::vector in C++
3236 pub struct CVec_RouteHintZ {
3237         /// The elements in the array.
3238         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3239         pub data: *mut crate::lightning::routing::router::RouteHint,
3240         /// The number of elements pointed to by `data`.
3241         pub datalen: usize
3242 }
3243 impl CVec_RouteHintZ {
3244         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
3245                 if self.datalen == 0 { return Vec::new(); }
3246                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3247                 self.data = core::ptr::null_mut();
3248                 self.datalen = 0;
3249                 ret
3250         }
3251         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
3252                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3253         }
3254 }
3255 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
3256         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
3257                 let datalen = v.len();
3258                 let data = Box::into_raw(v.into_boxed_slice());
3259                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3260         }
3261 }
3262 #[no_mangle]
3263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3264 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3265 impl Drop for CVec_RouteHintZ {
3266         fn drop(&mut self) {
3267                 if self.datalen == 0 { return; }
3268                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3269         }
3270 }
3271 impl Clone for CVec_RouteHintZ {
3272         fn clone(&self) -> Self {
3273                 let mut res = Vec::new();
3274                 if self.datalen == 0 { return Self::from(res); }
3275                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3276                 Self::from(res)
3277         }
3278 }
3279 #[repr(C)]
3280 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3281 /// This corresponds to std::vector in C++
3282 pub struct CVec_RouteHintHopZ {
3283         /// The elements in the array.
3284         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3285         pub data: *mut crate::lightning::routing::router::RouteHintHop,
3286         /// The number of elements pointed to by `data`.
3287         pub datalen: usize
3288 }
3289 impl CVec_RouteHintHopZ {
3290         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3291                 if self.datalen == 0 { return Vec::new(); }
3292                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3293                 self.data = core::ptr::null_mut();
3294                 self.datalen = 0;
3295                 ret
3296         }
3297         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3298                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3299         }
3300 }
3301 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3302         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3303                 let datalen = v.len();
3304                 let data = Box::into_raw(v.into_boxed_slice());
3305                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3306         }
3307 }
3308 #[no_mangle]
3309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3310 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3311 impl Drop for CVec_RouteHintHopZ {
3312         fn drop(&mut self) {
3313                 if self.datalen == 0 { return; }
3314                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3315         }
3316 }
3317 impl Clone for CVec_RouteHintHopZ {
3318         fn clone(&self) -> Self {
3319                 let mut res = Vec::new();
3320                 if self.datalen == 0 { return Self::from(res); }
3321                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3322                 Self::from(res)
3323         }
3324 }
3325 #[repr(C)]
3326 /// The contents of CResult_RouteHintDecodeErrorZ
3327 pub union CResult_RouteHintDecodeErrorZPtr {
3328         /// A pointer to the contents in the success state.
3329         /// Reading from this pointer when `result_ok` is not set is undefined.
3330         pub result: *mut crate::lightning::routing::router::RouteHint,
3331         /// A pointer to the contents in the error state.
3332         /// Reading from this pointer when `result_ok` is set is undefined.
3333         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3334 }
3335 #[repr(C)]
3336 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3337 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3339 pub struct CResult_RouteHintDecodeErrorZ {
3340         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3341         /// `err` or `result` depending on the state of `result_ok`.
3342         pub contents: CResult_RouteHintDecodeErrorZPtr,
3343         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3344         pub result_ok: bool,
3345 }
3346 #[no_mangle]
3347 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3348 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3349         CResult_RouteHintDecodeErrorZ {
3350                 contents: CResult_RouteHintDecodeErrorZPtr {
3351                         result: Box::into_raw(Box::new(o)),
3352                 },
3353                 result_ok: true,
3354         }
3355 }
3356 #[no_mangle]
3357 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3358 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3359         CResult_RouteHintDecodeErrorZ {
3360                 contents: CResult_RouteHintDecodeErrorZPtr {
3361                         err: Box::into_raw(Box::new(e)),
3362                 },
3363                 result_ok: false,
3364         }
3365 }
3366 /// Checks if the given object is currently in the success state
3367 #[no_mangle]
3368 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
3369         o.result_ok
3370 }
3371 #[no_mangle]
3372 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
3373 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
3374 impl Drop for CResult_RouteHintDecodeErrorZ {
3375         fn drop(&mut self) {
3376                 if self.result_ok {
3377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3379                         }
3380                 } else {
3381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3383                         }
3384                 }
3385         }
3386 }
3387 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
3388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
3389                 let contents = if o.result_ok {
3390                         let result = unsafe { o.contents.result };
3391                         unsafe { o.contents.result = core::ptr::null_mut() };
3392                         CResult_RouteHintDecodeErrorZPtr { result }
3393                 } else {
3394                         let err = unsafe { o.contents.err };
3395                         unsafe { o.contents.err = core::ptr::null_mut(); }
3396                         CResult_RouteHintDecodeErrorZPtr { err }
3397                 };
3398                 Self {
3399                         contents,
3400                         result_ok: o.result_ok,
3401                 }
3402         }
3403 }
3404 impl Clone for CResult_RouteHintDecodeErrorZ {
3405         fn clone(&self) -> Self {
3406                 if self.result_ok {
3407                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
3408                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
3409                         } }
3410                 } else {
3411                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
3412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3413                         } }
3414                 }
3415         }
3416 }
3417 #[no_mangle]
3418 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
3419 /// but with all dynamically-allocated buffers duplicated in new buffers.
3420 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
3421 #[repr(C)]
3422 /// The contents of CResult_RouteHintHopDecodeErrorZ
3423 pub union CResult_RouteHintHopDecodeErrorZPtr {
3424         /// A pointer to the contents in the success state.
3425         /// Reading from this pointer when `result_ok` is not set is undefined.
3426         pub result: *mut crate::lightning::routing::router::RouteHintHop,
3427         /// A pointer to the contents in the error state.
3428         /// Reading from this pointer when `result_ok` is set is undefined.
3429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3430 }
3431 #[repr(C)]
3432 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3433 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3435 pub struct CResult_RouteHintHopDecodeErrorZ {
3436         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3437         /// `err` or `result` depending on the state of `result_ok`.
3438         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
3439         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3440         pub result_ok: bool,
3441 }
3442 #[no_mangle]
3443 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3444 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3445         CResult_RouteHintHopDecodeErrorZ {
3446                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3447                         result: Box::into_raw(Box::new(o)),
3448                 },
3449                 result_ok: true,
3450         }
3451 }
3452 #[no_mangle]
3453 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3454 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3455         CResult_RouteHintHopDecodeErrorZ {
3456                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3457                         err: Box::into_raw(Box::new(e)),
3458                 },
3459                 result_ok: false,
3460         }
3461 }
3462 /// Checks if the given object is currently in the success state
3463 #[no_mangle]
3464 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3465         o.result_ok
3466 }
3467 #[no_mangle]
3468 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3469 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3470 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3471         fn drop(&mut self) {
3472                 if self.result_ok {
3473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3475                         }
3476                 } else {
3477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3479                         }
3480                 }
3481         }
3482 }
3483 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485                 let contents = if o.result_ok {
3486                         let result = unsafe { o.contents.result };
3487                         unsafe { o.contents.result = core::ptr::null_mut() };
3488                         CResult_RouteHintHopDecodeErrorZPtr { result }
3489                 } else {
3490                         let err = unsafe { o.contents.err };
3491                         unsafe { o.contents.err = core::ptr::null_mut(); }
3492                         CResult_RouteHintHopDecodeErrorZPtr { err }
3493                 };
3494                 Self {
3495                         contents,
3496                         result_ok: o.result_ok,
3497                 }
3498         }
3499 }
3500 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3501         fn clone(&self) -> Self {
3502                 if self.result_ok {
3503                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3504                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3505                         } }
3506                 } else {
3507                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3509                         } }
3510                 }
3511         }
3512 }
3513 #[no_mangle]
3514 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3517 #[repr(C)]
3518 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_PublicKeyZ {
3521         /// The elements in the array.
3522         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523         pub data: *mut crate::c_types::PublicKey,
3524         /// The number of elements pointed to by `data`.
3525         pub datalen: usize
3526 }
3527 impl CVec_PublicKeyZ {
3528         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3529                 if self.datalen == 0 { return Vec::new(); }
3530                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531                 self.data = core::ptr::null_mut();
3532                 self.datalen = 0;
3533                 ret
3534         }
3535         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3536                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3537         }
3538 }
3539 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3540         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3541                 let datalen = v.len();
3542                 let data = Box::into_raw(v.into_boxed_slice());
3543                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3544         }
3545 }
3546 #[no_mangle]
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3549 impl Drop for CVec_PublicKeyZ {
3550         fn drop(&mut self) {
3551                 if self.datalen == 0 { return; }
3552                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3553         }
3554 }
3555 impl Clone for CVec_PublicKeyZ {
3556         fn clone(&self) -> Self {
3557                 let mut res = Vec::new();
3558                 if self.datalen == 0 { return Self::from(res); }
3559                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3560                 Self::from(res)
3561         }
3562 }
3563 #[repr(C)]
3564 /// A tuple of 2 elements. See the individual fields for the types contained.
3565 pub struct C2Tuple_usizeTransactionZ {
3566         /// The element at position 0
3567         pub a: usize,
3568         /// The element at position 1
3569         pub b: crate::c_types::Transaction,
3570 }
3571 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3572         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3573                 Self {
3574                         a: tup.0,
3575                         b: tup.1,
3576                 }
3577         }
3578 }
3579 impl C2Tuple_usizeTransactionZ {
3580         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3581                 (self.a, self.b)
3582         }
3583 }
3584 impl Clone for C2Tuple_usizeTransactionZ {
3585         fn clone(&self) -> Self {
3586                 Self {
3587                         a: Clone::clone(&self.a),
3588                         b: Clone::clone(&self.b),
3589                 }
3590         }
3591 }
3592 #[no_mangle]
3593 /// Creates a new tuple which has the same data as `orig`
3594 /// but with all dynamically-allocated buffers duplicated in new buffers.
3595 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3596 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3597 #[no_mangle]
3598 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3599         C2Tuple_usizeTransactionZ { a, b, }
3600 }
3601
3602 #[no_mangle]
3603 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3604 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3605 #[repr(C)]
3606 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3607 /// This corresponds to std::vector in C++
3608 pub struct CVec_C2Tuple_usizeTransactionZZ {
3609         /// The elements in the array.
3610         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3611         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3612         /// The number of elements pointed to by `data`.
3613         pub datalen: usize
3614 }
3615 impl CVec_C2Tuple_usizeTransactionZZ {
3616         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3617                 if self.datalen == 0 { return Vec::new(); }
3618                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3619                 self.data = core::ptr::null_mut();
3620                 self.datalen = 0;
3621                 ret
3622         }
3623         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3624                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3625         }
3626 }
3627 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3628         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3629                 let datalen = v.len();
3630                 let data = Box::into_raw(v.into_boxed_slice());
3631                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3632         }
3633 }
3634 #[no_mangle]
3635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3636 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3637 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3638         fn drop(&mut self) {
3639                 if self.datalen == 0 { return; }
3640                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3641         }
3642 }
3643 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3644         fn clone(&self) -> Self {
3645                 let mut res = Vec::new();
3646                 if self.datalen == 0 { return Self::from(res); }
3647                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3648                 Self::from(res)
3649         }
3650 }
3651 #[repr(C)]
3652 /// A tuple of 2 elements. See the individual fields for the types contained.
3653 pub struct C2Tuple_TxidBlockHashZ {
3654         /// The element at position 0
3655         pub a: crate::c_types::ThirtyTwoBytes,
3656         /// The element at position 1
3657         pub b: crate::c_types::ThirtyTwoBytes,
3658 }
3659 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
3660         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
3661                 Self {
3662                         a: tup.0,
3663                         b: tup.1,
3664                 }
3665         }
3666 }
3667 impl C2Tuple_TxidBlockHashZ {
3668         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
3669                 (self.a, self.b)
3670         }
3671 }
3672 impl Clone for C2Tuple_TxidBlockHashZ {
3673         fn clone(&self) -> Self {
3674                 Self {
3675                         a: Clone::clone(&self.a),
3676                         b: Clone::clone(&self.b),
3677                 }
3678         }
3679 }
3680 #[no_mangle]
3681 /// Creates a new tuple which has the same data as `orig`
3682 /// but with all dynamically-allocated buffers duplicated in new buffers.
3683 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
3684 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
3685 #[no_mangle]
3686 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
3687         C2Tuple_TxidBlockHashZ { a, b, }
3688 }
3689
3690 #[no_mangle]
3691 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
3692 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
3693 #[repr(C)]
3694 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3695 /// This corresponds to std::vector in C++
3696 pub struct CVec_C2Tuple_TxidBlockHashZZ {
3697         /// The elements in the array.
3698         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3699         pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
3700         /// The number of elements pointed to by `data`.
3701         pub datalen: usize
3702 }
3703 impl CVec_C2Tuple_TxidBlockHashZZ {
3704         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
3705                 if self.datalen == 0 { return Vec::new(); }
3706                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3707                 self.data = core::ptr::null_mut();
3708                 self.datalen = 0;
3709                 ret
3710         }
3711         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
3712                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3713         }
3714 }
3715 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
3716         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
3717                 let datalen = v.len();
3718                 let data = Box::into_raw(v.into_boxed_slice());
3719                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3720         }
3721 }
3722 #[no_mangle]
3723 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3724 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
3725 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
3726         fn drop(&mut self) {
3727                 if self.datalen == 0 { return; }
3728                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3729         }
3730 }
3731 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
3732         fn clone(&self) -> Self {
3733                 let mut res = Vec::new();
3734                 if self.datalen == 0 { return Self::from(res); }
3735                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3736                 Self::from(res)
3737         }
3738 }
3739 #[repr(C)]
3740 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3741 /// This corresponds to std::vector in C++
3742 pub struct CVec_MonitorEventZ {
3743         /// The elements in the array.
3744         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3745         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3746         /// The number of elements pointed to by `data`.
3747         pub datalen: usize
3748 }
3749 impl CVec_MonitorEventZ {
3750         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3751                 if self.datalen == 0 { return Vec::new(); }
3752                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3753                 self.data = core::ptr::null_mut();
3754                 self.datalen = 0;
3755                 ret
3756         }
3757         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3758                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3759         }
3760 }
3761 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3762         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3763                 let datalen = v.len();
3764                 let data = Box::into_raw(v.into_boxed_slice());
3765                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3766         }
3767 }
3768 #[no_mangle]
3769 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3770 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3771 impl Drop for CVec_MonitorEventZ {
3772         fn drop(&mut self) {
3773                 if self.datalen == 0 { return; }
3774                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3775         }
3776 }
3777 impl Clone for CVec_MonitorEventZ {
3778         fn clone(&self) -> Self {
3779                 let mut res = Vec::new();
3780                 if self.datalen == 0 { return Self::from(res); }
3781                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3782                 Self::from(res)
3783         }
3784 }
3785 #[repr(C)]
3786 /// A tuple of 3 elements. See the individual fields for the types contained.
3787 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3788         /// The element at position 0
3789         pub a: crate::lightning::chain::transaction::OutPoint,
3790         /// The element at position 1
3791         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3792         /// The element at position 2
3793         pub c: crate::c_types::PublicKey,
3794 }
3795 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3796         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
3797                 Self {
3798                         a: tup.0,
3799                         b: tup.1,
3800                         c: tup.2,
3801                 }
3802         }
3803 }
3804 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3805         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
3806                 (self.a, self.b, self.c)
3807         }
3808 }
3809 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3810         fn clone(&self) -> Self {
3811                 Self {
3812                         a: Clone::clone(&self.a),
3813                         b: Clone::clone(&self.b),
3814                         c: Clone::clone(&self.c),
3815                 }
3816         }
3817 }
3818 #[no_mangle]
3819 /// Creates a new tuple which has the same data as `orig`
3820 /// but with all dynamically-allocated buffers duplicated in new buffers.
3821 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
3822 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
3823 #[no_mangle]
3824 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3825         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
3826 }
3827
3828 #[no_mangle]
3829 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
3830 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
3831 #[repr(C)]
3832 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3833 /// This corresponds to std::vector in C++
3834 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3835         /// The elements in the array.
3836         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3837         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
3838         /// The number of elements pointed to by `data`.
3839         pub datalen: usize
3840 }
3841 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3842         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
3843                 if self.datalen == 0 { return Vec::new(); }
3844                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3845                 self.data = core::ptr::null_mut();
3846                 self.datalen = 0;
3847                 ret
3848         }
3849         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
3850                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3851         }
3852 }
3853 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3854         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
3855                 let datalen = v.len();
3856                 let data = Box::into_raw(v.into_boxed_slice());
3857                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3858         }
3859 }
3860 #[no_mangle]
3861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3862 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
3863 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3864         fn drop(&mut self) {
3865                 if self.datalen == 0 { return; }
3866                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3867         }
3868 }
3869 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3870         fn clone(&self) -> Self {
3871                 let mut res = Vec::new();
3872                 if self.datalen == 0 { return Self::from(res); }
3873                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3874                 Self::from(res)
3875         }
3876 }
3877 #[repr(C)]
3878 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3879 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3880         /// A pointer to the contents in the success state.
3881         /// Reading from this pointer when `result_ok` is not set is undefined.
3882         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3883         /// A pointer to the contents in the error state.
3884         /// Reading from this pointer when `result_ok` is set is undefined.
3885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3886 }
3887 #[repr(C)]
3888 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3889 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3891 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3892         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3893         /// `err` or `result` depending on the state of `result_ok`.
3894         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3895         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3896         pub result_ok: bool,
3897 }
3898 #[no_mangle]
3899 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3901         CResult_FixedPenaltyScorerDecodeErrorZ {
3902                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3903                         result: Box::into_raw(Box::new(o)),
3904                 },
3905                 result_ok: true,
3906         }
3907 }
3908 #[no_mangle]
3909 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3910 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3911         CResult_FixedPenaltyScorerDecodeErrorZ {
3912                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3913                         err: Box::into_raw(Box::new(e)),
3914                 },
3915                 result_ok: false,
3916         }
3917 }
3918 /// Checks if the given object is currently in the success state
3919 #[no_mangle]
3920 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3921         o.result_ok
3922 }
3923 #[no_mangle]
3924 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3925 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3926 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3927         fn drop(&mut self) {
3928                 if self.result_ok {
3929                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3930                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3931                         }
3932                 } else {
3933                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3934                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3935                         }
3936                 }
3937         }
3938 }
3939 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3940         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3941                 let contents = if o.result_ok {
3942                         let result = unsafe { o.contents.result };
3943                         unsafe { o.contents.result = core::ptr::null_mut() };
3944                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3945                 } else {
3946                         let err = unsafe { o.contents.err };
3947                         unsafe { o.contents.err = core::ptr::null_mut(); }
3948                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3949                 };
3950                 Self {
3951                         contents,
3952                         result_ok: o.result_ok,
3953                 }
3954         }
3955 }
3956 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3957         fn clone(&self) -> Self {
3958                 if self.result_ok {
3959                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3960                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3961                         } }
3962                 } else {
3963                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3964                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3965                         } }
3966                 }
3967         }
3968 }
3969 #[no_mangle]
3970 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3971 /// but with all dynamically-allocated buffers duplicated in new buffers.
3972 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3973 #[repr(C)]
3974 /// A tuple of 2 elements. See the individual fields for the types contained.
3975 pub struct C2Tuple_u64u64Z {
3976         /// The element at position 0
3977         pub a: u64,
3978         /// The element at position 1
3979         pub b: u64,
3980 }
3981 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3982         fn from (tup: (u64, u64)) -> Self {
3983                 Self {
3984                         a: tup.0,
3985                         b: tup.1,
3986                 }
3987         }
3988 }
3989 impl C2Tuple_u64u64Z {
3990         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3991                 (self.a, self.b)
3992         }
3993 }
3994 impl Clone for C2Tuple_u64u64Z {
3995         fn clone(&self) -> Self {
3996                 Self {
3997                         a: Clone::clone(&self.a),
3998                         b: Clone::clone(&self.b),
3999                 }
4000         }
4001 }
4002 #[no_mangle]
4003 /// Creates a new tuple which has the same data as `orig`
4004 /// but with all dynamically-allocated buffers duplicated in new buffers.
4005 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4006 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4007 #[no_mangle]
4008 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4009         C2Tuple_u64u64Z { a, b, }
4010 }
4011
4012 #[no_mangle]
4013 /// Frees any resources used by the C2Tuple_u64u64Z.
4014 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4015 #[repr(C)]
4016 #[derive(Clone)]
4017 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4018 pub enum COption_C2Tuple_u64u64ZZ {
4019         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4020         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4021         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4022         None
4023 }
4024 impl COption_C2Tuple_u64u64ZZ {
4025         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4026                 if let Self::None = self { false } else { true }
4027         }
4028         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4029                 !self.is_some()
4030         }
4031         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4032                 if let Self::Some(v) = self { v } else { unreachable!() }
4033         }
4034 }
4035 #[no_mangle]
4036 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4037 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4038         COption_C2Tuple_u64u64ZZ::Some(o)
4039 }
4040 #[no_mangle]
4041 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4042 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4043         COption_C2Tuple_u64u64ZZ::None
4044 }
4045 #[no_mangle]
4046 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4047 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4048 #[no_mangle]
4049 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4050 /// but with all dynamically-allocated buffers duplicated in new buffers.
4051 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4052 #[repr(C)]
4053 /// A tuple of 2 elements. See the individual fields for the types contained.
4054 pub struct C2Tuple_Z {
4055         /// The element at position 0
4056         pub a: crate::c_types::EightU16s,
4057         /// The element at position 1
4058         pub b: crate::c_types::EightU16s,
4059 }
4060 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4061         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4062                 Self {
4063                         a: tup.0,
4064                         b: tup.1,
4065                 }
4066         }
4067 }
4068 impl C2Tuple_Z {
4069         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4070                 (self.a, self.b)
4071         }
4072 }
4073 impl Clone for C2Tuple_Z {
4074         fn clone(&self) -> Self {
4075                 Self {
4076                         a: Clone::clone(&self.a),
4077                         b: Clone::clone(&self.b),
4078                 }
4079         }
4080 }
4081 #[no_mangle]
4082 /// Creates a new tuple which has the same data as `orig`
4083 /// but with all dynamically-allocated buffers duplicated in new buffers.
4084 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4085 /// Creates a new C2Tuple_Z from the contained elements.
4086 #[no_mangle]
4087 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4088         C2Tuple_Z { a, b, }
4089 }
4090
4091 #[no_mangle]
4092 /// Frees any resources used by the C2Tuple_Z.
4093 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4094 #[repr(C)]
4095 /// A tuple of 2 elements. See the individual fields for the types contained.
4096 pub struct C2Tuple__u168_u168Z {
4097         /// The element at position 0
4098         pub a: crate::c_types::EightU16s,
4099         /// The element at position 1
4100         pub b: crate::c_types::EightU16s,
4101 }
4102 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4103         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4104                 Self {
4105                         a: tup.0,
4106                         b: tup.1,
4107                 }
4108         }
4109 }
4110 impl C2Tuple__u168_u168Z {
4111         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4112                 (self.a, self.b)
4113         }
4114 }
4115 impl Clone for C2Tuple__u168_u168Z {
4116         fn clone(&self) -> Self {
4117                 Self {
4118                         a: Clone::clone(&self.a),
4119                         b: Clone::clone(&self.b),
4120                 }
4121         }
4122 }
4123 #[no_mangle]
4124 /// Creates a new tuple which has the same data as `orig`
4125 /// but with all dynamically-allocated buffers duplicated in new buffers.
4126 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4127 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4128 #[no_mangle]
4129 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4130         C2Tuple__u168_u168Z { a, b, }
4131 }
4132
4133 #[no_mangle]
4134 /// Frees any resources used by the C2Tuple__u168_u168Z.
4135 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4136 #[repr(C)]
4137 #[derive(Clone)]
4138 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4139 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4140         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4141         Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4142         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4143         None
4144 }
4145 impl COption_C2Tuple_EightU16sEightU16sZZ {
4146         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4147                 if let Self::None = self { false } else { true }
4148         }
4149         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4150                 !self.is_some()
4151         }
4152         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4153                 if let Self::Some(v) = self { v } else { unreachable!() }
4154         }
4155 }
4156 #[no_mangle]
4157 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4158 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4159         COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4160 }
4161 #[no_mangle]
4162 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4163 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4164         COption_C2Tuple_EightU16sEightU16sZZ::None
4165 }
4166 #[no_mangle]
4167 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4168 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4169 #[no_mangle]
4170 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4171 /// but with all dynamically-allocated buffers duplicated in new buffers.
4172 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4173 #[repr(C)]
4174 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4175 /// This corresponds to std::vector in C++
4176 pub struct CVec_NodeIdZ {
4177         /// The elements in the array.
4178         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4179         pub data: *mut crate::lightning::routing::gossip::NodeId,
4180         /// The number of elements pointed to by `data`.
4181         pub datalen: usize
4182 }
4183 impl CVec_NodeIdZ {
4184         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4185                 if self.datalen == 0 { return Vec::new(); }
4186                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4187                 self.data = core::ptr::null_mut();
4188                 self.datalen = 0;
4189                 ret
4190         }
4191         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4192                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4193         }
4194 }
4195 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4196         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4197                 let datalen = v.len();
4198                 let data = Box::into_raw(v.into_boxed_slice());
4199                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4200         }
4201 }
4202 #[no_mangle]
4203 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4204 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4205 impl Drop for CVec_NodeIdZ {
4206         fn drop(&mut self) {
4207                 if self.datalen == 0 { return; }
4208                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4209         }
4210 }
4211 impl Clone for CVec_NodeIdZ {
4212         fn clone(&self) -> Self {
4213                 let mut res = Vec::new();
4214                 if self.datalen == 0 { return Self::from(res); }
4215                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4216                 Self::from(res)
4217         }
4218 }
4219 #[repr(C)]
4220 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4221 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4222         /// A pointer to the contents in the success state.
4223         /// Reading from this pointer when `result_ok` is not set is undefined.
4224         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4225         /// A pointer to the contents in the error state.
4226         /// Reading from this pointer when `result_ok` is set is undefined.
4227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4228 }
4229 #[repr(C)]
4230 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4231 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4233 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4234         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4235         /// `err` or `result` depending on the state of `result_ok`.
4236         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4237         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4238         pub result_ok: bool,
4239 }
4240 #[no_mangle]
4241 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4242 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4243         CResult_ProbabilisticScorerDecodeErrorZ {
4244                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4245                         result: Box::into_raw(Box::new(o)),
4246                 },
4247                 result_ok: true,
4248         }
4249 }
4250 #[no_mangle]
4251 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4252 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4253         CResult_ProbabilisticScorerDecodeErrorZ {
4254                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4255                         err: Box::into_raw(Box::new(e)),
4256                 },
4257                 result_ok: false,
4258         }
4259 }
4260 /// Checks if the given object is currently in the success state
4261 #[no_mangle]
4262 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4263         o.result_ok
4264 }
4265 #[no_mangle]
4266 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4267 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4268 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4269         fn drop(&mut self) {
4270                 if self.result_ok {
4271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4273                         }
4274                 } else {
4275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4277                         }
4278                 }
4279         }
4280 }
4281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4283                 let contents = if o.result_ok {
4284                         let result = unsafe { o.contents.result };
4285                         unsafe { o.contents.result = core::ptr::null_mut() };
4286                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4287                 } else {
4288                         let err = unsafe { o.contents.err };
4289                         unsafe { o.contents.err = core::ptr::null_mut(); }
4290                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4291                 };
4292                 Self {
4293                         contents,
4294                         result_ok: o.result_ok,
4295                 }
4296         }
4297 }
4298 #[repr(C)]
4299 /// The contents of CResult_InitFeaturesDecodeErrorZ
4300 pub union CResult_InitFeaturesDecodeErrorZPtr {
4301         /// A pointer to the contents in the success state.
4302         /// Reading from this pointer when `result_ok` is not set is undefined.
4303         pub result: *mut crate::lightning::ln::features::InitFeatures,
4304         /// A pointer to the contents in the error state.
4305         /// Reading from this pointer when `result_ok` is set is undefined.
4306         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4307 }
4308 #[repr(C)]
4309 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4310 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4312 pub struct CResult_InitFeaturesDecodeErrorZ {
4313         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4314         /// `err` or `result` depending on the state of `result_ok`.
4315         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4316         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4317         pub result_ok: bool,
4318 }
4319 #[no_mangle]
4320 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4321 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4322         CResult_InitFeaturesDecodeErrorZ {
4323                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4324                         result: Box::into_raw(Box::new(o)),
4325                 },
4326                 result_ok: true,
4327         }
4328 }
4329 #[no_mangle]
4330 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4331 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4332         CResult_InitFeaturesDecodeErrorZ {
4333                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4334                         err: Box::into_raw(Box::new(e)),
4335                 },
4336                 result_ok: false,
4337         }
4338 }
4339 /// Checks if the given object is currently in the success state
4340 #[no_mangle]
4341 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4342         o.result_ok
4343 }
4344 #[no_mangle]
4345 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4346 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4347 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4348         fn drop(&mut self) {
4349                 if self.result_ok {
4350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4352                         }
4353                 } else {
4354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4356                         }
4357                 }
4358         }
4359 }
4360 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4361         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4362                 let contents = if o.result_ok {
4363                         let result = unsafe { o.contents.result };
4364                         unsafe { o.contents.result = core::ptr::null_mut() };
4365                         CResult_InitFeaturesDecodeErrorZPtr { result }
4366                 } else {
4367                         let err = unsafe { o.contents.err };
4368                         unsafe { o.contents.err = core::ptr::null_mut(); }
4369                         CResult_InitFeaturesDecodeErrorZPtr { err }
4370                 };
4371                 Self {
4372                         contents,
4373                         result_ok: o.result_ok,
4374                 }
4375         }
4376 }
4377 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4378         fn clone(&self) -> Self {
4379                 if self.result_ok {
4380                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4381                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4382                         } }
4383                 } else {
4384                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4385                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4386                         } }
4387                 }
4388         }
4389 }
4390 #[no_mangle]
4391 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4392 /// but with all dynamically-allocated buffers duplicated in new buffers.
4393 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4394 #[repr(C)]
4395 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4396 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4397         /// A pointer to the contents in the success state.
4398         /// Reading from this pointer when `result_ok` is not set is undefined.
4399         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4400         /// A pointer to the contents in the error state.
4401         /// Reading from this pointer when `result_ok` is set is undefined.
4402         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4403 }
4404 #[repr(C)]
4405 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4406 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4408 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4409         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4410         /// `err` or `result` depending on the state of `result_ok`.
4411         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4412         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4413         pub result_ok: bool,
4414 }
4415 #[no_mangle]
4416 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4417 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4418         CResult_ChannelFeaturesDecodeErrorZ {
4419                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4420                         result: Box::into_raw(Box::new(o)),
4421                 },
4422                 result_ok: true,
4423         }
4424 }
4425 #[no_mangle]
4426 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4427 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4428         CResult_ChannelFeaturesDecodeErrorZ {
4429                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4430                         err: Box::into_raw(Box::new(e)),
4431                 },
4432                 result_ok: false,
4433         }
4434 }
4435 /// Checks if the given object is currently in the success state
4436 #[no_mangle]
4437 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4438         o.result_ok
4439 }
4440 #[no_mangle]
4441 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4442 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4443 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4444         fn drop(&mut self) {
4445                 if self.result_ok {
4446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4448                         }
4449                 } else {
4450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4452                         }
4453                 }
4454         }
4455 }
4456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4458                 let contents = if o.result_ok {
4459                         let result = unsafe { o.contents.result };
4460                         unsafe { o.contents.result = core::ptr::null_mut() };
4461                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4462                 } else {
4463                         let err = unsafe { o.contents.err };
4464                         unsafe { o.contents.err = core::ptr::null_mut(); }
4465                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4466                 };
4467                 Self {
4468                         contents,
4469                         result_ok: o.result_ok,
4470                 }
4471         }
4472 }
4473 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4474         fn clone(&self) -> Self {
4475                 if self.result_ok {
4476                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4477                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4478                         } }
4479                 } else {
4480                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4481                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4482                         } }
4483                 }
4484         }
4485 }
4486 #[no_mangle]
4487 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4488 /// but with all dynamically-allocated buffers duplicated in new buffers.
4489 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4490 #[repr(C)]
4491 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4492 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4493         /// A pointer to the contents in the success state.
4494         /// Reading from this pointer when `result_ok` is not set is undefined.
4495         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4496         /// A pointer to the contents in the error state.
4497         /// Reading from this pointer when `result_ok` is set is undefined.
4498         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4499 }
4500 #[repr(C)]
4501 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4502 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4504 pub struct CResult_NodeFeaturesDecodeErrorZ {
4505         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4506         /// `err` or `result` depending on the state of `result_ok`.
4507         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4508         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4509         pub result_ok: bool,
4510 }
4511 #[no_mangle]
4512 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4513 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4514         CResult_NodeFeaturesDecodeErrorZ {
4515                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4516                         result: Box::into_raw(Box::new(o)),
4517                 },
4518                 result_ok: true,
4519         }
4520 }
4521 #[no_mangle]
4522 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4523 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4524         CResult_NodeFeaturesDecodeErrorZ {
4525                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4526                         err: Box::into_raw(Box::new(e)),
4527                 },
4528                 result_ok: false,
4529         }
4530 }
4531 /// Checks if the given object is currently in the success state
4532 #[no_mangle]
4533 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4534         o.result_ok
4535 }
4536 #[no_mangle]
4537 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4538 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4539 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4540         fn drop(&mut self) {
4541                 if self.result_ok {
4542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4544                         }
4545                 } else {
4546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4548                         }
4549                 }
4550         }
4551 }
4552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4554                 let contents = if o.result_ok {
4555                         let result = unsafe { o.contents.result };
4556                         unsafe { o.contents.result = core::ptr::null_mut() };
4557                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4558                 } else {
4559                         let err = unsafe { o.contents.err };
4560                         unsafe { o.contents.err = core::ptr::null_mut(); }
4561                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4562                 };
4563                 Self {
4564                         contents,
4565                         result_ok: o.result_ok,
4566                 }
4567         }
4568 }
4569 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4570         fn clone(&self) -> Self {
4571                 if self.result_ok {
4572                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4573                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4574                         } }
4575                 } else {
4576                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4577                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4578                         } }
4579                 }
4580         }
4581 }
4582 #[no_mangle]
4583 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4584 /// but with all dynamically-allocated buffers duplicated in new buffers.
4585 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4586 #[repr(C)]
4587 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4588 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4589         /// A pointer to the contents in the success state.
4590         /// Reading from this pointer when `result_ok` is not set is undefined.
4591         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4592         /// A pointer to the contents in the error state.
4593         /// Reading from this pointer when `result_ok` is set is undefined.
4594         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4595 }
4596 #[repr(C)]
4597 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4598 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4600 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4601         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4602         /// `err` or `result` depending on the state of `result_ok`.
4603         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4604         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4605         pub result_ok: bool,
4606 }
4607 #[no_mangle]
4608 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4609 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4610         CResult_InvoiceFeaturesDecodeErrorZ {
4611                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4612                         result: Box::into_raw(Box::new(o)),
4613                 },
4614                 result_ok: true,
4615         }
4616 }
4617 #[no_mangle]
4618 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4619 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4620         CResult_InvoiceFeaturesDecodeErrorZ {
4621                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4622                         err: Box::into_raw(Box::new(e)),
4623                 },
4624                 result_ok: false,
4625         }
4626 }
4627 /// Checks if the given object is currently in the success state
4628 #[no_mangle]
4629 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4630         o.result_ok
4631 }
4632 #[no_mangle]
4633 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4634 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4635 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4636         fn drop(&mut self) {
4637                 if self.result_ok {
4638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4640                         }
4641                 } else {
4642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4644                         }
4645                 }
4646         }
4647 }
4648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4650                 let contents = if o.result_ok {
4651                         let result = unsafe { o.contents.result };
4652                         unsafe { o.contents.result = core::ptr::null_mut() };
4653                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4654                 } else {
4655                         let err = unsafe { o.contents.err };
4656                         unsafe { o.contents.err = core::ptr::null_mut(); }
4657                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4658                 };
4659                 Self {
4660                         contents,
4661                         result_ok: o.result_ok,
4662                 }
4663         }
4664 }
4665 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4666         fn clone(&self) -> Self {
4667                 if self.result_ok {
4668                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4670                         } }
4671                 } else {
4672                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4674                         } }
4675                 }
4676         }
4677 }
4678 #[no_mangle]
4679 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4680 /// but with all dynamically-allocated buffers duplicated in new buffers.
4681 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4682 #[repr(C)]
4683 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
4684 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
4685         /// A pointer to the contents in the success state.
4686         /// Reading from this pointer when `result_ok` is not set is undefined.
4687         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
4688         /// A pointer to the contents in the error state.
4689         /// Reading from this pointer when `result_ok` is set is undefined.
4690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4691 }
4692 #[repr(C)]
4693 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
4694 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4696 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
4697         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
4698         /// `err` or `result` depending on the state of `result_ok`.
4699         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
4700         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
4701         pub result_ok: bool,
4702 }
4703 #[no_mangle]
4704 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
4705 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4706         CResult_BlindedHopFeaturesDecodeErrorZ {
4707                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4708                         result: Box::into_raw(Box::new(o)),
4709                 },
4710                 result_ok: true,
4711         }
4712 }
4713 #[no_mangle]
4714 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
4715 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4716         CResult_BlindedHopFeaturesDecodeErrorZ {
4717                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4718                         err: Box::into_raw(Box::new(e)),
4719                 },
4720                 result_ok: false,
4721         }
4722 }
4723 /// Checks if the given object is currently in the success state
4724 #[no_mangle]
4725 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
4726         o.result_ok
4727 }
4728 #[no_mangle]
4729 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
4730 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
4731 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
4732         fn drop(&mut self) {
4733                 if self.result_ok {
4734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4736                         }
4737                 } else {
4738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4740                         }
4741                 }
4742         }
4743 }
4744 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
4745         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4746                 let contents = if o.result_ok {
4747                         let result = unsafe { o.contents.result };
4748                         unsafe { o.contents.result = core::ptr::null_mut() };
4749                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
4750                 } else {
4751                         let err = unsafe { o.contents.err };
4752                         unsafe { o.contents.err = core::ptr::null_mut(); }
4753                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
4754                 };
4755                 Self {
4756                         contents,
4757                         result_ok: o.result_ok,
4758                 }
4759         }
4760 }
4761 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
4762         fn clone(&self) -> Self {
4763                 if self.result_ok {
4764                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4765                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
4766                         } }
4767                 } else {
4768                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4769                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4770                         } }
4771                 }
4772         }
4773 }
4774 #[no_mangle]
4775 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
4776 /// but with all dynamically-allocated buffers duplicated in new buffers.
4777 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
4778 #[repr(C)]
4779 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4780 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4781         /// A pointer to the contents in the success state.
4782         /// Reading from this pointer when `result_ok` is not set is undefined.
4783         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4784         /// A pointer to the contents in the error state.
4785         /// Reading from this pointer when `result_ok` is set is undefined.
4786         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4787 }
4788 #[repr(C)]
4789 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4790 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4792 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4793         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4794         /// `err` or `result` depending on the state of `result_ok`.
4795         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4796         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4797         pub result_ok: bool,
4798 }
4799 #[no_mangle]
4800 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4801 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4802         CResult_ChannelTypeFeaturesDecodeErrorZ {
4803                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4804                         result: Box::into_raw(Box::new(o)),
4805                 },
4806                 result_ok: true,
4807         }
4808 }
4809 #[no_mangle]
4810 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4811 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4812         CResult_ChannelTypeFeaturesDecodeErrorZ {
4813                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4814                         err: Box::into_raw(Box::new(e)),
4815                 },
4816                 result_ok: false,
4817         }
4818 }
4819 /// Checks if the given object is currently in the success state
4820 #[no_mangle]
4821 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4822         o.result_ok
4823 }
4824 #[no_mangle]
4825 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4826 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4827 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4828         fn drop(&mut self) {
4829                 if self.result_ok {
4830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4832                         }
4833                 } else {
4834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4836                         }
4837                 }
4838         }
4839 }
4840 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4841         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4842                 let contents = if o.result_ok {
4843                         let result = unsafe { o.contents.result };
4844                         unsafe { o.contents.result = core::ptr::null_mut() };
4845                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4846                 } else {
4847                         let err = unsafe { o.contents.err };
4848                         unsafe { o.contents.err = core::ptr::null_mut(); }
4849                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4850                 };
4851                 Self {
4852                         contents,
4853                         result_ok: o.result_ok,
4854                 }
4855         }
4856 }
4857 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4858         fn clone(&self) -> Self {
4859                 if self.result_ok {
4860                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4861                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4862                         } }
4863                 } else {
4864                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4865                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4866                         } }
4867                 }
4868         }
4869 }
4870 #[no_mangle]
4871 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4872 /// but with all dynamically-allocated buffers duplicated in new buffers.
4873 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4874 #[repr(C)]
4875 /// The contents of CResult_PaymentPurposeDecodeErrorZ
4876 pub union CResult_PaymentPurposeDecodeErrorZPtr {
4877         /// A pointer to the contents in the success state.
4878         /// Reading from this pointer when `result_ok` is not set is undefined.
4879         pub result: *mut crate::lightning::events::PaymentPurpose,
4880         /// A pointer to the contents in the error state.
4881         /// Reading from this pointer when `result_ok` is set is undefined.
4882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4883 }
4884 #[repr(C)]
4885 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
4886 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
4887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4888 pub struct CResult_PaymentPurposeDecodeErrorZ {
4889         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
4890         /// `err` or `result` depending on the state of `result_ok`.
4891         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
4892         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
4893         pub result_ok: bool,
4894 }
4895 #[no_mangle]
4896 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
4897 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
4898         CResult_PaymentPurposeDecodeErrorZ {
4899                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4900                         result: Box::into_raw(Box::new(o)),
4901                 },
4902                 result_ok: true,
4903         }
4904 }
4905 #[no_mangle]
4906 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
4907 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
4908         CResult_PaymentPurposeDecodeErrorZ {
4909                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4910                         err: Box::into_raw(Box::new(e)),
4911                 },
4912                 result_ok: false,
4913         }
4914 }
4915 /// Checks if the given object is currently in the success state
4916 #[no_mangle]
4917 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
4918         o.result_ok
4919 }
4920 #[no_mangle]
4921 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
4922 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
4923 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
4924         fn drop(&mut self) {
4925                 if self.result_ok {
4926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4928                         }
4929                 } else {
4930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4932                         }
4933                 }
4934         }
4935 }
4936 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
4937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
4938                 let contents = if o.result_ok {
4939                         let result = unsafe { o.contents.result };
4940                         unsafe { o.contents.result = core::ptr::null_mut() };
4941                         CResult_PaymentPurposeDecodeErrorZPtr { result }
4942                 } else {
4943                         let err = unsafe { o.contents.err };
4944                         unsafe { o.contents.err = core::ptr::null_mut(); }
4945                         CResult_PaymentPurposeDecodeErrorZPtr { err }
4946                 };
4947                 Self {
4948                         contents,
4949                         result_ok: o.result_ok,
4950                 }
4951         }
4952 }
4953 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
4954         fn clone(&self) -> Self {
4955                 if self.result_ok {
4956                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4957                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
4958                         } }
4959                 } else {
4960                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4961                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4962                         } }
4963                 }
4964         }
4965 }
4966 #[no_mangle]
4967 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
4968 /// but with all dynamically-allocated buffers duplicated in new buffers.
4969 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
4970 #[repr(C)]
4971 #[derive(Clone)]
4972 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
4973 pub enum COption_NetworkUpdateZ {
4974         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
4975         Some(crate::lightning::routing::gossip::NetworkUpdate),
4976         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
4977         None
4978 }
4979 impl COption_NetworkUpdateZ {
4980         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4981                 if let Self::None = self { false } else { true }
4982         }
4983         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4984                 !self.is_some()
4985         }
4986         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
4987                 if let Self::Some(v) = self { v } else { unreachable!() }
4988         }
4989 }
4990 #[no_mangle]
4991 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
4992 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
4993         COption_NetworkUpdateZ::Some(o)
4994 }
4995 #[no_mangle]
4996 /// Constructs a new COption_NetworkUpdateZ containing nothing
4997 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
4998         COption_NetworkUpdateZ::None
4999 }
5000 #[no_mangle]
5001 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
5002 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
5003 #[no_mangle]
5004 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
5005 /// but with all dynamically-allocated buffers duplicated in new buffers.
5006 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
5007 #[repr(C)]
5008 #[derive(Clone)]
5009 /// An enum which can either contain a crate::lightning::events::PathFailure or not
5010 pub enum COption_PathFailureZ {
5011         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
5012         Some(crate::lightning::events::PathFailure),
5013         /// When we're in this state, this COption_PathFailureZ contains nothing
5014         None
5015 }
5016 impl COption_PathFailureZ {
5017         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5018                 if let Self::None = self { false } else { true }
5019         }
5020         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5021                 !self.is_some()
5022         }
5023         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
5024                 if let Self::Some(v) = self { v } else { unreachable!() }
5025         }
5026 }
5027 #[no_mangle]
5028 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
5029 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
5030         COption_PathFailureZ::Some(o)
5031 }
5032 #[no_mangle]
5033 /// Constructs a new COption_PathFailureZ containing nothing
5034 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
5035         COption_PathFailureZ::None
5036 }
5037 #[no_mangle]
5038 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
5039 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
5040 #[no_mangle]
5041 /// Creates a new COption_PathFailureZ which has the same data as `orig`
5042 /// but with all dynamically-allocated buffers duplicated in new buffers.
5043 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
5044 #[repr(C)]
5045 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
5046 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
5047         /// A pointer to the contents in the success state.
5048         /// Reading from this pointer when `result_ok` is not set is undefined.
5049         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
5050         /// A pointer to the contents in the error state.
5051         /// Reading from this pointer when `result_ok` is set is undefined.
5052         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5053 }
5054 #[repr(C)]
5055 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
5056 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5058 pub struct CResult_COption_PathFailureZDecodeErrorZ {
5059         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
5060         /// `err` or `result` depending on the state of `result_ok`.
5061         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
5062         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
5063         pub result_ok: bool,
5064 }
5065 #[no_mangle]
5066 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
5067 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
5068         CResult_COption_PathFailureZDecodeErrorZ {
5069                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5070                         result: Box::into_raw(Box::new(o)),
5071                 },
5072                 result_ok: true,
5073         }
5074 }
5075 #[no_mangle]
5076 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
5077 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
5078         CResult_COption_PathFailureZDecodeErrorZ {
5079                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5080                         err: Box::into_raw(Box::new(e)),
5081                 },
5082                 result_ok: false,
5083         }
5084 }
5085 /// Checks if the given object is currently in the success state
5086 #[no_mangle]
5087 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
5088         o.result_ok
5089 }
5090 #[no_mangle]
5091 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
5092 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
5093 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
5094         fn drop(&mut self) {
5095                 if self.result_ok {
5096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5098                         }
5099                 } else {
5100                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5101                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5102                         }
5103                 }
5104         }
5105 }
5106 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
5107         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5108                 let contents = if o.result_ok {
5109                         let result = unsafe { o.contents.result };
5110                         unsafe { o.contents.result = core::ptr::null_mut() };
5111                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
5112                 } else {
5113                         let err = unsafe { o.contents.err };
5114                         unsafe { o.contents.err = core::ptr::null_mut(); }
5115                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
5116                 };
5117                 Self {
5118                         contents,
5119                         result_ok: o.result_ok,
5120                 }
5121         }
5122 }
5123 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
5124         fn clone(&self) -> Self {
5125                 if self.result_ok {
5126                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5127                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
5128                         } }
5129                 } else {
5130                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5131                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5132                         } }
5133                 }
5134         }
5135 }
5136 #[no_mangle]
5137 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
5138 /// but with all dynamically-allocated buffers duplicated in new buffers.
5139 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
5140 #[repr(C)]
5141 #[derive(Clone)]
5142 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
5143 pub enum COption_ClosureReasonZ {
5144         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
5145         Some(crate::lightning::events::ClosureReason),
5146         /// When we're in this state, this COption_ClosureReasonZ contains nothing
5147         None
5148 }
5149 impl COption_ClosureReasonZ {
5150         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5151                 if let Self::None = self { false } else { true }
5152         }
5153         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5154                 !self.is_some()
5155         }
5156         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
5157                 if let Self::Some(v) = self { v } else { unreachable!() }
5158         }
5159 }
5160 #[no_mangle]
5161 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
5162 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
5163         COption_ClosureReasonZ::Some(o)
5164 }
5165 #[no_mangle]
5166 /// Constructs a new COption_ClosureReasonZ containing nothing
5167 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
5168         COption_ClosureReasonZ::None
5169 }
5170 #[no_mangle]
5171 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
5172 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
5173 #[no_mangle]
5174 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
5175 /// but with all dynamically-allocated buffers duplicated in new buffers.
5176 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
5177 #[repr(C)]
5178 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
5179 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
5180         /// A pointer to the contents in the success state.
5181         /// Reading from this pointer when `result_ok` is not set is undefined.
5182         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
5183         /// A pointer to the contents in the error state.
5184         /// Reading from this pointer when `result_ok` is set is undefined.
5185         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5186 }
5187 #[repr(C)]
5188 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
5189 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5191 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
5192         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
5193         /// `err` or `result` depending on the state of `result_ok`.
5194         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
5195         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
5196         pub result_ok: bool,
5197 }
5198 #[no_mangle]
5199 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
5200 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5201         CResult_COption_ClosureReasonZDecodeErrorZ {
5202                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5203                         result: Box::into_raw(Box::new(o)),
5204                 },
5205                 result_ok: true,
5206         }
5207 }
5208 #[no_mangle]
5209 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
5210 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5211         CResult_COption_ClosureReasonZDecodeErrorZ {
5212                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5213                         err: Box::into_raw(Box::new(e)),
5214                 },
5215                 result_ok: false,
5216         }
5217 }
5218 /// Checks if the given object is currently in the success state
5219 #[no_mangle]
5220 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
5221         o.result_ok
5222 }
5223 #[no_mangle]
5224 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
5225 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
5226 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
5227         fn drop(&mut self) {
5228                 if self.result_ok {
5229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5231                         }
5232                 } else {
5233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5235                         }
5236                 }
5237         }
5238 }
5239 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
5240         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5241                 let contents = if o.result_ok {
5242                         let result = unsafe { o.contents.result };
5243                         unsafe { o.contents.result = core::ptr::null_mut() };
5244                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
5245                 } else {
5246                         let err = unsafe { o.contents.err };
5247                         unsafe { o.contents.err = core::ptr::null_mut(); }
5248                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
5249                 };
5250                 Self {
5251                         contents,
5252                         result_ok: o.result_ok,
5253                 }
5254         }
5255 }
5256 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
5257         fn clone(&self) -> Self {
5258                 if self.result_ok {
5259                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5260                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
5261                         } }
5262                 } else {
5263                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5265                         } }
5266                 }
5267         }
5268 }
5269 #[no_mangle]
5270 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
5271 /// but with all dynamically-allocated buffers duplicated in new buffers.
5272 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
5273 #[repr(C)]
5274 #[derive(Clone)]
5275 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
5276 pub enum COption_HTLCDestinationZ {
5277         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
5278         Some(crate::lightning::events::HTLCDestination),
5279         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
5280         None
5281 }
5282 impl COption_HTLCDestinationZ {
5283         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5284                 if let Self::None = self { false } else { true }
5285         }
5286         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5287                 !self.is_some()
5288         }
5289         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
5290                 if let Self::Some(v) = self { v } else { unreachable!() }
5291         }
5292 }
5293 #[no_mangle]
5294 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
5295 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
5296         COption_HTLCDestinationZ::Some(o)
5297 }
5298 #[no_mangle]
5299 /// Constructs a new COption_HTLCDestinationZ containing nothing
5300 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
5301         COption_HTLCDestinationZ::None
5302 }
5303 #[no_mangle]
5304 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
5305 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
5306 #[no_mangle]
5307 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
5308 /// but with all dynamically-allocated buffers duplicated in new buffers.
5309 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
5310 #[repr(C)]
5311 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
5312 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5313         /// A pointer to the contents in the success state.
5314         /// Reading from this pointer when `result_ok` is not set is undefined.
5315         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
5316         /// A pointer to the contents in the error state.
5317         /// Reading from this pointer when `result_ok` is set is undefined.
5318         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5319 }
5320 #[repr(C)]
5321 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
5322 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5324 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
5325         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
5326         /// `err` or `result` depending on the state of `result_ok`.
5327         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
5328         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
5329         pub result_ok: bool,
5330 }
5331 #[no_mangle]
5332 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
5333 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5334         CResult_COption_HTLCDestinationZDecodeErrorZ {
5335                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5336                         result: Box::into_raw(Box::new(o)),
5337                 },
5338                 result_ok: true,
5339         }
5340 }
5341 #[no_mangle]
5342 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
5343 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5344         CResult_COption_HTLCDestinationZDecodeErrorZ {
5345                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5346                         err: Box::into_raw(Box::new(e)),
5347                 },
5348                 result_ok: false,
5349         }
5350 }
5351 /// Checks if the given object is currently in the success state
5352 #[no_mangle]
5353 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
5354         o.result_ok
5355 }
5356 #[no_mangle]
5357 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
5358 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
5359 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
5360         fn drop(&mut self) {
5361                 if self.result_ok {
5362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5364                         }
5365                 } else {
5366                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5367                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5368                         }
5369                 }
5370         }
5371 }
5372 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
5373         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5374                 let contents = if o.result_ok {
5375                         let result = unsafe { o.contents.result };
5376                         unsafe { o.contents.result = core::ptr::null_mut() };
5377                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
5378                 } else {
5379                         let err = unsafe { o.contents.err };
5380                         unsafe { o.contents.err = core::ptr::null_mut(); }
5381                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
5382                 };
5383                 Self {
5384                         contents,
5385                         result_ok: o.result_ok,
5386                 }
5387         }
5388 }
5389 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
5390         fn clone(&self) -> Self {
5391                 if self.result_ok {
5392                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5393                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
5394                         } }
5395                 } else {
5396                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5397                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5398                         } }
5399                 }
5400         }
5401 }
5402 #[no_mangle]
5403 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
5404 /// but with all dynamically-allocated buffers duplicated in new buffers.
5405 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
5406 #[repr(C)]
5407 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
5408 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
5409         /// A pointer to the contents in the success state.
5410         /// Reading from this pointer when `result_ok` is not set is undefined.
5411         pub result: *mut crate::lightning::events::PaymentFailureReason,
5412         /// A pointer to the contents in the error state.
5413         /// Reading from this pointer when `result_ok` is set is undefined.
5414         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5415 }
5416 #[repr(C)]
5417 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
5418 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
5419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5420 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
5421         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
5422         /// `err` or `result` depending on the state of `result_ok`.
5423         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
5424         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
5425         pub result_ok: bool,
5426 }
5427 #[no_mangle]
5428 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
5429 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
5430         CResult_PaymentFailureReasonDecodeErrorZ {
5431                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5432                         result: Box::into_raw(Box::new(o)),
5433                 },
5434                 result_ok: true,
5435         }
5436 }
5437 #[no_mangle]
5438 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
5439 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
5440         CResult_PaymentFailureReasonDecodeErrorZ {
5441                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5442                         err: Box::into_raw(Box::new(e)),
5443                 },
5444                 result_ok: false,
5445         }
5446 }
5447 /// Checks if the given object is currently in the success state
5448 #[no_mangle]
5449 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
5450         o.result_ok
5451 }
5452 #[no_mangle]
5453 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
5454 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
5455 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
5456         fn drop(&mut self) {
5457                 if self.result_ok {
5458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5460                         }
5461                 } else {
5462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5464                         }
5465                 }
5466         }
5467 }
5468 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
5469         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
5470                 let contents = if o.result_ok {
5471                         let result = unsafe { o.contents.result };
5472                         unsafe { o.contents.result = core::ptr::null_mut() };
5473                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
5474                 } else {
5475                         let err = unsafe { o.contents.err };
5476                         unsafe { o.contents.err = core::ptr::null_mut(); }
5477                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
5478                 };
5479                 Self {
5480                         contents,
5481                         result_ok: o.result_ok,
5482                 }
5483         }
5484 }
5485 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
5486         fn clone(&self) -> Self {
5487                 if self.result_ok {
5488                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5489                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
5490                         } }
5491                 } else {
5492                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5493                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5494                         } }
5495                 }
5496         }
5497 }
5498 #[no_mangle]
5499 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
5500 /// but with all dynamically-allocated buffers duplicated in new buffers.
5501 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
5502 #[repr(C)]
5503 #[derive(Clone)]
5504 /// An enum which can either contain a crate::c_types::U128 or not
5505 pub enum COption_u128Z {
5506         /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
5507         Some(crate::c_types::U128),
5508         /// When we're in this state, this COption_u128Z contains nothing
5509         None
5510 }
5511 impl COption_u128Z {
5512         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5513                 if let Self::None = self { false } else { true }
5514         }
5515         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5516                 !self.is_some()
5517         }
5518         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
5519                 if let Self::Some(v) = self { v } else { unreachable!() }
5520         }
5521 }
5522 #[no_mangle]
5523 /// Constructs a new COption_u128Z containing a crate::c_types::U128
5524 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
5525         COption_u128Z::Some(o)
5526 }
5527 #[no_mangle]
5528 /// Constructs a new COption_u128Z containing nothing
5529 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
5530         COption_u128Z::None
5531 }
5532 #[no_mangle]
5533 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
5534 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
5535 #[no_mangle]
5536 /// Creates a new COption_u128Z which has the same data as `orig`
5537 /// but with all dynamically-allocated buffers duplicated in new buffers.
5538 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
5539 #[repr(C)]
5540 #[derive(Clone)]
5541 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
5542 pub enum COption_PaymentFailureReasonZ {
5543         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
5544         Some(crate::lightning::events::PaymentFailureReason),
5545         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
5546         None
5547 }
5548 impl COption_PaymentFailureReasonZ {
5549         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5550                 if let Self::None = self { false } else { true }
5551         }
5552         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5553                 !self.is_some()
5554         }
5555         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
5556                 if let Self::Some(v) = self { v } else { unreachable!() }
5557         }
5558 }
5559 #[no_mangle]
5560 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
5561 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
5562         COption_PaymentFailureReasonZ::Some(o)
5563 }
5564 #[no_mangle]
5565 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
5566 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
5567         COption_PaymentFailureReasonZ::None
5568 }
5569 #[no_mangle]
5570 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
5571 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
5572 #[no_mangle]
5573 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
5576 #[repr(C)]
5577 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
5578 /// This corresponds to std::vector in C++
5579 pub struct CVec_SpendableOutputDescriptorZ {
5580         /// The elements in the array.
5581         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5582         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5583         /// The number of elements pointed to by `data`.
5584         pub datalen: usize
5585 }
5586 impl CVec_SpendableOutputDescriptorZ {
5587         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
5588                 if self.datalen == 0 { return Vec::new(); }
5589                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5590                 self.data = core::ptr::null_mut();
5591                 self.datalen = 0;
5592                 ret
5593         }
5594         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
5595                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5596         }
5597 }
5598 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
5599         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
5600                 let datalen = v.len();
5601                 let data = Box::into_raw(v.into_boxed_slice());
5602                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5603         }
5604 }
5605 #[no_mangle]
5606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5607 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
5608 impl Drop for CVec_SpendableOutputDescriptorZ {
5609         fn drop(&mut self) {
5610                 if self.datalen == 0 { return; }
5611                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5612         }
5613 }
5614 impl Clone for CVec_SpendableOutputDescriptorZ {
5615         fn clone(&self) -> Self {
5616                 let mut res = Vec::new();
5617                 if self.datalen == 0 { return Self::from(res); }
5618                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5619                 Self::from(res)
5620         }
5621 }
5622 #[repr(C)]
5623 #[derive(Clone)]
5624 /// An enum which can either contain a crate::lightning::events::Event or not
5625 pub enum COption_EventZ {
5626         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
5627         Some(crate::lightning::events::Event),
5628         /// When we're in this state, this COption_EventZ contains nothing
5629         None
5630 }
5631 impl COption_EventZ {
5632         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5633                 if let Self::None = self { false } else { true }
5634         }
5635         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5636                 !self.is_some()
5637         }
5638         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
5639                 if let Self::Some(v) = self { v } else { unreachable!() }
5640         }
5641 }
5642 #[no_mangle]
5643 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
5644 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
5645         COption_EventZ::Some(o)
5646 }
5647 #[no_mangle]
5648 /// Constructs a new COption_EventZ containing nothing
5649 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
5650         COption_EventZ::None
5651 }
5652 #[no_mangle]
5653 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
5654 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
5655 #[no_mangle]
5656 /// Creates a new COption_EventZ which has the same data as `orig`
5657 /// but with all dynamically-allocated buffers duplicated in new buffers.
5658 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
5659 #[repr(C)]
5660 /// The contents of CResult_COption_EventZDecodeErrorZ
5661 pub union CResult_COption_EventZDecodeErrorZPtr {
5662         /// A pointer to the contents in the success state.
5663         /// Reading from this pointer when `result_ok` is not set is undefined.
5664         pub result: *mut crate::c_types::derived::COption_EventZ,
5665         /// A pointer to the contents in the error state.
5666         /// Reading from this pointer when `result_ok` is set is undefined.
5667         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5668 }
5669 #[repr(C)]
5670 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
5671 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5673 pub struct CResult_COption_EventZDecodeErrorZ {
5674         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
5675         /// `err` or `result` depending on the state of `result_ok`.
5676         pub contents: CResult_COption_EventZDecodeErrorZPtr,
5677         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
5678         pub result_ok: bool,
5679 }
5680 #[no_mangle]
5681 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
5682 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
5683         CResult_COption_EventZDecodeErrorZ {
5684                 contents: CResult_COption_EventZDecodeErrorZPtr {
5685                         result: Box::into_raw(Box::new(o)),
5686                 },
5687                 result_ok: true,
5688         }
5689 }
5690 #[no_mangle]
5691 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
5692 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
5693         CResult_COption_EventZDecodeErrorZ {
5694                 contents: CResult_COption_EventZDecodeErrorZPtr {
5695                         err: Box::into_raw(Box::new(e)),
5696                 },
5697                 result_ok: false,
5698         }
5699 }
5700 /// Checks if the given object is currently in the success state
5701 #[no_mangle]
5702 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
5703         o.result_ok
5704 }
5705 #[no_mangle]
5706 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
5707 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
5708 impl Drop for CResult_COption_EventZDecodeErrorZ {
5709         fn drop(&mut self) {
5710                 if self.result_ok {
5711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5713                         }
5714                 } else {
5715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5717                         }
5718                 }
5719         }
5720 }
5721 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
5722         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5723                 let contents = if o.result_ok {
5724                         let result = unsafe { o.contents.result };
5725                         unsafe { o.contents.result = core::ptr::null_mut() };
5726                         CResult_COption_EventZDecodeErrorZPtr { result }
5727                 } else {
5728                         let err = unsafe { o.contents.err };
5729                         unsafe { o.contents.err = core::ptr::null_mut(); }
5730                         CResult_COption_EventZDecodeErrorZPtr { err }
5731                 };
5732                 Self {
5733                         contents,
5734                         result_ok: o.result_ok,
5735                 }
5736         }
5737 }
5738 impl Clone for CResult_COption_EventZDecodeErrorZ {
5739         fn clone(&self) -> Self {
5740                 if self.result_ok {
5741                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
5742                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
5743                         } }
5744                 } else {
5745                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
5746                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5747                         } }
5748                 }
5749         }
5750 }
5751 #[no_mangle]
5752 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
5753 /// but with all dynamically-allocated buffers duplicated in new buffers.
5754 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
5755 #[repr(C)]
5756 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
5757 /// This corresponds to std::vector in C++
5758 pub struct CVec_MessageSendEventZ {
5759         /// The elements in the array.
5760         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5761         pub data: *mut crate::lightning::events::MessageSendEvent,
5762         /// The number of elements pointed to by `data`.
5763         pub datalen: usize
5764 }
5765 impl CVec_MessageSendEventZ {
5766         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
5767                 if self.datalen == 0 { return Vec::new(); }
5768                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5769                 self.data = core::ptr::null_mut();
5770                 self.datalen = 0;
5771                 ret
5772         }
5773         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
5774                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5775         }
5776 }
5777 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
5778         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
5779                 let datalen = v.len();
5780                 let data = Box::into_raw(v.into_boxed_slice());
5781                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5782         }
5783 }
5784 #[no_mangle]
5785 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5786 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
5787 impl Drop for CVec_MessageSendEventZ {
5788         fn drop(&mut self) {
5789                 if self.datalen == 0 { return; }
5790                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5791         }
5792 }
5793 impl Clone for CVec_MessageSendEventZ {
5794         fn clone(&self) -> Self {
5795                 let mut res = Vec::new();
5796                 if self.datalen == 0 { return Self::from(res); }
5797                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5798                 Self::from(res)
5799         }
5800 }
5801 #[repr(C)]
5802 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5803 /// This corresponds to std::vector in C++
5804 pub struct CVec_ChainHashZ {
5805         /// The elements in the array.
5806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5807         pub data: *mut crate::c_types::ThirtyTwoBytes,
5808         /// The number of elements pointed to by `data`.
5809         pub datalen: usize
5810 }
5811 impl CVec_ChainHashZ {
5812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
5813                 if self.datalen == 0 { return Vec::new(); }
5814                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5815                 self.data = core::ptr::null_mut();
5816                 self.datalen = 0;
5817                 ret
5818         }
5819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
5820                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5821         }
5822 }
5823 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ChainHashZ {
5824         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
5825                 let datalen = v.len();
5826                 let data = Box::into_raw(v.into_boxed_slice());
5827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5828         }
5829 }
5830 #[no_mangle]
5831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5832 pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { }
5833 impl Drop for CVec_ChainHashZ {
5834         fn drop(&mut self) {
5835                 if self.datalen == 0 { return; }
5836                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5837         }
5838 }
5839 impl Clone for CVec_ChainHashZ {
5840         fn clone(&self) -> Self {
5841                 let mut res = Vec::new();
5842                 if self.datalen == 0 { return Self::from(res); }
5843                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5844                 Self::from(res)
5845         }
5846 }
5847 #[repr(C)]
5848 /// The contents of CResult_PublicKeyErrorZ
5849 pub union CResult_PublicKeyErrorZPtr {
5850         /// A pointer to the contents in the success state.
5851         /// Reading from this pointer when `result_ok` is not set is undefined.
5852         pub result: *mut crate::c_types::PublicKey,
5853         /// A pointer to the contents in the error state.
5854         /// Reading from this pointer when `result_ok` is set is undefined.
5855         pub err: *mut crate::c_types::Secp256k1Error,
5856 }
5857 #[repr(C)]
5858 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
5859 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
5860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5861 pub struct CResult_PublicKeyErrorZ {
5862         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
5863         /// `err` or `result` depending on the state of `result_ok`.
5864         pub contents: CResult_PublicKeyErrorZPtr,
5865         /// Whether this CResult_PublicKeyErrorZ represents a success state.
5866         pub result_ok: bool,
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_PublicKeyErrorZ in the success state.
5870 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
5871         CResult_PublicKeyErrorZ {
5872                 contents: CResult_PublicKeyErrorZPtr {
5873                         result: Box::into_raw(Box::new(o)),
5874                 },
5875                 result_ok: true,
5876         }
5877 }
5878 #[no_mangle]
5879 /// Creates a new CResult_PublicKeyErrorZ in the error state.
5880 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
5881         CResult_PublicKeyErrorZ {
5882                 contents: CResult_PublicKeyErrorZPtr {
5883                         err: Box::into_raw(Box::new(e)),
5884                 },
5885                 result_ok: false,
5886         }
5887 }
5888 /// Checks if the given object is currently in the success state
5889 #[no_mangle]
5890 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
5891         o.result_ok
5892 }
5893 #[no_mangle]
5894 /// Frees any resources used by the CResult_PublicKeyErrorZ.
5895 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
5896 impl Drop for CResult_PublicKeyErrorZ {
5897         fn drop(&mut self) {
5898                 if self.result_ok {
5899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5901                         }
5902                 } else {
5903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5905                         }
5906                 }
5907         }
5908 }
5909 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
5910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
5911                 let contents = if o.result_ok {
5912                         let result = unsafe { o.contents.result };
5913                         unsafe { o.contents.result = core::ptr::null_mut() };
5914                         CResult_PublicKeyErrorZPtr { result }
5915                 } else {
5916                         let err = unsafe { o.contents.err };
5917                         unsafe { o.contents.err = core::ptr::null_mut(); }
5918                         CResult_PublicKeyErrorZPtr { err }
5919                 };
5920                 Self {
5921                         contents,
5922                         result_ok: o.result_ok,
5923                 }
5924         }
5925 }
5926 impl Clone for CResult_PublicKeyErrorZ {
5927         fn clone(&self) -> Self {
5928                 if self.result_ok {
5929                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
5930                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
5931                         } }
5932                 } else {
5933                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
5934                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5935                         } }
5936                 }
5937         }
5938 }
5939 #[no_mangle]
5940 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
5941 /// but with all dynamically-allocated buffers duplicated in new buffers.
5942 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
5943 #[repr(C)]
5944 /// The contents of CResult_NodeIdDecodeErrorZ
5945 pub union CResult_NodeIdDecodeErrorZPtr {
5946         /// A pointer to the contents in the success state.
5947         /// Reading from this pointer when `result_ok` is not set is undefined.
5948         pub result: *mut crate::lightning::routing::gossip::NodeId,
5949         /// A pointer to the contents in the error state.
5950         /// Reading from this pointer when `result_ok` is set is undefined.
5951         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5952 }
5953 #[repr(C)]
5954 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5955 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5957 pub struct CResult_NodeIdDecodeErrorZ {
5958         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5959         /// `err` or `result` depending on the state of `result_ok`.
5960         pub contents: CResult_NodeIdDecodeErrorZPtr,
5961         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5962         pub result_ok: bool,
5963 }
5964 #[no_mangle]
5965 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5966 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5967         CResult_NodeIdDecodeErrorZ {
5968                 contents: CResult_NodeIdDecodeErrorZPtr {
5969                         result: Box::into_raw(Box::new(o)),
5970                 },
5971                 result_ok: true,
5972         }
5973 }
5974 #[no_mangle]
5975 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5976 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5977         CResult_NodeIdDecodeErrorZ {
5978                 contents: CResult_NodeIdDecodeErrorZPtr {
5979                         err: Box::into_raw(Box::new(e)),
5980                 },
5981                 result_ok: false,
5982         }
5983 }
5984 /// Checks if the given object is currently in the success state
5985 #[no_mangle]
5986 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5987         o.result_ok
5988 }
5989 #[no_mangle]
5990 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5991 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5992 impl Drop for CResult_NodeIdDecodeErrorZ {
5993         fn drop(&mut self) {
5994                 if self.result_ok {
5995                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5996                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5997                         }
5998                 } else {
5999                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6000                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6001                         }
6002                 }
6003         }
6004 }
6005 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6006         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6007                 let contents = if o.result_ok {
6008                         let result = unsafe { o.contents.result };
6009                         unsafe { o.contents.result = core::ptr::null_mut() };
6010                         CResult_NodeIdDecodeErrorZPtr { result }
6011                 } else {
6012                         let err = unsafe { o.contents.err };
6013                         unsafe { o.contents.err = core::ptr::null_mut(); }
6014                         CResult_NodeIdDecodeErrorZPtr { err }
6015                 };
6016                 Self {
6017                         contents,
6018                         result_ok: o.result_ok,
6019                 }
6020         }
6021 }
6022 impl Clone for CResult_NodeIdDecodeErrorZ {
6023         fn clone(&self) -> Self {
6024                 if self.result_ok {
6025                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6026                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6027                         } }
6028                 } else {
6029                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6030                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6031                         } }
6032                 }
6033         }
6034 }
6035 #[no_mangle]
6036 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6037 /// but with all dynamically-allocated buffers duplicated in new buffers.
6038 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6039 #[repr(C)]
6040 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6041 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6042         /// A pointer to the contents in the success state.
6043         /// Reading from this pointer when `result_ok` is not set is undefined.
6044         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6045         /// A pointer to the contents in the error state.
6046         /// Reading from this pointer when `result_ok` is set is undefined.
6047         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6048 }
6049 #[repr(C)]
6050 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6051 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6053 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6054         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6055         /// `err` or `result` depending on the state of `result_ok`.
6056         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6057         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6058         pub result_ok: bool,
6059 }
6060 #[no_mangle]
6061 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6062 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6063         CResult_COption_NetworkUpdateZDecodeErrorZ {
6064                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6065                         result: Box::into_raw(Box::new(o)),
6066                 },
6067                 result_ok: true,
6068         }
6069 }
6070 #[no_mangle]
6071 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6072 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6073         CResult_COption_NetworkUpdateZDecodeErrorZ {
6074                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6075                         err: Box::into_raw(Box::new(e)),
6076                 },
6077                 result_ok: false,
6078         }
6079 }
6080 /// Checks if the given object is currently in the success state
6081 #[no_mangle]
6082 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6083         o.result_ok
6084 }
6085 #[no_mangle]
6086 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6087 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6088 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6089         fn drop(&mut self) {
6090                 if self.result_ok {
6091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6093                         }
6094                 } else {
6095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6097                         }
6098                 }
6099         }
6100 }
6101 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6102         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103                 let contents = if o.result_ok {
6104                         let result = unsafe { o.contents.result };
6105                         unsafe { o.contents.result = core::ptr::null_mut() };
6106                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6107                 } else {
6108                         let err = unsafe { o.contents.err };
6109                         unsafe { o.contents.err = core::ptr::null_mut(); }
6110                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6111                 };
6112                 Self {
6113                         contents,
6114                         result_ok: o.result_ok,
6115                 }
6116         }
6117 }
6118 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6119         fn clone(&self) -> Self {
6120                 if self.result_ok {
6121                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6122                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6123                         } }
6124                 } else {
6125                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6126                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6127                         } }
6128                 }
6129         }
6130 }
6131 #[no_mangle]
6132 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6135 #[repr(C)]
6136 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6137 pub enum COption_UtxoLookupZ {
6138         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6139         Some(crate::lightning::routing::utxo::UtxoLookup),
6140         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6141         None
6142 }
6143 impl COption_UtxoLookupZ {
6144         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6145                 if let Self::None = self { false } else { true }
6146         }
6147         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6148                 !self.is_some()
6149         }
6150         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6151                 if let Self::Some(v) = self { v } else { unreachable!() }
6152         }
6153 }
6154 #[no_mangle]
6155 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6156 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6157         COption_UtxoLookupZ::Some(o)
6158 }
6159 #[no_mangle]
6160 /// Constructs a new COption_UtxoLookupZ containing nothing
6161 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6162         COption_UtxoLookupZ::None
6163 }
6164 #[no_mangle]
6165 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6166 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6167 #[repr(C)]
6168 /// The contents of CResult_boolLightningErrorZ
6169 pub union CResult_boolLightningErrorZPtr {
6170         /// A pointer to the contents in the success state.
6171         /// Reading from this pointer when `result_ok` is not set is undefined.
6172         pub result: *mut bool,
6173         /// A pointer to the contents in the error state.
6174         /// Reading from this pointer when `result_ok` is set is undefined.
6175         pub err: *mut crate::lightning::ln::msgs::LightningError,
6176 }
6177 #[repr(C)]
6178 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6179 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6180 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6181 pub struct CResult_boolLightningErrorZ {
6182         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6183         /// `err` or `result` depending on the state of `result_ok`.
6184         pub contents: CResult_boolLightningErrorZPtr,
6185         /// Whether this CResult_boolLightningErrorZ represents a success state.
6186         pub result_ok: bool,
6187 }
6188 #[no_mangle]
6189 /// Creates a new CResult_boolLightningErrorZ in the success state.
6190 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6191         CResult_boolLightningErrorZ {
6192                 contents: CResult_boolLightningErrorZPtr {
6193                         result: Box::into_raw(Box::new(o)),
6194                 },
6195                 result_ok: true,
6196         }
6197 }
6198 #[no_mangle]
6199 /// Creates a new CResult_boolLightningErrorZ in the error state.
6200 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6201         CResult_boolLightningErrorZ {
6202                 contents: CResult_boolLightningErrorZPtr {
6203                         err: Box::into_raw(Box::new(e)),
6204                 },
6205                 result_ok: false,
6206         }
6207 }
6208 /// Checks if the given object is currently in the success state
6209 #[no_mangle]
6210 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6211         o.result_ok
6212 }
6213 #[no_mangle]
6214 /// Frees any resources used by the CResult_boolLightningErrorZ.
6215 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6216 impl Drop for CResult_boolLightningErrorZ {
6217         fn drop(&mut self) {
6218                 if self.result_ok {
6219                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6220                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6221                         }
6222                 } else {
6223                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6224                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6225                         }
6226                 }
6227         }
6228 }
6229 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6230         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6231                 let contents = if o.result_ok {
6232                         let result = unsafe { o.contents.result };
6233                         unsafe { o.contents.result = core::ptr::null_mut() };
6234                         CResult_boolLightningErrorZPtr { result }
6235                 } else {
6236                         let err = unsafe { o.contents.err };
6237                         unsafe { o.contents.err = core::ptr::null_mut(); }
6238                         CResult_boolLightningErrorZPtr { err }
6239                 };
6240                 Self {
6241                         contents,
6242                         result_ok: o.result_ok,
6243                 }
6244         }
6245 }
6246 impl Clone for CResult_boolLightningErrorZ {
6247         fn clone(&self) -> Self {
6248                 if self.result_ok {
6249                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6250                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6251                         } }
6252                 } else {
6253                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6254                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6255                         } }
6256                 }
6257         }
6258 }
6259 #[no_mangle]
6260 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6261 /// but with all dynamically-allocated buffers duplicated in new buffers.
6262 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6263 #[repr(C)]
6264 /// A tuple of 3 elements. See the individual fields for the types contained.
6265 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6266         /// The element at position 0
6267         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6268         /// The element at position 1
6269         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6270         /// The element at position 2
6271         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6272 }
6273 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6274         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6275                 Self {
6276                         a: tup.0,
6277                         b: tup.1,
6278                         c: tup.2,
6279                 }
6280         }
6281 }
6282 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6283         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6284                 (self.a, self.b, self.c)
6285         }
6286 }
6287 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6288         fn clone(&self) -> Self {
6289                 Self {
6290                         a: Clone::clone(&self.a),
6291                         b: Clone::clone(&self.b),
6292                         c: Clone::clone(&self.c),
6293                 }
6294         }
6295 }
6296 #[no_mangle]
6297 /// Creates a new tuple which has the same data as `orig`
6298 /// but with all dynamically-allocated buffers duplicated in new buffers.
6299 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6300 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6301 #[no_mangle]
6302 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6303         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6304 }
6305
6306 #[no_mangle]
6307 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6308 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6309 #[repr(C)]
6310 #[derive(Clone)]
6311 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6312 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6313         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6314         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6315         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6316         None
6317 }
6318 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6319         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6320                 if let Self::None = self { false } else { true }
6321         }
6322         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6323                 !self.is_some()
6324         }
6325         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6326                 if let Self::Some(v) = self { v } else { unreachable!() }
6327         }
6328 }
6329 #[no_mangle]
6330 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6331 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6332         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6333 }
6334 #[no_mangle]
6335 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6336 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6337         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6338 }
6339 #[no_mangle]
6340 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6341 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6342 #[no_mangle]
6343 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6344 /// but with all dynamically-allocated buffers duplicated in new buffers.
6345 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6346 #[repr(C)]
6347 /// The contents of CResult_NoneLightningErrorZ
6348 pub union CResult_NoneLightningErrorZPtr {
6349         /// Note that this value is always NULL, as there are no contents in the OK variant
6350         pub result: *mut core::ffi::c_void,
6351         /// A pointer to the contents in the error state.
6352         /// Reading from this pointer when `result_ok` is set is undefined.
6353         pub err: *mut crate::lightning::ln::msgs::LightningError,
6354 }
6355 #[repr(C)]
6356 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6357 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6359 pub struct CResult_NoneLightningErrorZ {
6360         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6361         /// `err` or `result` depending on the state of `result_ok`.
6362         pub contents: CResult_NoneLightningErrorZPtr,
6363         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6364         pub result_ok: bool,
6365 }
6366 #[no_mangle]
6367 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6368 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6369         CResult_NoneLightningErrorZ {
6370                 contents: CResult_NoneLightningErrorZPtr {
6371                         result: core::ptr::null_mut(),
6372                 },
6373                 result_ok: true,
6374         }
6375 }
6376 #[no_mangle]
6377 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6378 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6379         CResult_NoneLightningErrorZ {
6380                 contents: CResult_NoneLightningErrorZPtr {
6381                         err: Box::into_raw(Box::new(e)),
6382                 },
6383                 result_ok: false,
6384         }
6385 }
6386 /// Checks if the given object is currently in the success state
6387 #[no_mangle]
6388 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6389         o.result_ok
6390 }
6391 #[no_mangle]
6392 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6393 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6394 impl Drop for CResult_NoneLightningErrorZ {
6395         fn drop(&mut self) {
6396                 if self.result_ok {
6397                 } else {
6398                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6399                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6400                         }
6401                 }
6402         }
6403 }
6404 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6405         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6406                 let contents = if o.result_ok {
6407                         let _ = unsafe { Box::from_raw(o.contents.result) };
6408                         o.contents.result = core::ptr::null_mut();
6409                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6410                 } else {
6411                         let err = unsafe { o.contents.err };
6412                         unsafe { o.contents.err = core::ptr::null_mut(); }
6413                         CResult_NoneLightningErrorZPtr { err }
6414                 };
6415                 Self {
6416                         contents,
6417                         result_ok: o.result_ok,
6418                 }
6419         }
6420 }
6421 impl Clone for CResult_NoneLightningErrorZ {
6422         fn clone(&self) -> Self {
6423                 if self.result_ok {
6424                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6425                                 result: core::ptr::null_mut()
6426                         } }
6427                 } else {
6428                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6429                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6430                         } }
6431                 }
6432         }
6433 }
6434 #[no_mangle]
6435 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6436 /// but with all dynamically-allocated buffers duplicated in new buffers.
6437 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6438 #[repr(C)]
6439 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6440 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6441         /// A pointer to the contents in the success state.
6442         /// Reading from this pointer when `result_ok` is not set is undefined.
6443         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6444         /// A pointer to the contents in the error state.
6445         /// Reading from this pointer when `result_ok` is set is undefined.
6446         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6447 }
6448 #[repr(C)]
6449 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6450 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6453         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6454         /// `err` or `result` depending on the state of `result_ok`.
6455         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6456         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6457         pub result_ok: bool,
6458 }
6459 #[no_mangle]
6460 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6461 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6462         CResult_ChannelUpdateInfoDecodeErrorZ {
6463                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6464                         result: Box::into_raw(Box::new(o)),
6465                 },
6466                 result_ok: true,
6467         }
6468 }
6469 #[no_mangle]
6470 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6471 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6472         CResult_ChannelUpdateInfoDecodeErrorZ {
6473                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6474                         err: Box::into_raw(Box::new(e)),
6475                 },
6476                 result_ok: false,
6477         }
6478 }
6479 /// Checks if the given object is currently in the success state
6480 #[no_mangle]
6481 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6482         o.result_ok
6483 }
6484 #[no_mangle]
6485 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6486 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6487 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6488         fn drop(&mut self) {
6489                 if self.result_ok {
6490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6492                         }
6493                 } else {
6494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6496                         }
6497                 }
6498         }
6499 }
6500 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6502                 let contents = if o.result_ok {
6503                         let result = unsafe { o.contents.result };
6504                         unsafe { o.contents.result = core::ptr::null_mut() };
6505                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6506                 } else {
6507                         let err = unsafe { o.contents.err };
6508                         unsafe { o.contents.err = core::ptr::null_mut(); }
6509                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6510                 };
6511                 Self {
6512                         contents,
6513                         result_ok: o.result_ok,
6514                 }
6515         }
6516 }
6517 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6518         fn clone(&self) -> Self {
6519                 if self.result_ok {
6520                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6521                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6522                         } }
6523                 } else {
6524                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6525                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6526                         } }
6527                 }
6528         }
6529 }
6530 #[no_mangle]
6531 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6532 /// but with all dynamically-allocated buffers duplicated in new buffers.
6533 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6534 #[repr(C)]
6535 /// The contents of CResult_ChannelInfoDecodeErrorZ
6536 pub union CResult_ChannelInfoDecodeErrorZPtr {
6537         /// A pointer to the contents in the success state.
6538         /// Reading from this pointer when `result_ok` is not set is undefined.
6539         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6540         /// A pointer to the contents in the error state.
6541         /// Reading from this pointer when `result_ok` is set is undefined.
6542         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6543 }
6544 #[repr(C)]
6545 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6546 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6548 pub struct CResult_ChannelInfoDecodeErrorZ {
6549         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6550         /// `err` or `result` depending on the state of `result_ok`.
6551         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6552         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6553         pub result_ok: bool,
6554 }
6555 #[no_mangle]
6556 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6557 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6558         CResult_ChannelInfoDecodeErrorZ {
6559                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6560                         result: Box::into_raw(Box::new(o)),
6561                 },
6562                 result_ok: true,
6563         }
6564 }
6565 #[no_mangle]
6566 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6567 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6568         CResult_ChannelInfoDecodeErrorZ {
6569                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6570                         err: Box::into_raw(Box::new(e)),
6571                 },
6572                 result_ok: false,
6573         }
6574 }
6575 /// Checks if the given object is currently in the success state
6576 #[no_mangle]
6577 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6578         o.result_ok
6579 }
6580 #[no_mangle]
6581 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6582 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6583 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6584         fn drop(&mut self) {
6585                 if self.result_ok {
6586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6588                         }
6589                 } else {
6590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6592                         }
6593                 }
6594         }
6595 }
6596 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6597         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6598                 let contents = if o.result_ok {
6599                         let result = unsafe { o.contents.result };
6600                         unsafe { o.contents.result = core::ptr::null_mut() };
6601                         CResult_ChannelInfoDecodeErrorZPtr { result }
6602                 } else {
6603                         let err = unsafe { o.contents.err };
6604                         unsafe { o.contents.err = core::ptr::null_mut(); }
6605                         CResult_ChannelInfoDecodeErrorZPtr { err }
6606                 };
6607                 Self {
6608                         contents,
6609                         result_ok: o.result_ok,
6610                 }
6611         }
6612 }
6613 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6614         fn clone(&self) -> Self {
6615                 if self.result_ok {
6616                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6617                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6618                         } }
6619                 } else {
6620                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6621                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6622                         } }
6623                 }
6624         }
6625 }
6626 #[no_mangle]
6627 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6628 /// but with all dynamically-allocated buffers duplicated in new buffers.
6629 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6630 #[repr(C)]
6631 /// The contents of CResult_RoutingFeesDecodeErrorZ
6632 pub union CResult_RoutingFeesDecodeErrorZPtr {
6633         /// A pointer to the contents in the success state.
6634         /// Reading from this pointer when `result_ok` is not set is undefined.
6635         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6636         /// A pointer to the contents in the error state.
6637         /// Reading from this pointer when `result_ok` is set is undefined.
6638         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6639 }
6640 #[repr(C)]
6641 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6642 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6643 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6644 pub struct CResult_RoutingFeesDecodeErrorZ {
6645         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6646         /// `err` or `result` depending on the state of `result_ok`.
6647         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6648         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6649         pub result_ok: bool,
6650 }
6651 #[no_mangle]
6652 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6653 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6654         CResult_RoutingFeesDecodeErrorZ {
6655                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6656                         result: Box::into_raw(Box::new(o)),
6657                 },
6658                 result_ok: true,
6659         }
6660 }
6661 #[no_mangle]
6662 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6663 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6664         CResult_RoutingFeesDecodeErrorZ {
6665                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6666                         err: Box::into_raw(Box::new(e)),
6667                 },
6668                 result_ok: false,
6669         }
6670 }
6671 /// Checks if the given object is currently in the success state
6672 #[no_mangle]
6673 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6674         o.result_ok
6675 }
6676 #[no_mangle]
6677 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6678 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6679 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6680         fn drop(&mut self) {
6681                 if self.result_ok {
6682                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6683                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6684                         }
6685                 } else {
6686                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6687                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6688                         }
6689                 }
6690         }
6691 }
6692 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6693         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6694                 let contents = if o.result_ok {
6695                         let result = unsafe { o.contents.result };
6696                         unsafe { o.contents.result = core::ptr::null_mut() };
6697                         CResult_RoutingFeesDecodeErrorZPtr { result }
6698                 } else {
6699                         let err = unsafe { o.contents.err };
6700                         unsafe { o.contents.err = core::ptr::null_mut(); }
6701                         CResult_RoutingFeesDecodeErrorZPtr { err }
6702                 };
6703                 Self {
6704                         contents,
6705                         result_ok: o.result_ok,
6706                 }
6707         }
6708 }
6709 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6710         fn clone(&self) -> Self {
6711                 if self.result_ok {
6712                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6713                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6714                         } }
6715                 } else {
6716                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6717                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6718                         } }
6719                 }
6720         }
6721 }
6722 #[no_mangle]
6723 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6724 /// but with all dynamically-allocated buffers duplicated in new buffers.
6725 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6726 #[repr(C)]
6727 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6728 /// This corresponds to std::vector in C++
6729 pub struct CVec_NetAddressZ {
6730         /// The elements in the array.
6731         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6732         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6733         /// The number of elements pointed to by `data`.
6734         pub datalen: usize
6735 }
6736 impl CVec_NetAddressZ {
6737         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6738                 if self.datalen == 0 { return Vec::new(); }
6739                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6740                 self.data = core::ptr::null_mut();
6741                 self.datalen = 0;
6742                 ret
6743         }
6744         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6745                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6746         }
6747 }
6748 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6749         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6750                 let datalen = v.len();
6751                 let data = Box::into_raw(v.into_boxed_slice());
6752                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6753         }
6754 }
6755 #[no_mangle]
6756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6757 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6758 impl Drop for CVec_NetAddressZ {
6759         fn drop(&mut self) {
6760                 if self.datalen == 0 { return; }
6761                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6762         }
6763 }
6764 impl Clone for CVec_NetAddressZ {
6765         fn clone(&self) -> Self {
6766                 let mut res = Vec::new();
6767                 if self.datalen == 0 { return Self::from(res); }
6768                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6769                 Self::from(res)
6770         }
6771 }
6772 #[repr(C)]
6773 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6774 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6775         /// A pointer to the contents in the success state.
6776         /// Reading from this pointer when `result_ok` is not set is undefined.
6777         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6778         /// A pointer to the contents in the error state.
6779         /// Reading from this pointer when `result_ok` is set is undefined.
6780         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6781 }
6782 #[repr(C)]
6783 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6787         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6788         /// `err` or `result` depending on the state of `result_ok`.
6789         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6790         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6791         pub result_ok: bool,
6792 }
6793 #[no_mangle]
6794 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6796         CResult_NodeAnnouncementInfoDecodeErrorZ {
6797                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6798                         result: Box::into_raw(Box::new(o)),
6799                 },
6800                 result_ok: true,
6801         }
6802 }
6803 #[no_mangle]
6804 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6806         CResult_NodeAnnouncementInfoDecodeErrorZ {
6807                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6808                         err: Box::into_raw(Box::new(e)),
6809                 },
6810                 result_ok: false,
6811         }
6812 }
6813 /// Checks if the given object is currently in the success state
6814 #[no_mangle]
6815 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6816         o.result_ok
6817 }
6818 #[no_mangle]
6819 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6820 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6821 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6822         fn drop(&mut self) {
6823                 if self.result_ok {
6824                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6825                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6826                         }
6827                 } else {
6828                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6829                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6830                         }
6831                 }
6832         }
6833 }
6834 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6835         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6836                 let contents = if o.result_ok {
6837                         let result = unsafe { o.contents.result };
6838                         unsafe { o.contents.result = core::ptr::null_mut() };
6839                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6840                 } else {
6841                         let err = unsafe { o.contents.err };
6842                         unsafe { o.contents.err = core::ptr::null_mut(); }
6843                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6844                 };
6845                 Self {
6846                         contents,
6847                         result_ok: o.result_ok,
6848                 }
6849         }
6850 }
6851 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6852         fn clone(&self) -> Self {
6853                 if self.result_ok {
6854                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6855                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6856                         } }
6857                 } else {
6858                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6859                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6860                         } }
6861                 }
6862         }
6863 }
6864 #[no_mangle]
6865 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6866 /// but with all dynamically-allocated buffers duplicated in new buffers.
6867 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6868 #[repr(C)]
6869 /// The contents of CResult_NodeAliasDecodeErrorZ
6870 pub union CResult_NodeAliasDecodeErrorZPtr {
6871         /// A pointer to the contents in the success state.
6872         /// Reading from this pointer when `result_ok` is not set is undefined.
6873         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6874         /// A pointer to the contents in the error state.
6875         /// Reading from this pointer when `result_ok` is set is undefined.
6876         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6877 }
6878 #[repr(C)]
6879 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6880 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6881 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6882 pub struct CResult_NodeAliasDecodeErrorZ {
6883         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6884         /// `err` or `result` depending on the state of `result_ok`.
6885         pub contents: CResult_NodeAliasDecodeErrorZPtr,
6886         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6887         pub result_ok: bool,
6888 }
6889 #[no_mangle]
6890 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6891 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6892         CResult_NodeAliasDecodeErrorZ {
6893                 contents: CResult_NodeAliasDecodeErrorZPtr {
6894                         result: Box::into_raw(Box::new(o)),
6895                 },
6896                 result_ok: true,
6897         }
6898 }
6899 #[no_mangle]
6900 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6901 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6902         CResult_NodeAliasDecodeErrorZ {
6903                 contents: CResult_NodeAliasDecodeErrorZPtr {
6904                         err: Box::into_raw(Box::new(e)),
6905                 },
6906                 result_ok: false,
6907         }
6908 }
6909 /// Checks if the given object is currently in the success state
6910 #[no_mangle]
6911 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6912         o.result_ok
6913 }
6914 #[no_mangle]
6915 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6916 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6917 impl Drop for CResult_NodeAliasDecodeErrorZ {
6918         fn drop(&mut self) {
6919                 if self.result_ok {
6920                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6921                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6922                         }
6923                 } else {
6924                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6925                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6926                         }
6927                 }
6928         }
6929 }
6930 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6931         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6932                 let contents = if o.result_ok {
6933                         let result = unsafe { o.contents.result };
6934                         unsafe { o.contents.result = core::ptr::null_mut() };
6935                         CResult_NodeAliasDecodeErrorZPtr { result }
6936                 } else {
6937                         let err = unsafe { o.contents.err };
6938                         unsafe { o.contents.err = core::ptr::null_mut(); }
6939                         CResult_NodeAliasDecodeErrorZPtr { err }
6940                 };
6941                 Self {
6942                         contents,
6943                         result_ok: o.result_ok,
6944                 }
6945         }
6946 }
6947 impl Clone for CResult_NodeAliasDecodeErrorZ {
6948         fn clone(&self) -> Self {
6949                 if self.result_ok {
6950                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6951                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6952                         } }
6953                 } else {
6954                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6955                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6956                         } }
6957                 }
6958         }
6959 }
6960 #[no_mangle]
6961 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6962 /// but with all dynamically-allocated buffers duplicated in new buffers.
6963 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6964 #[repr(C)]
6965 /// The contents of CResult_NodeInfoDecodeErrorZ
6966 pub union CResult_NodeInfoDecodeErrorZPtr {
6967         /// A pointer to the contents in the success state.
6968         /// Reading from this pointer when `result_ok` is not set is undefined.
6969         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6970         /// A pointer to the contents in the error state.
6971         /// Reading from this pointer when `result_ok` is set is undefined.
6972         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6973 }
6974 #[repr(C)]
6975 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6976 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6977 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6978 pub struct CResult_NodeInfoDecodeErrorZ {
6979         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6980         /// `err` or `result` depending on the state of `result_ok`.
6981         pub contents: CResult_NodeInfoDecodeErrorZPtr,
6982         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6983         pub result_ok: bool,
6984 }
6985 #[no_mangle]
6986 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6987 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6988         CResult_NodeInfoDecodeErrorZ {
6989                 contents: CResult_NodeInfoDecodeErrorZPtr {
6990                         result: Box::into_raw(Box::new(o)),
6991                 },
6992                 result_ok: true,
6993         }
6994 }
6995 #[no_mangle]
6996 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6997 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6998         CResult_NodeInfoDecodeErrorZ {
6999                 contents: CResult_NodeInfoDecodeErrorZPtr {
7000                         err: Box::into_raw(Box::new(e)),
7001                 },
7002                 result_ok: false,
7003         }
7004 }
7005 /// Checks if the given object is currently in the success state
7006 #[no_mangle]
7007 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7008         o.result_ok
7009 }
7010 #[no_mangle]
7011 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7012 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7013 impl Drop for CResult_NodeInfoDecodeErrorZ {
7014         fn drop(&mut self) {
7015                 if self.result_ok {
7016                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7017                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7018                         }
7019                 } else {
7020                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7021                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7022                         }
7023                 }
7024         }
7025 }
7026 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7027         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7028                 let contents = if o.result_ok {
7029                         let result = unsafe { o.contents.result };
7030                         unsafe { o.contents.result = core::ptr::null_mut() };
7031                         CResult_NodeInfoDecodeErrorZPtr { result }
7032                 } else {
7033                         let err = unsafe { o.contents.err };
7034                         unsafe { o.contents.err = core::ptr::null_mut(); }
7035                         CResult_NodeInfoDecodeErrorZPtr { err }
7036                 };
7037                 Self {
7038                         contents,
7039                         result_ok: o.result_ok,
7040                 }
7041         }
7042 }
7043 impl Clone for CResult_NodeInfoDecodeErrorZ {
7044         fn clone(&self) -> Self {
7045                 if self.result_ok {
7046                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7047                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7048                         } }
7049                 } else {
7050                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7051                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7052                         } }
7053                 }
7054         }
7055 }
7056 #[no_mangle]
7057 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7058 /// but with all dynamically-allocated buffers duplicated in new buffers.
7059 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7060 #[repr(C)]
7061 /// The contents of CResult_NetworkGraphDecodeErrorZ
7062 pub union CResult_NetworkGraphDecodeErrorZPtr {
7063         /// A pointer to the contents in the success state.
7064         /// Reading from this pointer when `result_ok` is not set is undefined.
7065         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7066         /// A pointer to the contents in the error state.
7067         /// Reading from this pointer when `result_ok` is set is undefined.
7068         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7069 }
7070 #[repr(C)]
7071 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7072 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7074 pub struct CResult_NetworkGraphDecodeErrorZ {
7075         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7076         /// `err` or `result` depending on the state of `result_ok`.
7077         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7078         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7079         pub result_ok: bool,
7080 }
7081 #[no_mangle]
7082 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7083 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7084         CResult_NetworkGraphDecodeErrorZ {
7085                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7086                         result: Box::into_raw(Box::new(o)),
7087                 },
7088                 result_ok: true,
7089         }
7090 }
7091 #[no_mangle]
7092 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7093 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7094         CResult_NetworkGraphDecodeErrorZ {
7095                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7096                         err: Box::into_raw(Box::new(e)),
7097                 },
7098                 result_ok: false,
7099         }
7100 }
7101 /// Checks if the given object is currently in the success state
7102 #[no_mangle]
7103 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7104         o.result_ok
7105 }
7106 #[no_mangle]
7107 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7108 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7109 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7110         fn drop(&mut self) {
7111                 if self.result_ok {
7112                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7113                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7114                         }
7115                 } else {
7116                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7118                         }
7119                 }
7120         }
7121 }
7122 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7123         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7124                 let contents = if o.result_ok {
7125                         let result = unsafe { o.contents.result };
7126                         unsafe { o.contents.result = core::ptr::null_mut() };
7127                         CResult_NetworkGraphDecodeErrorZPtr { result }
7128                 } else {
7129                         let err = unsafe { o.contents.err };
7130                         unsafe { o.contents.err = core::ptr::null_mut(); }
7131                         CResult_NetworkGraphDecodeErrorZPtr { err }
7132                 };
7133                 Self {
7134                         contents,
7135                         result_ok: o.result_ok,
7136                 }
7137         }
7138 }
7139 #[repr(C)]
7140 #[derive(Clone)]
7141 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7142 pub enum COption_CVec_NetAddressZZ {
7143         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7144         Some(crate::c_types::derived::CVec_NetAddressZ),
7145         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7146         None
7147 }
7148 impl COption_CVec_NetAddressZZ {
7149         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7150                 if let Self::None = self { false } else { true }
7151         }
7152         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7153                 !self.is_some()
7154         }
7155         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
7156                 if let Self::Some(v) = self { v } else { unreachable!() }
7157         }
7158 }
7159 #[no_mangle]
7160 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
7161 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
7162         COption_CVec_NetAddressZZ::Some(o)
7163 }
7164 #[no_mangle]
7165 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
7166 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
7167         COption_CVec_NetAddressZZ::None
7168 }
7169 #[no_mangle]
7170 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
7171 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
7172 #[no_mangle]
7173 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
7174 /// but with all dynamically-allocated buffers duplicated in new buffers.
7175 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
7176 #[repr(C)]
7177 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
7178 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7179         /// A pointer to the contents in the success state.
7180         /// Reading from this pointer when `result_ok` is not set is undefined.
7181         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
7182         /// A pointer to the contents in the error state.
7183         /// Reading from this pointer when `result_ok` is set is undefined.
7184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7185 }
7186 #[repr(C)]
7187 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7188 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7190 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7191         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
7192         /// `err` or `result` depending on the state of `result_ok`.
7193         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
7194         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
7195         pub result_ok: bool,
7196 }
7197 #[no_mangle]
7198 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
7199 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7200         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7201                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7202                         result: Box::into_raw(Box::new(o)),
7203                 },
7204                 result_ok: true,
7205         }
7206 }
7207 #[no_mangle]
7208 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
7209 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7210         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7211                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7212                         err: Box::into_raw(Box::new(e)),
7213                 },
7214                 result_ok: false,
7215         }
7216 }
7217 /// Checks if the given object is currently in the success state
7218 #[no_mangle]
7219 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
7220         o.result_ok
7221 }
7222 #[no_mangle]
7223 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
7224 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
7225 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7226         fn drop(&mut self) {
7227                 if self.result_ok {
7228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7230                         }
7231                 } else {
7232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7234                         }
7235                 }
7236         }
7237 }
7238 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7240                 let contents = if o.result_ok {
7241                         let result = unsafe { o.contents.result };
7242                         unsafe { o.contents.result = core::ptr::null_mut() };
7243                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
7244                 } else {
7245                         let err = unsafe { o.contents.err };
7246                         unsafe { o.contents.err = core::ptr::null_mut(); }
7247                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
7248                 };
7249                 Self {
7250                         contents,
7251                         result_ok: o.result_ok,
7252                 }
7253         }
7254 }
7255 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7256         fn clone(&self) -> Self {
7257                 if self.result_ok {
7258                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7259                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7260                         } }
7261                 } else {
7262                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7264                         } }
7265                 }
7266         }
7267 }
7268 #[no_mangle]
7269 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7270 /// but with all dynamically-allocated buffers duplicated in new buffers.
7271 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7272 #[repr(C)]
7273 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
7274 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7275         /// A pointer to the contents in the success state.
7276         /// Reading from this pointer when `result_ok` is not set is undefined.
7277         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
7278         /// A pointer to the contents in the error state.
7279         /// Reading from this pointer when `result_ok` is set is undefined.
7280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7281 }
7282 #[repr(C)]
7283 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7284 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7286 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7287         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
7288         /// `err` or `result` depending on the state of `result_ok`.
7289         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
7290         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
7291         pub result_ok: bool,
7292 }
7293 #[no_mangle]
7294 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
7295 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7296         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7297                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7298                         result: Box::into_raw(Box::new(o)),
7299                 },
7300                 result_ok: true,
7301         }
7302 }
7303 #[no_mangle]
7304 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
7305 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7306         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7307                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7308                         err: Box::into_raw(Box::new(e)),
7309                 },
7310                 result_ok: false,
7311         }
7312 }
7313 /// Checks if the given object is currently in the success state
7314 #[no_mangle]
7315 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
7316         o.result_ok
7317 }
7318 #[no_mangle]
7319 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
7320 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
7321 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7322         fn drop(&mut self) {
7323                 if self.result_ok {
7324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7326                         }
7327                 } else {
7328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7330                         }
7331                 }
7332         }
7333 }
7334 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7336                 let contents = if o.result_ok {
7337                         let result = unsafe { o.contents.result };
7338                         unsafe { o.contents.result = core::ptr::null_mut() };
7339                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
7340                 } else {
7341                         let err = unsafe { o.contents.err };
7342                         unsafe { o.contents.err = core::ptr::null_mut(); }
7343                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
7344                 };
7345                 Self {
7346                         contents,
7347                         result_ok: o.result_ok,
7348                 }
7349         }
7350 }
7351 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7352         fn clone(&self) -> Self {
7353                 if self.result_ok {
7354                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7355                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7356                         } }
7357                 } else {
7358                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7360                         } }
7361                 }
7362         }
7363 }
7364 #[no_mangle]
7365 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7366 /// but with all dynamically-allocated buffers duplicated in new buffers.
7367 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7368 #[repr(C)]
7369 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7370 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7371         /// A pointer to the contents in the success state.
7372         /// Reading from this pointer when `result_ok` is not set is undefined.
7373         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
7374         /// A pointer to the contents in the error state.
7375         /// Reading from this pointer when `result_ok` is set is undefined.
7376         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7377 }
7378 #[repr(C)]
7379 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7380 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7382 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
7383         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7384         /// `err` or `result` depending on the state of `result_ok`.
7385         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7386         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7387         pub result_ok: bool,
7388 }
7389 #[no_mangle]
7390 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7391 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7392         CResult_SpendableOutputDescriptorDecodeErrorZ {
7393                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7394                         result: Box::into_raw(Box::new(o)),
7395                 },
7396                 result_ok: true,
7397         }
7398 }
7399 #[no_mangle]
7400 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7401 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7402         CResult_SpendableOutputDescriptorDecodeErrorZ {
7403                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7404                         err: Box::into_raw(Box::new(e)),
7405                 },
7406                 result_ok: false,
7407         }
7408 }
7409 /// Checks if the given object is currently in the success state
7410 #[no_mangle]
7411 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
7412         o.result_ok
7413 }
7414 #[no_mangle]
7415 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
7416 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7417 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
7418         fn drop(&mut self) {
7419                 if self.result_ok {
7420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7422                         }
7423                 } else {
7424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7426                         }
7427                 }
7428         }
7429 }
7430 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7432                 let contents = if o.result_ok {
7433                         let result = unsafe { o.contents.result };
7434                         unsafe { o.contents.result = core::ptr::null_mut() };
7435                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
7436                 } else {
7437                         let err = unsafe { o.contents.err };
7438                         unsafe { o.contents.err = core::ptr::null_mut(); }
7439                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7440                 };
7441                 Self {
7442                         contents,
7443                         result_ok: o.result_ok,
7444                 }
7445         }
7446 }
7447 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7448         fn clone(&self) -> Self {
7449                 if self.result_ok {
7450                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7451                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7452                         } }
7453                 } else {
7454                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7455                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7456                         } }
7457                 }
7458         }
7459 }
7460 #[no_mangle]
7461 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7462 /// but with all dynamically-allocated buffers duplicated in new buffers.
7463 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7464 #[repr(C)]
7465 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7466 /// This corresponds to std::vector in C++
7467 pub struct CVec_PaymentPreimageZ {
7468         /// The elements in the array.
7469         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7470         pub data: *mut crate::c_types::ThirtyTwoBytes,
7471         /// The number of elements pointed to by `data`.
7472         pub datalen: usize
7473 }
7474 impl CVec_PaymentPreimageZ {
7475         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
7476                 if self.datalen == 0 { return Vec::new(); }
7477                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7478                 self.data = core::ptr::null_mut();
7479                 self.datalen = 0;
7480                 ret
7481         }
7482         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
7483                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7484         }
7485 }
7486 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
7487         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
7488                 let datalen = v.len();
7489                 let data = Box::into_raw(v.into_boxed_slice());
7490                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7491         }
7492 }
7493 #[no_mangle]
7494 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7495 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
7496 impl Drop for CVec_PaymentPreimageZ {
7497         fn drop(&mut self) {
7498                 if self.datalen == 0 { return; }
7499                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7500         }
7501 }
7502 impl Clone for CVec_PaymentPreimageZ {
7503         fn clone(&self) -> Self {
7504                 let mut res = Vec::new();
7505                 if self.datalen == 0 { return Self::from(res); }
7506                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7507                 Self::from(res)
7508         }
7509 }
7510 #[repr(C)]
7511 /// A tuple of 2 elements. See the individual fields for the types contained.
7512 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7513         /// The element at position 0
7514         pub a: crate::c_types::Signature,
7515         /// The element at position 1
7516         pub b: crate::c_types::derived::CVec_SignatureZ,
7517 }
7518 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7519         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7520                 Self {
7521                         a: tup.0,
7522                         b: tup.1,
7523                 }
7524         }
7525 }
7526 impl C2Tuple_SignatureCVec_SignatureZZ {
7527         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7528                 (self.a, self.b)
7529         }
7530 }
7531 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7532         fn clone(&self) -> Self {
7533                 Self {
7534                         a: Clone::clone(&self.a),
7535                         b: Clone::clone(&self.b),
7536                 }
7537         }
7538 }
7539 #[no_mangle]
7540 /// Creates a new tuple which has the same data as `orig`
7541 /// but with all dynamically-allocated buffers duplicated in new buffers.
7542 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
7543 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7544 #[no_mangle]
7545 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7546         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7547 }
7548
7549 #[no_mangle]
7550 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7551 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7552 #[repr(C)]
7553 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7554 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7555         /// A pointer to the contents in the success state.
7556         /// Reading from this pointer when `result_ok` is not set is undefined.
7557         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
7558         /// Note that this value is always NULL, as there are no contents in the Err variant
7559         pub err: *mut core::ffi::c_void,
7560 }
7561 #[repr(C)]
7562 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7563 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7566         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7567         /// `err` or `result` depending on the state of `result_ok`.
7568         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
7569         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7570         pub result_ok: bool,
7571 }
7572 #[no_mangle]
7573 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
7574 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7575         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7576                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7577                         result: Box::into_raw(Box::new(o)),
7578                 },
7579                 result_ok: true,
7580         }
7581 }
7582 #[no_mangle]
7583 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7584 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7585         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7586                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7587                         err: core::ptr::null_mut(),
7588                 },
7589                 result_ok: false,
7590         }
7591 }
7592 /// Checks if the given object is currently in the success state
7593 #[no_mangle]
7594 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
7595         o.result_ok
7596 }
7597 #[no_mangle]
7598 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7599 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7600 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7601         fn drop(&mut self) {
7602                 if self.result_ok {
7603                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7604                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7605                         }
7606                 } else {
7607                 }
7608         }
7609 }
7610 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7611         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
7612                 let contents = if o.result_ok {
7613                         let result = unsafe { o.contents.result };
7614                         unsafe { o.contents.result = core::ptr::null_mut() };
7615                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7616                 } else {
7617                         let _ = unsafe { Box::from_raw(o.contents.err) };
7618                         o.contents.err = core::ptr::null_mut();
7619                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
7620                 };
7621                 Self {
7622                         contents,
7623                         result_ok: o.result_ok,
7624                 }
7625         }
7626 }
7627 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7628         fn clone(&self) -> Self {
7629                 if self.result_ok {
7630                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7631                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
7632                         } }
7633                 } else {
7634                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7635                                 err: core::ptr::null_mut()
7636                         } }
7637                 }
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
7644 #[repr(C)]
7645 /// The contents of CResult_SignatureNoneZ
7646 pub union CResult_SignatureNoneZPtr {
7647         /// A pointer to the contents in the success state.
7648         /// Reading from this pointer when `result_ok` is not set is undefined.
7649         pub result: *mut crate::c_types::Signature,
7650         /// Note that this value is always NULL, as there are no contents in the Err variant
7651         pub err: *mut core::ffi::c_void,
7652 }
7653 #[repr(C)]
7654 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
7655 /// containing a crate::c_types::Signature on success and a () on failure.
7656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7657 pub struct CResult_SignatureNoneZ {
7658         /// The contents of this CResult_SignatureNoneZ, accessible via either
7659         /// `err` or `result` depending on the state of `result_ok`.
7660         pub contents: CResult_SignatureNoneZPtr,
7661         /// Whether this CResult_SignatureNoneZ represents a success state.
7662         pub result_ok: bool,
7663 }
7664 #[no_mangle]
7665 /// Creates a new CResult_SignatureNoneZ in the success state.
7666 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
7667         CResult_SignatureNoneZ {
7668                 contents: CResult_SignatureNoneZPtr {
7669                         result: Box::into_raw(Box::new(o)),
7670                 },
7671                 result_ok: true,
7672         }
7673 }
7674 #[no_mangle]
7675 /// Creates a new CResult_SignatureNoneZ in the error state.
7676 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
7677         CResult_SignatureNoneZ {
7678                 contents: CResult_SignatureNoneZPtr {
7679                         err: core::ptr::null_mut(),
7680                 },
7681                 result_ok: false,
7682         }
7683 }
7684 /// Checks if the given object is currently in the success state
7685 #[no_mangle]
7686 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
7687         o.result_ok
7688 }
7689 #[no_mangle]
7690 /// Frees any resources used by the CResult_SignatureNoneZ.
7691 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
7692 impl Drop for CResult_SignatureNoneZ {
7693         fn drop(&mut self) {
7694                 if self.result_ok {
7695                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7696                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7697                         }
7698                 } else {
7699                 }
7700         }
7701 }
7702 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
7703         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
7704                 let contents = if o.result_ok {
7705                         let result = unsafe { o.contents.result };
7706                         unsafe { o.contents.result = core::ptr::null_mut() };
7707                         CResult_SignatureNoneZPtr { result }
7708                 } else {
7709                         let _ = unsafe { Box::from_raw(o.contents.err) };
7710                         o.contents.err = core::ptr::null_mut();
7711                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
7712                 };
7713                 Self {
7714                         contents,
7715                         result_ok: o.result_ok,
7716                 }
7717         }
7718 }
7719 impl Clone for CResult_SignatureNoneZ {
7720         fn clone(&self) -> Self {
7721                 if self.result_ok {
7722                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
7723                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
7724                         } }
7725                 } else {
7726                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
7727                                 err: core::ptr::null_mut()
7728                         } }
7729                 }
7730         }
7731 }
7732 #[no_mangle]
7733 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
7734 /// but with all dynamically-allocated buffers duplicated in new buffers.
7735 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
7736 #[repr(C)]
7737 /// The contents of CResult_PublicKeyNoneZ
7738 pub union CResult_PublicKeyNoneZPtr {
7739         /// A pointer to the contents in the success state.
7740         /// Reading from this pointer when `result_ok` is not set is undefined.
7741         pub result: *mut crate::c_types::PublicKey,
7742         /// Note that this value is always NULL, as there are no contents in the Err variant
7743         pub err: *mut core::ffi::c_void,
7744 }
7745 #[repr(C)]
7746 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7747 /// containing a crate::c_types::PublicKey on success and a () on failure.
7748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749 pub struct CResult_PublicKeyNoneZ {
7750         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7751         /// `err` or `result` depending on the state of `result_ok`.
7752         pub contents: CResult_PublicKeyNoneZPtr,
7753         /// Whether this CResult_PublicKeyNoneZ represents a success state.
7754         pub result_ok: bool,
7755 }
7756 #[no_mangle]
7757 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7758 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7759         CResult_PublicKeyNoneZ {
7760                 contents: CResult_PublicKeyNoneZPtr {
7761                         result: Box::into_raw(Box::new(o)),
7762                 },
7763                 result_ok: true,
7764         }
7765 }
7766 #[no_mangle]
7767 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7768 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7769         CResult_PublicKeyNoneZ {
7770                 contents: CResult_PublicKeyNoneZPtr {
7771                         err: core::ptr::null_mut(),
7772                 },
7773                 result_ok: false,
7774         }
7775 }
7776 /// Checks if the given object is currently in the success state
7777 #[no_mangle]
7778 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7779         o.result_ok
7780 }
7781 #[no_mangle]
7782 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7783 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7784 impl Drop for CResult_PublicKeyNoneZ {
7785         fn drop(&mut self) {
7786                 if self.result_ok {
7787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7789                         }
7790                 } else {
7791                 }
7792         }
7793 }
7794 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7795         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7796                 let contents = if o.result_ok {
7797                         let result = unsafe { o.contents.result };
7798                         unsafe { o.contents.result = core::ptr::null_mut() };
7799                         CResult_PublicKeyNoneZPtr { result }
7800                 } else {
7801                         let _ = unsafe { Box::from_raw(o.contents.err) };
7802                         o.contents.err = core::ptr::null_mut();
7803                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7804                 };
7805                 Self {
7806                         contents,
7807                         result_ok: o.result_ok,
7808                 }
7809         }
7810 }
7811 impl Clone for CResult_PublicKeyNoneZ {
7812         fn clone(&self) -> Self {
7813                 if self.result_ok {
7814                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7815                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7816                         } }
7817                 } else {
7818                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7819                                 err: core::ptr::null_mut()
7820                         } }
7821                 }
7822         }
7823 }
7824 #[no_mangle]
7825 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7826 /// but with all dynamically-allocated buffers duplicated in new buffers.
7827 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7828 #[repr(C)]
7829 #[derive(Clone)]
7830 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7831 pub enum COption_ScalarZ {
7832         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7833         Some(crate::c_types::BigEndianScalar),
7834         /// When we're in this state, this COption_ScalarZ contains nothing
7835         None
7836 }
7837 impl COption_ScalarZ {
7838         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7839                 if let Self::None = self { false } else { true }
7840         }
7841         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7842                 !self.is_some()
7843         }
7844         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7845                 if let Self::Some(v) = self { v } else { unreachable!() }
7846         }
7847 }
7848 #[no_mangle]
7849 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7850 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7851         COption_ScalarZ::Some(o)
7852 }
7853 #[no_mangle]
7854 /// Constructs a new COption_ScalarZ containing nothing
7855 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7856         COption_ScalarZ::None
7857 }
7858 #[no_mangle]
7859 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7860 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7861 #[no_mangle]
7862 /// Creates a new COption_ScalarZ which has the same data as `orig`
7863 /// but with all dynamically-allocated buffers duplicated in new buffers.
7864 pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) }
7865 #[repr(C)]
7866 /// The contents of CResult_SharedSecretNoneZ
7867 pub union CResult_SharedSecretNoneZPtr {
7868         /// A pointer to the contents in the success state.
7869         /// Reading from this pointer when `result_ok` is not set is undefined.
7870         pub result: *mut crate::c_types::ThirtyTwoBytes,
7871         /// Note that this value is always NULL, as there are no contents in the Err variant
7872         pub err: *mut core::ffi::c_void,
7873 }
7874 #[repr(C)]
7875 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7876 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878 pub struct CResult_SharedSecretNoneZ {
7879         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7880         /// `err` or `result` depending on the state of `result_ok`.
7881         pub contents: CResult_SharedSecretNoneZPtr,
7882         /// Whether this CResult_SharedSecretNoneZ represents a success state.
7883         pub result_ok: bool,
7884 }
7885 #[no_mangle]
7886 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7887 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7888         CResult_SharedSecretNoneZ {
7889                 contents: CResult_SharedSecretNoneZPtr {
7890                         result: Box::into_raw(Box::new(o)),
7891                 },
7892                 result_ok: true,
7893         }
7894 }
7895 #[no_mangle]
7896 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7897 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7898         CResult_SharedSecretNoneZ {
7899                 contents: CResult_SharedSecretNoneZPtr {
7900                         err: core::ptr::null_mut(),
7901                 },
7902                 result_ok: false,
7903         }
7904 }
7905 /// Checks if the given object is currently in the success state
7906 #[no_mangle]
7907 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7908         o.result_ok
7909 }
7910 #[no_mangle]
7911 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7912 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7913 impl Drop for CResult_SharedSecretNoneZ {
7914         fn drop(&mut self) {
7915                 if self.result_ok {
7916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7918                         }
7919                 } else {
7920                 }
7921         }
7922 }
7923 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7924         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7925                 let contents = if o.result_ok {
7926                         let result = unsafe { o.contents.result };
7927                         unsafe { o.contents.result = core::ptr::null_mut() };
7928                         CResult_SharedSecretNoneZPtr { result }
7929                 } else {
7930                         let _ = unsafe { Box::from_raw(o.contents.err) };
7931                         o.contents.err = core::ptr::null_mut();
7932                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7933                 };
7934                 Self {
7935                         contents,
7936                         result_ok: o.result_ok,
7937                 }
7938         }
7939 }
7940 impl Clone for CResult_SharedSecretNoneZ {
7941         fn clone(&self) -> Self {
7942                 if self.result_ok {
7943                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7944                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7945                         } }
7946                 } else {
7947                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7948                                 err: core::ptr::null_mut()
7949                         } }
7950                 }
7951         }
7952 }
7953 #[no_mangle]
7954 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7955 /// but with all dynamically-allocated buffers duplicated in new buffers.
7956 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7957 #[repr(C)]
7958 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7959 /// This corresponds to std::vector in C++
7960 pub struct CVec_U5Z {
7961         /// The elements in the array.
7962         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7963         pub data: *mut crate::c_types::U5,
7964         /// The number of elements pointed to by `data`.
7965         pub datalen: usize
7966 }
7967 impl CVec_U5Z {
7968         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7969                 if self.datalen == 0 { return Vec::new(); }
7970                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7971                 self.data = core::ptr::null_mut();
7972                 self.datalen = 0;
7973                 ret
7974         }
7975         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7976                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7977         }
7978 }
7979 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7980         fn from(v: Vec<crate::c_types::U5>) -> Self {
7981                 let datalen = v.len();
7982                 let data = Box::into_raw(v.into_boxed_slice());
7983                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7984         }
7985 }
7986 #[no_mangle]
7987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7988 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7989 impl Drop for CVec_U5Z {
7990         fn drop(&mut self) {
7991                 if self.datalen == 0 { return; }
7992                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7993         }
7994 }
7995 impl Clone for CVec_U5Z {
7996         fn clone(&self) -> Self {
7997                 let mut res = Vec::new();
7998                 if self.datalen == 0 { return Self::from(res); }
7999                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8000                 Self::from(res)
8001         }
8002 }
8003 #[repr(C)]
8004 /// The contents of CResult_RecoverableSignatureNoneZ
8005 pub union CResult_RecoverableSignatureNoneZPtr {
8006         /// A pointer to the contents in the success state.
8007         /// Reading from this pointer when `result_ok` is not set is undefined.
8008         pub result: *mut crate::c_types::RecoverableSignature,
8009         /// Note that this value is always NULL, as there are no contents in the Err variant
8010         pub err: *mut core::ffi::c_void,
8011 }
8012 #[repr(C)]
8013 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
8014 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
8015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8016 pub struct CResult_RecoverableSignatureNoneZ {
8017         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
8018         /// `err` or `result` depending on the state of `result_ok`.
8019         pub contents: CResult_RecoverableSignatureNoneZPtr,
8020         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
8021         pub result_ok: bool,
8022 }
8023 #[no_mangle]
8024 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
8025 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
8026         CResult_RecoverableSignatureNoneZ {
8027                 contents: CResult_RecoverableSignatureNoneZPtr {
8028                         result: Box::into_raw(Box::new(o)),
8029                 },
8030                 result_ok: true,
8031         }
8032 }
8033 #[no_mangle]
8034 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
8035 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
8036         CResult_RecoverableSignatureNoneZ {
8037                 contents: CResult_RecoverableSignatureNoneZPtr {
8038                         err: core::ptr::null_mut(),
8039                 },
8040                 result_ok: false,
8041         }
8042 }
8043 /// Checks if the given object is currently in the success state
8044 #[no_mangle]
8045 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
8046         o.result_ok
8047 }
8048 #[no_mangle]
8049 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
8050 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
8051 impl Drop for CResult_RecoverableSignatureNoneZ {
8052         fn drop(&mut self) {
8053                 if self.result_ok {
8054                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8055                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8056                         }
8057                 } else {
8058                 }
8059         }
8060 }
8061 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
8062         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
8063                 let contents = if o.result_ok {
8064                         let result = unsafe { o.contents.result };
8065                         unsafe { o.contents.result = core::ptr::null_mut() };
8066                         CResult_RecoverableSignatureNoneZPtr { result }
8067                 } else {
8068                         let _ = unsafe { Box::from_raw(o.contents.err) };
8069                         o.contents.err = core::ptr::null_mut();
8070                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
8071                 };
8072                 Self {
8073                         contents,
8074                         result_ok: o.result_ok,
8075                 }
8076         }
8077 }
8078 impl Clone for CResult_RecoverableSignatureNoneZ {
8079         fn clone(&self) -> Self {
8080                 if self.result_ok {
8081                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
8082                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
8083                         } }
8084                 } else {
8085                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
8086                                 err: core::ptr::null_mut()
8087                         } }
8088                 }
8089         }
8090 }
8091 #[no_mangle]
8092 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
8093 /// but with all dynamically-allocated buffers duplicated in new buffers.
8094 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
8095 #[repr(C)]
8096 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
8097 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8098         /// A pointer to the contents in the success state.
8099         /// Reading from this pointer when `result_ok` is not set is undefined.
8100         pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
8101         /// A pointer to the contents in the error state.
8102         /// Reading from this pointer when `result_ok` is set is undefined.
8103         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8104 }
8105 #[repr(C)]
8106 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
8107 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8109 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8110         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
8111         /// `err` or `result` depending on the state of `result_ok`.
8112         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
8113         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
8114         pub result_ok: bool,
8115 }
8116 #[no_mangle]
8117 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
8118 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8119         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8120                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8121                         result: Box::into_raw(Box::new(o)),
8122                 },
8123                 result_ok: true,
8124         }
8125 }
8126 #[no_mangle]
8127 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
8128 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8129         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8130                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8131                         err: Box::into_raw(Box::new(e)),
8132                 },
8133                 result_ok: false,
8134         }
8135 }
8136 /// Checks if the given object is currently in the success state
8137 #[no_mangle]
8138 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
8139         o.result_ok
8140 }
8141 #[no_mangle]
8142 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
8143 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
8144 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8145         fn drop(&mut self) {
8146                 if self.result_ok {
8147                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8148                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8149                         }
8150                 } else {
8151                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8152                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8153                         }
8154                 }
8155         }
8156 }
8157 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8158         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8159                 let contents = if o.result_ok {
8160                         let result = unsafe { o.contents.result };
8161                         unsafe { o.contents.result = core::ptr::null_mut() };
8162                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
8163                 } else {
8164                         let err = unsafe { o.contents.err };
8165                         unsafe { o.contents.err = core::ptr::null_mut(); }
8166                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
8167                 };
8168                 Self {
8169                         contents,
8170                         result_ok: o.result_ok,
8171                 }
8172         }
8173 }
8174 #[repr(C)]
8175 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8176 /// This corresponds to std::vector in C++
8177 pub struct CVec_CVec_u8ZZ {
8178         /// The elements in the array.
8179         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8180         pub data: *mut crate::c_types::derived::CVec_u8Z,
8181         /// The number of elements pointed to by `data`.
8182         pub datalen: usize
8183 }
8184 impl CVec_CVec_u8ZZ {
8185         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8186                 if self.datalen == 0 { return Vec::new(); }
8187                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8188                 self.data = core::ptr::null_mut();
8189                 self.datalen = 0;
8190                 ret
8191         }
8192         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8193                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8194         }
8195 }
8196 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8197         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8198                 let datalen = v.len();
8199                 let data = Box::into_raw(v.into_boxed_slice());
8200                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8201         }
8202 }
8203 #[no_mangle]
8204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8205 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8206 impl Drop for CVec_CVec_u8ZZ {
8207         fn drop(&mut self) {
8208                 if self.datalen == 0 { return; }
8209                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8210         }
8211 }
8212 impl Clone for CVec_CVec_u8ZZ {
8213         fn clone(&self) -> Self {
8214                 let mut res = Vec::new();
8215                 if self.datalen == 0 { return Self::from(res); }
8216                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8217                 Self::from(res)
8218         }
8219 }
8220 #[repr(C)]
8221 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8222 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8223         /// A pointer to the contents in the success state.
8224         /// Reading from this pointer when `result_ok` is not set is undefined.
8225         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8226         /// Note that this value is always NULL, as there are no contents in the Err variant
8227         pub err: *mut core::ffi::c_void,
8228 }
8229 #[repr(C)]
8230 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8231 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8233 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8234         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8235         /// `err` or `result` depending on the state of `result_ok`.
8236         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8237         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8238         pub result_ok: bool,
8239 }
8240 #[no_mangle]
8241 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8242 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8243         CResult_CVec_CVec_u8ZZNoneZ {
8244                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8245                         result: Box::into_raw(Box::new(o)),
8246                 },
8247                 result_ok: true,
8248         }
8249 }
8250 #[no_mangle]
8251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8252 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8253         CResult_CVec_CVec_u8ZZNoneZ {
8254                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8255                         err: core::ptr::null_mut(),
8256                 },
8257                 result_ok: false,
8258         }
8259 }
8260 /// Checks if the given object is currently in the success state
8261 #[no_mangle]
8262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
8263         o.result_ok
8264 }
8265 #[no_mangle]
8266 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8267 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8268 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8269         fn drop(&mut self) {
8270                 if self.result_ok {
8271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8273                         }
8274                 } else {
8275                 }
8276         }
8277 }
8278 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
8279         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
8280                 let contents = if o.result_ok {
8281                         let result = unsafe { o.contents.result };
8282                         unsafe { o.contents.result = core::ptr::null_mut() };
8283                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
8284                 } else {
8285                         let _ = unsafe { Box::from_raw(o.contents.err) };
8286                         o.contents.err = core::ptr::null_mut();
8287                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
8288                 };
8289                 Self {
8290                         contents,
8291                         result_ok: o.result_ok,
8292                 }
8293         }
8294 }
8295 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8296         fn clone(&self) -> Self {
8297                 if self.result_ok {
8298                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8299                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8300                         } }
8301                 } else {
8302                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8303                                 err: core::ptr::null_mut()
8304                         } }
8305                 }
8306         }
8307 }
8308 #[no_mangle]
8309 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8310 /// but with all dynamically-allocated buffers duplicated in new buffers.
8311 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
8312 #[repr(C)]
8313 /// The contents of CResult_InMemorySignerDecodeErrorZ
8314 pub union CResult_InMemorySignerDecodeErrorZPtr {
8315         /// A pointer to the contents in the success state.
8316         /// Reading from this pointer when `result_ok` is not set is undefined.
8317         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8318         /// A pointer to the contents in the error state.
8319         /// Reading from this pointer when `result_ok` is set is undefined.
8320         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8321 }
8322 #[repr(C)]
8323 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8324 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8326 pub struct CResult_InMemorySignerDecodeErrorZ {
8327         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8328         /// `err` or `result` depending on the state of `result_ok`.
8329         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8330         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8331         pub result_ok: bool,
8332 }
8333 #[no_mangle]
8334 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8335 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8336         CResult_InMemorySignerDecodeErrorZ {
8337                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8338                         result: Box::into_raw(Box::new(o)),
8339                 },
8340                 result_ok: true,
8341         }
8342 }
8343 #[no_mangle]
8344 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8345 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8346         CResult_InMemorySignerDecodeErrorZ {
8347                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8348                         err: Box::into_raw(Box::new(e)),
8349                 },
8350                 result_ok: false,
8351         }
8352 }
8353 /// Checks if the given object is currently in the success state
8354 #[no_mangle]
8355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
8356         o.result_ok
8357 }
8358 #[no_mangle]
8359 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8360 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8361 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8362         fn drop(&mut self) {
8363                 if self.result_ok {
8364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8366                         }
8367                 } else {
8368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8370                         }
8371                 }
8372         }
8373 }
8374 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8376                 let contents = if o.result_ok {
8377                         let result = unsafe { o.contents.result };
8378                         unsafe { o.contents.result = core::ptr::null_mut() };
8379                         CResult_InMemorySignerDecodeErrorZPtr { result }
8380                 } else {
8381                         let err = unsafe { o.contents.err };
8382                         unsafe { o.contents.err = core::ptr::null_mut(); }
8383                         CResult_InMemorySignerDecodeErrorZPtr { err }
8384                 };
8385                 Self {
8386                         contents,
8387                         result_ok: o.result_ok,
8388                 }
8389         }
8390 }
8391 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8392         fn clone(&self) -> Self {
8393                 if self.result_ok {
8394                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8395                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8396                         } }
8397                 } else {
8398                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8399                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8400                         } }
8401                 }
8402         }
8403 }
8404 #[no_mangle]
8405 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8406 /// but with all dynamically-allocated buffers duplicated in new buffers.
8407 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
8408 #[repr(C)]
8409 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8410 /// This corresponds to std::vector in C++
8411 pub struct CVec_TxOutZ {
8412         /// The elements in the array.
8413         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8414         pub data: *mut crate::c_types::TxOut,
8415         /// The number of elements pointed to by `data`.
8416         pub datalen: usize
8417 }
8418 impl CVec_TxOutZ {
8419         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8420                 if self.datalen == 0 { return Vec::new(); }
8421                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8422                 self.data = core::ptr::null_mut();
8423                 self.datalen = 0;
8424                 ret
8425         }
8426         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8427                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8428         }
8429 }
8430 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8431         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8432                 let datalen = v.len();
8433                 let data = Box::into_raw(v.into_boxed_slice());
8434                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8435         }
8436 }
8437 #[no_mangle]
8438 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8439 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8440 impl Drop for CVec_TxOutZ {
8441         fn drop(&mut self) {
8442                 if self.datalen == 0 { return; }
8443                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8444         }
8445 }
8446 impl Clone for CVec_TxOutZ {
8447         fn clone(&self) -> Self {
8448                 let mut res = Vec::new();
8449                 if self.datalen == 0 { return Self::from(res); }
8450                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8451                 Self::from(res)
8452         }
8453 }
8454 #[repr(C)]
8455 /// The contents of CResult_TransactionNoneZ
8456 pub union CResult_TransactionNoneZPtr {
8457         /// A pointer to the contents in the success state.
8458         /// Reading from this pointer when `result_ok` is not set is undefined.
8459         pub result: *mut crate::c_types::Transaction,
8460         /// Note that this value is always NULL, as there are no contents in the Err variant
8461         pub err: *mut core::ffi::c_void,
8462 }
8463 #[repr(C)]
8464 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8465 /// containing a crate::c_types::Transaction on success and a () on failure.
8466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8467 pub struct CResult_TransactionNoneZ {
8468         /// The contents of this CResult_TransactionNoneZ, accessible via either
8469         /// `err` or `result` depending on the state of `result_ok`.
8470         pub contents: CResult_TransactionNoneZPtr,
8471         /// Whether this CResult_TransactionNoneZ represents a success state.
8472         pub result_ok: bool,
8473 }
8474 #[no_mangle]
8475 /// Creates a new CResult_TransactionNoneZ in the success state.
8476 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8477         CResult_TransactionNoneZ {
8478                 contents: CResult_TransactionNoneZPtr {
8479                         result: Box::into_raw(Box::new(o)),
8480                 },
8481                 result_ok: true,
8482         }
8483 }
8484 #[no_mangle]
8485 /// Creates a new CResult_TransactionNoneZ in the error state.
8486 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8487         CResult_TransactionNoneZ {
8488                 contents: CResult_TransactionNoneZPtr {
8489                         err: core::ptr::null_mut(),
8490                 },
8491                 result_ok: false,
8492         }
8493 }
8494 /// Checks if the given object is currently in the success state
8495 #[no_mangle]
8496 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
8497         o.result_ok
8498 }
8499 #[no_mangle]
8500 /// Frees any resources used by the CResult_TransactionNoneZ.
8501 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8502 impl Drop for CResult_TransactionNoneZ {
8503         fn drop(&mut self) {
8504                 if self.result_ok {
8505                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8506                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8507                         }
8508                 } else {
8509                 }
8510         }
8511 }
8512 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
8513         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
8514                 let contents = if o.result_ok {
8515                         let result = unsafe { o.contents.result };
8516                         unsafe { o.contents.result = core::ptr::null_mut() };
8517                         CResult_TransactionNoneZPtr { result }
8518                 } else {
8519                         let _ = unsafe { Box::from_raw(o.contents.err) };
8520                         o.contents.err = core::ptr::null_mut();
8521                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
8522                 };
8523                 Self {
8524                         contents,
8525                         result_ok: o.result_ok,
8526                 }
8527         }
8528 }
8529 impl Clone for CResult_TransactionNoneZ {
8530         fn clone(&self) -> Self {
8531                 if self.result_ok {
8532                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
8533                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
8534                         } }
8535                 } else {
8536                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
8537                                 err: core::ptr::null_mut()
8538                         } }
8539                 }
8540         }
8541 }
8542 #[no_mangle]
8543 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8544 /// but with all dynamically-allocated buffers duplicated in new buffers.
8545 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8546 #[repr(C)]
8547 /// A tuple of 2 elements. See the individual fields for the types contained.
8548 pub struct C2Tuple_BlockHashChannelMonitorZ {
8549         /// The element at position 0
8550         pub a: crate::c_types::ThirtyTwoBytes,
8551         /// The element at position 1
8552         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8553 }
8554 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8555         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8556                 Self {
8557                         a: tup.0,
8558                         b: tup.1,
8559                 }
8560         }
8561 }
8562 impl C2Tuple_BlockHashChannelMonitorZ {
8563         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8564                 (self.a, self.b)
8565         }
8566 }
8567 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8568 #[no_mangle]
8569 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8570         C2Tuple_BlockHashChannelMonitorZ { a, b, }
8571 }
8572
8573 #[no_mangle]
8574 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8575 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8576 #[repr(C)]
8577 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8578 /// This corresponds to std::vector in C++
8579 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8580         /// The elements in the array.
8581         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8582         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8583         /// The number of elements pointed to by `data`.
8584         pub datalen: usize
8585 }
8586 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8587         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8588                 if self.datalen == 0 { return Vec::new(); }
8589                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8590                 self.data = core::ptr::null_mut();
8591                 self.datalen = 0;
8592                 ret
8593         }
8594         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8595                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8596         }
8597 }
8598 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8599         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8600                 let datalen = v.len();
8601                 let data = Box::into_raw(v.into_boxed_slice());
8602                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8603         }
8604 }
8605 #[no_mangle]
8606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8607 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8608 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8609         fn drop(&mut self) {
8610                 if self.datalen == 0 { return; }
8611                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8612         }
8613 }
8614 #[repr(C)]
8615 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8616 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8617         /// A pointer to the contents in the success state.
8618         /// Reading from this pointer when `result_ok` is not set is undefined.
8619         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8620         /// A pointer to the contents in the error state.
8621         /// Reading from this pointer when `result_ok` is set is undefined.
8622         pub err: *mut crate::c_types::IOError,
8623 }
8624 #[repr(C)]
8625 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8626 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8628 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8629         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8630         /// `err` or `result` depending on the state of `result_ok`.
8631         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8632         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8633         pub result_ok: bool,
8634 }
8635 #[no_mangle]
8636 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8637 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8638         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8639                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8640                         result: Box::into_raw(Box::new(o)),
8641                 },
8642                 result_ok: true,
8643         }
8644 }
8645 #[no_mangle]
8646 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8647 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8648         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8649                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8650                         err: Box::into_raw(Box::new(e)),
8651                 },
8652                 result_ok: false,
8653         }
8654 }
8655 /// Checks if the given object is currently in the success state
8656 #[no_mangle]
8657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8658         o.result_ok
8659 }
8660 #[no_mangle]
8661 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8662 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8663 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8664         fn drop(&mut self) {
8665                 if self.result_ok {
8666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8668                         }
8669                 } else {
8670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8672                         }
8673                 }
8674         }
8675 }
8676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8677         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8678                 let contents = if o.result_ok {
8679                         let result = unsafe { o.contents.result };
8680                         unsafe { o.contents.result = core::ptr::null_mut() };
8681                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8682                 } else {
8683                         let err = unsafe { o.contents.err };
8684                         unsafe { o.contents.err = core::ptr::null_mut(); }
8685                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8686                 };
8687                 Self {
8688                         contents,
8689                         result_ok: o.result_ok,
8690                 }
8691         }
8692 }
8693 #[repr(C)]
8694 #[derive(Clone)]
8695 /// An enum which can either contain a u16 or not
8696 pub enum COption_u16Z {
8697         /// When we're in this state, this COption_u16Z contains a u16
8698         Some(u16),
8699         /// When we're in this state, this COption_u16Z contains nothing
8700         None
8701 }
8702 impl COption_u16Z {
8703         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8704                 if let Self::None = self { false } else { true }
8705         }
8706         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8707                 !self.is_some()
8708         }
8709         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8710                 if let Self::Some(v) = self { v } else { unreachable!() }
8711         }
8712 }
8713 #[no_mangle]
8714 /// Constructs a new COption_u16Z containing a u16
8715 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8716         COption_u16Z::Some(o)
8717 }
8718 #[no_mangle]
8719 /// Constructs a new COption_u16Z containing nothing
8720 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8721         COption_u16Z::None
8722 }
8723 #[no_mangle]
8724 /// Frees any resources associated with the u16, if we are in the Some state
8725 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8726 #[no_mangle]
8727 /// Creates a new COption_u16Z which has the same data as `orig`
8728 /// but with all dynamically-allocated buffers duplicated in new buffers.
8729 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8730 #[repr(C)]
8731 /// The contents of CResult__u832APIErrorZ
8732 pub union CResult__u832APIErrorZPtr {
8733         /// A pointer to the contents in the success state.
8734         /// Reading from this pointer when `result_ok` is not set is undefined.
8735         pub result: *mut crate::c_types::ThirtyTwoBytes,
8736         /// A pointer to the contents in the error state.
8737         /// Reading from this pointer when `result_ok` is set is undefined.
8738         pub err: *mut crate::lightning::util::errors::APIError,
8739 }
8740 #[repr(C)]
8741 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8742 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8744 pub struct CResult__u832APIErrorZ {
8745         /// The contents of this CResult__u832APIErrorZ, accessible via either
8746         /// `err` or `result` depending on the state of `result_ok`.
8747         pub contents: CResult__u832APIErrorZPtr,
8748         /// Whether this CResult__u832APIErrorZ represents a success state.
8749         pub result_ok: bool,
8750 }
8751 #[no_mangle]
8752 /// Creates a new CResult__u832APIErrorZ in the success state.
8753 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8754         CResult__u832APIErrorZ {
8755                 contents: CResult__u832APIErrorZPtr {
8756                         result: Box::into_raw(Box::new(o)),
8757                 },
8758                 result_ok: true,
8759         }
8760 }
8761 #[no_mangle]
8762 /// Creates a new CResult__u832APIErrorZ in the error state.
8763 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8764         CResult__u832APIErrorZ {
8765                 contents: CResult__u832APIErrorZPtr {
8766                         err: Box::into_raw(Box::new(e)),
8767                 },
8768                 result_ok: false,
8769         }
8770 }
8771 /// Checks if the given object is currently in the success state
8772 #[no_mangle]
8773 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8774         o.result_ok
8775 }
8776 #[no_mangle]
8777 /// Frees any resources used by the CResult__u832APIErrorZ.
8778 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8779 impl Drop for CResult__u832APIErrorZ {
8780         fn drop(&mut self) {
8781                 if self.result_ok {
8782                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8783                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8784                         }
8785                 } else {
8786                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8787                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8788                         }
8789                 }
8790         }
8791 }
8792 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8793         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8794                 let contents = if o.result_ok {
8795                         let result = unsafe { o.contents.result };
8796                         unsafe { o.contents.result = core::ptr::null_mut() };
8797                         CResult__u832APIErrorZPtr { result }
8798                 } else {
8799                         let err = unsafe { o.contents.err };
8800                         unsafe { o.contents.err = core::ptr::null_mut(); }
8801                         CResult__u832APIErrorZPtr { err }
8802                 };
8803                 Self {
8804                         contents,
8805                         result_ok: o.result_ok,
8806                 }
8807         }
8808 }
8809 impl Clone for CResult__u832APIErrorZ {
8810         fn clone(&self) -> Self {
8811                 if self.result_ok {
8812                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8813                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8814                         } }
8815                 } else {
8816                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8817                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8818                         } }
8819                 }
8820         }
8821 }
8822 #[no_mangle]
8823 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8824 /// but with all dynamically-allocated buffers duplicated in new buffers.
8825 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8826 #[repr(C)]
8827 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8828 /// This corresponds to std::vector in C++
8829 pub struct CVec_RecentPaymentDetailsZ {
8830         /// The elements in the array.
8831         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8832         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8833         /// The number of elements pointed to by `data`.
8834         pub datalen: usize
8835 }
8836 impl CVec_RecentPaymentDetailsZ {
8837         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8838                 if self.datalen == 0 { return Vec::new(); }
8839                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8840                 self.data = core::ptr::null_mut();
8841                 self.datalen = 0;
8842                 ret
8843         }
8844         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8845                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8846         }
8847 }
8848 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8849         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8850                 let datalen = v.len();
8851                 let data = Box::into_raw(v.into_boxed_slice());
8852                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8853         }
8854 }
8855 #[no_mangle]
8856 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8857 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8858 impl Drop for CVec_RecentPaymentDetailsZ {
8859         fn drop(&mut self) {
8860                 if self.datalen == 0 { return; }
8861                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8862         }
8863 }
8864 #[repr(C)]
8865 /// The contents of CResult_NonePaymentSendFailureZ
8866 pub union CResult_NonePaymentSendFailureZPtr {
8867         /// Note that this value is always NULL, as there are no contents in the OK variant
8868         pub result: *mut core::ffi::c_void,
8869         /// A pointer to the contents in the error state.
8870         /// Reading from this pointer when `result_ok` is set is undefined.
8871         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8872 }
8873 #[repr(C)]
8874 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8875 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8877 pub struct CResult_NonePaymentSendFailureZ {
8878         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8879         /// `err` or `result` depending on the state of `result_ok`.
8880         pub contents: CResult_NonePaymentSendFailureZPtr,
8881         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8882         pub result_ok: bool,
8883 }
8884 #[no_mangle]
8885 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8886 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8887         CResult_NonePaymentSendFailureZ {
8888                 contents: CResult_NonePaymentSendFailureZPtr {
8889                         result: core::ptr::null_mut(),
8890                 },
8891                 result_ok: true,
8892         }
8893 }
8894 #[no_mangle]
8895 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8896 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8897         CResult_NonePaymentSendFailureZ {
8898                 contents: CResult_NonePaymentSendFailureZPtr {
8899                         err: Box::into_raw(Box::new(e)),
8900                 },
8901                 result_ok: false,
8902         }
8903 }
8904 /// Checks if the given object is currently in the success state
8905 #[no_mangle]
8906 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8907         o.result_ok
8908 }
8909 #[no_mangle]
8910 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8911 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8912 impl Drop for CResult_NonePaymentSendFailureZ {
8913         fn drop(&mut self) {
8914                 if self.result_ok {
8915                 } else {
8916                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8917                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8918                         }
8919                 }
8920         }
8921 }
8922 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8923         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8924                 let contents = if o.result_ok {
8925                         let _ = unsafe { Box::from_raw(o.contents.result) };
8926                         o.contents.result = core::ptr::null_mut();
8927                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8928                 } else {
8929                         let err = unsafe { o.contents.err };
8930                         unsafe { o.contents.err = core::ptr::null_mut(); }
8931                         CResult_NonePaymentSendFailureZPtr { err }
8932                 };
8933                 Self {
8934                         contents,
8935                         result_ok: o.result_ok,
8936                 }
8937         }
8938 }
8939 impl Clone for CResult_NonePaymentSendFailureZ {
8940         fn clone(&self) -> Self {
8941                 if self.result_ok {
8942                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8943                                 result: core::ptr::null_mut()
8944                         } }
8945                 } else {
8946                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8947                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8948                         } }
8949                 }
8950         }
8951 }
8952 #[no_mangle]
8953 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8954 /// but with all dynamically-allocated buffers duplicated in new buffers.
8955 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8956 #[repr(C)]
8957 /// The contents of CResult_NoneRetryableSendFailureZ
8958 pub union CResult_NoneRetryableSendFailureZPtr {
8959         /// Note that this value is always NULL, as there are no contents in the OK variant
8960         pub result: *mut core::ffi::c_void,
8961         /// A pointer to the contents in the error state.
8962         /// Reading from this pointer when `result_ok` is set is undefined.
8963         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8964 }
8965 #[repr(C)]
8966 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8967 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8969 pub struct CResult_NoneRetryableSendFailureZ {
8970         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8971         /// `err` or `result` depending on the state of `result_ok`.
8972         pub contents: CResult_NoneRetryableSendFailureZPtr,
8973         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8974         pub result_ok: bool,
8975 }
8976 #[no_mangle]
8977 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8978 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8979         CResult_NoneRetryableSendFailureZ {
8980                 contents: CResult_NoneRetryableSendFailureZPtr {
8981                         result: core::ptr::null_mut(),
8982                 },
8983                 result_ok: true,
8984         }
8985 }
8986 #[no_mangle]
8987 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8988 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8989         CResult_NoneRetryableSendFailureZ {
8990                 contents: CResult_NoneRetryableSendFailureZPtr {
8991                         err: Box::into_raw(Box::new(e)),
8992                 },
8993                 result_ok: false,
8994         }
8995 }
8996 /// Checks if the given object is currently in the success state
8997 #[no_mangle]
8998 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8999         o.result_ok
9000 }
9001 #[no_mangle]
9002 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9003 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9004 impl Drop for CResult_NoneRetryableSendFailureZ {
9005         fn drop(&mut self) {
9006                 if self.result_ok {
9007                 } else {
9008                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9009                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9010                         }
9011                 }
9012         }
9013 }
9014 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9015         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9016                 let contents = if o.result_ok {
9017                         let _ = unsafe { Box::from_raw(o.contents.result) };
9018                         o.contents.result = core::ptr::null_mut();
9019                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9020                 } else {
9021                         let err = unsafe { o.contents.err };
9022                         unsafe { o.contents.err = core::ptr::null_mut(); }
9023                         CResult_NoneRetryableSendFailureZPtr { err }
9024                 };
9025                 Self {
9026                         contents,
9027                         result_ok: o.result_ok,
9028                 }
9029         }
9030 }
9031 impl Clone for CResult_NoneRetryableSendFailureZ {
9032         fn clone(&self) -> Self {
9033                 if self.result_ok {
9034                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9035                                 result: core::ptr::null_mut()
9036                         } }
9037                 } else {
9038                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9039                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9040                         } }
9041                 }
9042         }
9043 }
9044 #[no_mangle]
9045 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9046 /// but with all dynamically-allocated buffers duplicated in new buffers.
9047 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9048 #[repr(C)]
9049 /// The contents of CResult_PaymentHashPaymentSendFailureZ
9050 pub union CResult_PaymentHashPaymentSendFailureZPtr {
9051         /// A pointer to the contents in the success state.
9052         /// Reading from this pointer when `result_ok` is not set is undefined.
9053         pub result: *mut crate::c_types::ThirtyTwoBytes,
9054         /// A pointer to the contents in the error state.
9055         /// Reading from this pointer when `result_ok` is set is undefined.
9056         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9057 }
9058 #[repr(C)]
9059 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
9060 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9062 pub struct CResult_PaymentHashPaymentSendFailureZ {
9063         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
9064         /// `err` or `result` depending on the state of `result_ok`.
9065         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
9066         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
9067         pub result_ok: bool,
9068 }
9069 #[no_mangle]
9070 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
9071 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
9072         CResult_PaymentHashPaymentSendFailureZ {
9073                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9074                         result: Box::into_raw(Box::new(o)),
9075                 },
9076                 result_ok: true,
9077         }
9078 }
9079 #[no_mangle]
9080 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
9081 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
9082         CResult_PaymentHashPaymentSendFailureZ {
9083                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9084                         err: Box::into_raw(Box::new(e)),
9085                 },
9086                 result_ok: false,
9087         }
9088 }
9089 /// Checks if the given object is currently in the success state
9090 #[no_mangle]
9091 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
9092         o.result_ok
9093 }
9094 #[no_mangle]
9095 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
9096 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
9097 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
9098         fn drop(&mut self) {
9099                 if self.result_ok {
9100                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9101                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9102                         }
9103                 } else {
9104                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9105                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9106                         }
9107                 }
9108         }
9109 }
9110 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
9111         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9112                 let contents = if o.result_ok {
9113                         let result = unsafe { o.contents.result };
9114                         unsafe { o.contents.result = core::ptr::null_mut() };
9115                         CResult_PaymentHashPaymentSendFailureZPtr { result }
9116                 } else {
9117                         let err = unsafe { o.contents.err };
9118                         unsafe { o.contents.err = core::ptr::null_mut(); }
9119                         CResult_PaymentHashPaymentSendFailureZPtr { err }
9120                 };
9121                 Self {
9122                         contents,
9123                         result_ok: o.result_ok,
9124                 }
9125         }
9126 }
9127 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
9128         fn clone(&self) -> Self {
9129                 if self.result_ok {
9130                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9131                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9132                         } }
9133                 } else {
9134                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9135                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9136                         } }
9137                 }
9138         }
9139 }
9140 #[no_mangle]
9141 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
9142 /// but with all dynamically-allocated buffers duplicated in new buffers.
9143 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
9144 #[repr(C)]
9145 /// The contents of CResult_PaymentHashRetryableSendFailureZ
9146 pub union CResult_PaymentHashRetryableSendFailureZPtr {
9147         /// A pointer to the contents in the success state.
9148         /// Reading from this pointer when `result_ok` is not set is undefined.
9149         pub result: *mut crate::c_types::ThirtyTwoBytes,
9150         /// A pointer to the contents in the error state.
9151         /// Reading from this pointer when `result_ok` is set is undefined.
9152         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9153 }
9154 #[repr(C)]
9155 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
9156 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9158 pub struct CResult_PaymentHashRetryableSendFailureZ {
9159         /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
9160         /// `err` or `result` depending on the state of `result_ok`.
9161         pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
9162         /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
9163         pub result_ok: bool,
9164 }
9165 #[no_mangle]
9166 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
9167 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
9168         CResult_PaymentHashRetryableSendFailureZ {
9169                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9170                         result: Box::into_raw(Box::new(o)),
9171                 },
9172                 result_ok: true,
9173         }
9174 }
9175 #[no_mangle]
9176 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
9177 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
9178         CResult_PaymentHashRetryableSendFailureZ {
9179                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9180                         err: Box::into_raw(Box::new(e)),
9181                 },
9182                 result_ok: false,
9183         }
9184 }
9185 /// Checks if the given object is currently in the success state
9186 #[no_mangle]
9187 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
9188         o.result_ok
9189 }
9190 #[no_mangle]
9191 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
9192 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
9193 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
9194         fn drop(&mut self) {
9195                 if self.result_ok {
9196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9198                         }
9199                 } else {
9200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9202                         }
9203                 }
9204         }
9205 }
9206 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
9207         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9208                 let contents = if o.result_ok {
9209                         let result = unsafe { o.contents.result };
9210                         unsafe { o.contents.result = core::ptr::null_mut() };
9211                         CResult_PaymentHashRetryableSendFailureZPtr { result }
9212                 } else {
9213                         let err = unsafe { o.contents.err };
9214                         unsafe { o.contents.err = core::ptr::null_mut(); }
9215                         CResult_PaymentHashRetryableSendFailureZPtr { err }
9216                 };
9217                 Self {
9218                         contents,
9219                         result_ok: o.result_ok,
9220                 }
9221         }
9222 }
9223 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
9224         fn clone(&self) -> Self {
9225                 if self.result_ok {
9226                         Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9227                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9228                         } }
9229                 } else {
9230                         Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9232                         } }
9233                 }
9234         }
9235 }
9236 #[no_mangle]
9237 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
9238 /// but with all dynamically-allocated buffers duplicated in new buffers.
9239 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
9240 #[repr(C)]
9241 /// A tuple of 2 elements. See the individual fields for the types contained.
9242 pub struct C2Tuple_PaymentHashPaymentIdZ {
9243         /// The element at position 0
9244         pub a: crate::c_types::ThirtyTwoBytes,
9245         /// The element at position 1
9246         pub b: crate::c_types::ThirtyTwoBytes,
9247 }
9248 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
9249         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9250                 Self {
9251                         a: tup.0,
9252                         b: tup.1,
9253                 }
9254         }
9255 }
9256 impl C2Tuple_PaymentHashPaymentIdZ {
9257         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9258                 (self.a, self.b)
9259         }
9260 }
9261 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
9262         fn clone(&self) -> Self {
9263                 Self {
9264                         a: Clone::clone(&self.a),
9265                         b: Clone::clone(&self.b),
9266                 }
9267         }
9268 }
9269 #[no_mangle]
9270 /// Creates a new tuple which has the same data as `orig`
9271 /// but with all dynamically-allocated buffers duplicated in new buffers.
9272 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
9273 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
9274 #[no_mangle]
9275 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
9276         C2Tuple_PaymentHashPaymentIdZ { a, b, }
9277 }
9278
9279 #[no_mangle]
9280 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
9281 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
9282 #[repr(C)]
9283 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
9284 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9285         /// A pointer to the contents in the success state.
9286         /// Reading from this pointer when `result_ok` is not set is undefined.
9287         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
9288         /// A pointer to the contents in the error state.
9289         /// Reading from this pointer when `result_ok` is set is undefined.
9290         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9291 }
9292 #[repr(C)]
9293 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
9294 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9296 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9297         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
9298         /// `err` or `result` depending on the state of `result_ok`.
9299         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
9300         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
9301         pub result_ok: bool,
9302 }
9303 #[no_mangle]
9304 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
9305 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9306         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9307                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9308                         result: Box::into_raw(Box::new(o)),
9309                 },
9310                 result_ok: true,
9311         }
9312 }
9313 #[no_mangle]
9314 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
9315 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9316         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9317                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9318                         err: Box::into_raw(Box::new(e)),
9319                 },
9320                 result_ok: false,
9321         }
9322 }
9323 /// Checks if the given object is currently in the success state
9324 #[no_mangle]
9325 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
9326         o.result_ok
9327 }
9328 #[no_mangle]
9329 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
9330 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
9331 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9332         fn drop(&mut self) {
9333                 if self.result_ok {
9334                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9335                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9336                         }
9337                 } else {
9338                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9339                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9340                         }
9341                 }
9342         }
9343 }
9344 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9345         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9346                 let contents = if o.result_ok {
9347                         let result = unsafe { o.contents.result };
9348                         unsafe { o.contents.result = core::ptr::null_mut() };
9349                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
9350                 } else {
9351                         let err = unsafe { o.contents.err };
9352                         unsafe { o.contents.err = core::ptr::null_mut(); }
9353                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
9354                 };
9355                 Self {
9356                         contents,
9357                         result_ok: o.result_ok,
9358                 }
9359         }
9360 }
9361 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9362         fn clone(&self) -> Self {
9363                 if self.result_ok {
9364                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9365                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
9366                         } }
9367                 } else {
9368                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9369                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9370                         } }
9371                 }
9372         }
9373 }
9374 #[no_mangle]
9375 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
9376 /// but with all dynamically-allocated buffers duplicated in new buffers.
9377 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
9378 #[repr(C)]
9379 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
9380 /// This corresponds to std::vector in C++
9381 pub struct CVec_ThirtyTwoBytesZ {
9382         /// The elements in the array.
9383         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9384         pub data: *mut crate::c_types::ThirtyTwoBytes,
9385         /// The number of elements pointed to by `data`.
9386         pub datalen: usize
9387 }
9388 impl CVec_ThirtyTwoBytesZ {
9389         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
9390                 if self.datalen == 0 { return Vec::new(); }
9391                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9392                 self.data = core::ptr::null_mut();
9393                 self.datalen = 0;
9394                 ret
9395         }
9396         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
9397                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9398         }
9399 }
9400 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
9401         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
9402                 let datalen = v.len();
9403                 let data = Box::into_raw(v.into_boxed_slice());
9404                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9405         }
9406 }
9407 #[no_mangle]
9408 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9409 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
9410 impl Drop for CVec_ThirtyTwoBytesZ {
9411         fn drop(&mut self) {
9412                 if self.datalen == 0 { return; }
9413                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9414         }
9415 }
9416 impl Clone for CVec_ThirtyTwoBytesZ {
9417         fn clone(&self) -> Self {
9418                 let mut res = Vec::new();
9419                 if self.datalen == 0 { return Self::from(res); }
9420                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9421                 Self::from(res)
9422         }
9423 }
9424 #[repr(C)]
9425 /// A tuple of 2 elements. See the individual fields for the types contained.
9426 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9427         /// The element at position 0
9428         pub a: crate::c_types::ThirtyTwoBytes,
9429         /// The element at position 1
9430         pub b: crate::c_types::ThirtyTwoBytes,
9431 }
9432 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9433         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9434                 Self {
9435                         a: tup.0,
9436                         b: tup.1,
9437                 }
9438         }
9439 }
9440 impl C2Tuple_PaymentHashPaymentSecretZ {
9441         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9442                 (self.a, self.b)
9443         }
9444 }
9445 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
9446         fn clone(&self) -> Self {
9447                 Self {
9448                         a: Clone::clone(&self.a),
9449                         b: Clone::clone(&self.b),
9450                 }
9451         }
9452 }
9453 #[no_mangle]
9454 /// Creates a new tuple which has the same data as `orig`
9455 /// but with all dynamically-allocated buffers duplicated in new buffers.
9456 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
9457 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9458 #[no_mangle]
9459 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9460         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9461 }
9462
9463 #[no_mangle]
9464 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9465 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9466 #[repr(C)]
9467 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
9468 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9469         /// A pointer to the contents in the success state.
9470         /// Reading from this pointer when `result_ok` is not set is undefined.
9471         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9472         /// Note that this value is always NULL, as there are no contents in the Err variant
9473         pub err: *mut core::ffi::c_void,
9474 }
9475 #[repr(C)]
9476 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
9477 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
9478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9479 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9480         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
9481         /// `err` or `result` depending on the state of `result_ok`.
9482         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
9483         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
9484         pub result_ok: bool,
9485 }
9486 #[no_mangle]
9487 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
9488 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9489         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9490                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9491                         result: Box::into_raw(Box::new(o)),
9492                 },
9493                 result_ok: true,
9494         }
9495 }
9496 #[no_mangle]
9497 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
9498 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9499         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9500                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9501                         err: core::ptr::null_mut(),
9502                 },
9503                 result_ok: false,
9504         }
9505 }
9506 /// Checks if the given object is currently in the success state
9507 #[no_mangle]
9508 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
9509         o.result_ok
9510 }
9511 #[no_mangle]
9512 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
9513 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
9514 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9515         fn drop(&mut self) {
9516                 if self.result_ok {
9517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9519                         }
9520                 } else {
9521                 }
9522         }
9523 }
9524 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9525         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
9526                 let contents = if o.result_ok {
9527                         let result = unsafe { o.contents.result };
9528                         unsafe { o.contents.result = core::ptr::null_mut() };
9529                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
9530                 } else {
9531                         let _ = unsafe { Box::from_raw(o.contents.err) };
9532                         o.contents.err = core::ptr::null_mut();
9533                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
9534                 };
9535                 Self {
9536                         contents,
9537                         result_ok: o.result_ok,
9538                 }
9539         }
9540 }
9541 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9542         fn clone(&self) -> Self {
9543                 if self.result_ok {
9544                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9545                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9546                         } }
9547                 } else {
9548                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9549                                 err: core::ptr::null_mut()
9550                         } }
9551                 }
9552         }
9553 }
9554 #[no_mangle]
9555 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9556 /// but with all dynamically-allocated buffers duplicated in new buffers.
9557 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9558 #[repr(C)]
9559 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9560 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9561         /// A pointer to the contents in the success state.
9562         /// Reading from this pointer when `result_ok` is not set is undefined.
9563         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9564         /// A pointer to the contents in the error state.
9565         /// Reading from this pointer when `result_ok` is set is undefined.
9566         pub err: *mut crate::lightning::util::errors::APIError,
9567 }
9568 #[repr(C)]
9569 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9570 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9572 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9573         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9574         /// `err` or `result` depending on the state of `result_ok`.
9575         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9576         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9577         pub result_ok: bool,
9578 }
9579 #[no_mangle]
9580 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9581 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9582         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9583                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9584                         result: Box::into_raw(Box::new(o)),
9585                 },
9586                 result_ok: true,
9587         }
9588 }
9589 #[no_mangle]
9590 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9591 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9592         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9593                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9594                         err: Box::into_raw(Box::new(e)),
9595                 },
9596                 result_ok: false,
9597         }
9598 }
9599 /// Checks if the given object is currently in the success state
9600 #[no_mangle]
9601 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9602         o.result_ok
9603 }
9604 #[no_mangle]
9605 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9606 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9607 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9608         fn drop(&mut self) {
9609                 if self.result_ok {
9610                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9611                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9612                         }
9613                 } else {
9614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9616                         }
9617                 }
9618         }
9619 }
9620 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9621         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9622                 let contents = if o.result_ok {
9623                         let result = unsafe { o.contents.result };
9624                         unsafe { o.contents.result = core::ptr::null_mut() };
9625                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9626                 } else {
9627                         let err = unsafe { o.contents.err };
9628                         unsafe { o.contents.err = core::ptr::null_mut(); }
9629                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9630                 };
9631                 Self {
9632                         contents,
9633                         result_ok: o.result_ok,
9634                 }
9635         }
9636 }
9637 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9638         fn clone(&self) -> Self {
9639                 if self.result_ok {
9640                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9641                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9642                         } }
9643                 } else {
9644                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9645                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9646                         } }
9647                 }
9648         }
9649 }
9650 #[no_mangle]
9651 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9652 /// but with all dynamically-allocated buffers duplicated in new buffers.
9653 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9654 #[repr(C)]
9655 /// The contents of CResult_PaymentSecretNoneZ
9656 pub union CResult_PaymentSecretNoneZPtr {
9657         /// A pointer to the contents in the success state.
9658         /// Reading from this pointer when `result_ok` is not set is undefined.
9659         pub result: *mut crate::c_types::ThirtyTwoBytes,
9660         /// Note that this value is always NULL, as there are no contents in the Err variant
9661         pub err: *mut core::ffi::c_void,
9662 }
9663 #[repr(C)]
9664 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9665 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9667 pub struct CResult_PaymentSecretNoneZ {
9668         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9669         /// `err` or `result` depending on the state of `result_ok`.
9670         pub contents: CResult_PaymentSecretNoneZPtr,
9671         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9672         pub result_ok: bool,
9673 }
9674 #[no_mangle]
9675 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9676 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9677         CResult_PaymentSecretNoneZ {
9678                 contents: CResult_PaymentSecretNoneZPtr {
9679                         result: Box::into_raw(Box::new(o)),
9680                 },
9681                 result_ok: true,
9682         }
9683 }
9684 #[no_mangle]
9685 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9686 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9687         CResult_PaymentSecretNoneZ {
9688                 contents: CResult_PaymentSecretNoneZPtr {
9689                         err: core::ptr::null_mut(),
9690                 },
9691                 result_ok: false,
9692         }
9693 }
9694 /// Checks if the given object is currently in the success state
9695 #[no_mangle]
9696 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9697         o.result_ok
9698 }
9699 #[no_mangle]
9700 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9701 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9702 impl Drop for CResult_PaymentSecretNoneZ {
9703         fn drop(&mut self) {
9704                 if self.result_ok {
9705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9707                         }
9708                 } else {
9709                 }
9710         }
9711 }
9712 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9713         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9714                 let contents = if o.result_ok {
9715                         let result = unsafe { o.contents.result };
9716                         unsafe { o.contents.result = core::ptr::null_mut() };
9717                         CResult_PaymentSecretNoneZPtr { result }
9718                 } else {
9719                         let _ = unsafe { Box::from_raw(o.contents.err) };
9720                         o.contents.err = core::ptr::null_mut();
9721                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9722                 };
9723                 Self {
9724                         contents,
9725                         result_ok: o.result_ok,
9726                 }
9727         }
9728 }
9729 impl Clone for CResult_PaymentSecretNoneZ {
9730         fn clone(&self) -> Self {
9731                 if self.result_ok {
9732                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9733                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9734                         } }
9735                 } else {
9736                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9737                                 err: core::ptr::null_mut()
9738                         } }
9739                 }
9740         }
9741 }
9742 #[no_mangle]
9743 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9744 /// but with all dynamically-allocated buffers duplicated in new buffers.
9745 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9746 #[repr(C)]
9747 /// The contents of CResult_PaymentSecretAPIErrorZ
9748 pub union CResult_PaymentSecretAPIErrorZPtr {
9749         /// A pointer to the contents in the success state.
9750         /// Reading from this pointer when `result_ok` is not set is undefined.
9751         pub result: *mut crate::c_types::ThirtyTwoBytes,
9752         /// A pointer to the contents in the error state.
9753         /// Reading from this pointer when `result_ok` is set is undefined.
9754         pub err: *mut crate::lightning::util::errors::APIError,
9755 }
9756 #[repr(C)]
9757 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9758 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9760 pub struct CResult_PaymentSecretAPIErrorZ {
9761         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9762         /// `err` or `result` depending on the state of `result_ok`.
9763         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9764         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9765         pub result_ok: bool,
9766 }
9767 #[no_mangle]
9768 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9769 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9770         CResult_PaymentSecretAPIErrorZ {
9771                 contents: CResult_PaymentSecretAPIErrorZPtr {
9772                         result: Box::into_raw(Box::new(o)),
9773                 },
9774                 result_ok: true,
9775         }
9776 }
9777 #[no_mangle]
9778 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9779 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9780         CResult_PaymentSecretAPIErrorZ {
9781                 contents: CResult_PaymentSecretAPIErrorZPtr {
9782                         err: Box::into_raw(Box::new(e)),
9783                 },
9784                 result_ok: false,
9785         }
9786 }
9787 /// Checks if the given object is currently in the success state
9788 #[no_mangle]
9789 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9790         o.result_ok
9791 }
9792 #[no_mangle]
9793 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9794 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9795 impl Drop for CResult_PaymentSecretAPIErrorZ {
9796         fn drop(&mut self) {
9797                 if self.result_ok {
9798                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9799                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9800                         }
9801                 } else {
9802                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9803                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9804                         }
9805                 }
9806         }
9807 }
9808 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9809         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9810                 let contents = if o.result_ok {
9811                         let result = unsafe { o.contents.result };
9812                         unsafe { o.contents.result = core::ptr::null_mut() };
9813                         CResult_PaymentSecretAPIErrorZPtr { result }
9814                 } else {
9815                         let err = unsafe { o.contents.err };
9816                         unsafe { o.contents.err = core::ptr::null_mut(); }
9817                         CResult_PaymentSecretAPIErrorZPtr { err }
9818                 };
9819                 Self {
9820                         contents,
9821                         result_ok: o.result_ok,
9822                 }
9823         }
9824 }
9825 impl Clone for CResult_PaymentSecretAPIErrorZ {
9826         fn clone(&self) -> Self {
9827                 if self.result_ok {
9828                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9829                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9830                         } }
9831                 } else {
9832                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9833                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9834                         } }
9835                 }
9836         }
9837 }
9838 #[no_mangle]
9839 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9840 /// but with all dynamically-allocated buffers duplicated in new buffers.
9841 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9842 #[repr(C)]
9843 /// The contents of CResult_PaymentPreimageAPIErrorZ
9844 pub union CResult_PaymentPreimageAPIErrorZPtr {
9845         /// A pointer to the contents in the success state.
9846         /// Reading from this pointer when `result_ok` is not set is undefined.
9847         pub result: *mut crate::c_types::ThirtyTwoBytes,
9848         /// A pointer to the contents in the error state.
9849         /// Reading from this pointer when `result_ok` is set is undefined.
9850         pub err: *mut crate::lightning::util::errors::APIError,
9851 }
9852 #[repr(C)]
9853 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9854 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9856 pub struct CResult_PaymentPreimageAPIErrorZ {
9857         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9858         /// `err` or `result` depending on the state of `result_ok`.
9859         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9860         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9861         pub result_ok: bool,
9862 }
9863 #[no_mangle]
9864 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9865 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9866         CResult_PaymentPreimageAPIErrorZ {
9867                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9868                         result: Box::into_raw(Box::new(o)),
9869                 },
9870                 result_ok: true,
9871         }
9872 }
9873 #[no_mangle]
9874 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9875 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9876         CResult_PaymentPreimageAPIErrorZ {
9877                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9878                         err: Box::into_raw(Box::new(e)),
9879                 },
9880                 result_ok: false,
9881         }
9882 }
9883 /// Checks if the given object is currently in the success state
9884 #[no_mangle]
9885 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9886         o.result_ok
9887 }
9888 #[no_mangle]
9889 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9890 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9891 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9892         fn drop(&mut self) {
9893                 if self.result_ok {
9894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9896                         }
9897                 } else {
9898                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9899                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9900                         }
9901                 }
9902         }
9903 }
9904 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9905         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9906                 let contents = if o.result_ok {
9907                         let result = unsafe { o.contents.result };
9908                         unsafe { o.contents.result = core::ptr::null_mut() };
9909                         CResult_PaymentPreimageAPIErrorZPtr { result }
9910                 } else {
9911                         let err = unsafe { o.contents.err };
9912                         unsafe { o.contents.err = core::ptr::null_mut(); }
9913                         CResult_PaymentPreimageAPIErrorZPtr { err }
9914                 };
9915                 Self {
9916                         contents,
9917                         result_ok: o.result_ok,
9918                 }
9919         }
9920 }
9921 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9922         fn clone(&self) -> Self {
9923                 if self.result_ok {
9924                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9925                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9926                         } }
9927                 } else {
9928                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9929                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9930                         } }
9931                 }
9932         }
9933 }
9934 #[no_mangle]
9935 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9936 /// but with all dynamically-allocated buffers duplicated in new buffers.
9937 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9938 #[repr(C)]
9939 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9940 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9941         /// A pointer to the contents in the success state.
9942         /// Reading from this pointer when `result_ok` is not set is undefined.
9943         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9944         /// A pointer to the contents in the error state.
9945         /// Reading from this pointer when `result_ok` is set is undefined.
9946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9947 }
9948 #[repr(C)]
9949 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9950 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9952 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9953         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9954         /// `err` or `result` depending on the state of `result_ok`.
9955         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9956         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9957         pub result_ok: bool,
9958 }
9959 #[no_mangle]
9960 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9961 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9962         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9963                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9964                         result: Box::into_raw(Box::new(o)),
9965                 },
9966                 result_ok: true,
9967         }
9968 }
9969 #[no_mangle]
9970 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9971 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9972         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9973                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9974                         err: Box::into_raw(Box::new(e)),
9975                 },
9976                 result_ok: false,
9977         }
9978 }
9979 /// Checks if the given object is currently in the success state
9980 #[no_mangle]
9981 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9982         o.result_ok
9983 }
9984 #[no_mangle]
9985 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9986 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9987 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9988         fn drop(&mut self) {
9989                 if self.result_ok {
9990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9992                         }
9993                 } else {
9994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9996                         }
9997                 }
9998         }
9999 }
10000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10002                 let contents = if o.result_ok {
10003                         let result = unsafe { o.contents.result };
10004                         unsafe { o.contents.result = core::ptr::null_mut() };
10005                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10006                 } else {
10007                         let err = unsafe { o.contents.err };
10008                         unsafe { o.contents.err = core::ptr::null_mut(); }
10009                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10010                 };
10011                 Self {
10012                         contents,
10013                         result_ok: o.result_ok,
10014                 }
10015         }
10016 }
10017 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10018         fn clone(&self) -> Self {
10019                 if self.result_ok {
10020                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10022                         } }
10023                 } else {
10024                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10026                         } }
10027                 }
10028         }
10029 }
10030 #[no_mangle]
10031 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10032 /// but with all dynamically-allocated buffers duplicated in new buffers.
10033 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10034 #[repr(C)]
10035 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10036 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10037         /// A pointer to the contents in the success state.
10038         /// Reading from this pointer when `result_ok` is not set is undefined.
10039         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10040         /// A pointer to the contents in the error state.
10041         /// Reading from this pointer when `result_ok` is set is undefined.
10042         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10043 }
10044 #[repr(C)]
10045 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10046 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10048 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10049         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10050         /// `err` or `result` depending on the state of `result_ok`.
10051         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10052         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10053         pub result_ok: bool,
10054 }
10055 #[no_mangle]
10056 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10057 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10058         CResult_ChannelCounterpartyDecodeErrorZ {
10059                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10060                         result: Box::into_raw(Box::new(o)),
10061                 },
10062                 result_ok: true,
10063         }
10064 }
10065 #[no_mangle]
10066 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10067 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10068         CResult_ChannelCounterpartyDecodeErrorZ {
10069                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10070                         err: Box::into_raw(Box::new(e)),
10071                 },
10072                 result_ok: false,
10073         }
10074 }
10075 /// Checks if the given object is currently in the success state
10076 #[no_mangle]
10077 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10078         o.result_ok
10079 }
10080 #[no_mangle]
10081 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10082 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10083 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10084         fn drop(&mut self) {
10085                 if self.result_ok {
10086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10088                         }
10089                 } else {
10090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10092                         }
10093                 }
10094         }
10095 }
10096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10097         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10098                 let contents = if o.result_ok {
10099                         let result = unsafe { o.contents.result };
10100                         unsafe { o.contents.result = core::ptr::null_mut() };
10101                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
10102                 } else {
10103                         let err = unsafe { o.contents.err };
10104                         unsafe { o.contents.err = core::ptr::null_mut(); }
10105                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
10106                 };
10107                 Self {
10108                         contents,
10109                         result_ok: o.result_ok,
10110                 }
10111         }
10112 }
10113 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
10114         fn clone(&self) -> Self {
10115                 if self.result_ok {
10116                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10117                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
10118                         } }
10119                 } else {
10120                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10121                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10122                         } }
10123                 }
10124         }
10125 }
10126 #[no_mangle]
10127 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
10128 /// but with all dynamically-allocated buffers duplicated in new buffers.
10129 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
10130 #[repr(C)]
10131 /// The contents of CResult_ChannelDetailsDecodeErrorZ
10132 pub union CResult_ChannelDetailsDecodeErrorZPtr {
10133         /// A pointer to the contents in the success state.
10134         /// Reading from this pointer when `result_ok` is not set is undefined.
10135         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
10136         /// A pointer to the contents in the error state.
10137         /// Reading from this pointer when `result_ok` is set is undefined.
10138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10139 }
10140 #[repr(C)]
10141 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10142 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_ChannelDetailsDecodeErrorZ {
10145         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10146         /// `err` or `result` depending on the state of `result_ok`.
10147         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10148         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10149         pub result_ok: bool,
10150 }
10151 #[no_mangle]
10152 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10153 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10154         CResult_ChannelDetailsDecodeErrorZ {
10155                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10156                         result: Box::into_raw(Box::new(o)),
10157                 },
10158                 result_ok: true,
10159         }
10160 }
10161 #[no_mangle]
10162 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10163 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10164         CResult_ChannelDetailsDecodeErrorZ {
10165                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10166                         err: Box::into_raw(Box::new(e)),
10167                 },
10168                 result_ok: false,
10169         }
10170 }
10171 /// Checks if the given object is currently in the success state
10172 #[no_mangle]
10173 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10174         o.result_ok
10175 }
10176 #[no_mangle]
10177 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10178 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10179 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10180         fn drop(&mut self) {
10181                 if self.result_ok {
10182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10184                         }
10185                 } else {
10186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10188                         }
10189                 }
10190         }
10191 }
10192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10194                 let contents = if o.result_ok {
10195                         let result = unsafe { o.contents.result };
10196                         unsafe { o.contents.result = core::ptr::null_mut() };
10197                         CResult_ChannelDetailsDecodeErrorZPtr { result }
10198                 } else {
10199                         let err = unsafe { o.contents.err };
10200                         unsafe { o.contents.err = core::ptr::null_mut(); }
10201                         CResult_ChannelDetailsDecodeErrorZPtr { err }
10202                 };
10203                 Self {
10204                         contents,
10205                         result_ok: o.result_ok,
10206                 }
10207         }
10208 }
10209 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10210         fn clone(&self) -> Self {
10211                 if self.result_ok {
10212                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10214                         } }
10215                 } else {
10216                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10218                         } }
10219                 }
10220         }
10221 }
10222 #[no_mangle]
10223 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10224 /// but with all dynamically-allocated buffers duplicated in new buffers.
10225 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10226 #[repr(C)]
10227 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10228 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10229         /// A pointer to the contents in the success state.
10230         /// Reading from this pointer when `result_ok` is not set is undefined.
10231         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10232         /// A pointer to the contents in the error state.
10233         /// Reading from this pointer when `result_ok` is set is undefined.
10234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10235 }
10236 #[repr(C)]
10237 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10238 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10240 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10241         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10242         /// `err` or `result` depending on the state of `result_ok`.
10243         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10244         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10245         pub result_ok: bool,
10246 }
10247 #[no_mangle]
10248 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10249 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10250         CResult_PhantomRouteHintsDecodeErrorZ {
10251                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10252                         result: Box::into_raw(Box::new(o)),
10253                 },
10254                 result_ok: true,
10255         }
10256 }
10257 #[no_mangle]
10258 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10259 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10260         CResult_PhantomRouteHintsDecodeErrorZ {
10261                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10262                         err: Box::into_raw(Box::new(e)),
10263                 },
10264                 result_ok: false,
10265         }
10266 }
10267 /// Checks if the given object is currently in the success state
10268 #[no_mangle]
10269 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10270         o.result_ok
10271 }
10272 #[no_mangle]
10273 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10274 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10275 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10276         fn drop(&mut self) {
10277                 if self.result_ok {
10278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10280                         }
10281                 } else {
10282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10284                         }
10285                 }
10286         }
10287 }
10288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10290                 let contents = if o.result_ok {
10291                         let result = unsafe { o.contents.result };
10292                         unsafe { o.contents.result = core::ptr::null_mut() };
10293                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10294                 } else {
10295                         let err = unsafe { o.contents.err };
10296                         unsafe { o.contents.err = core::ptr::null_mut(); }
10297                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10298                 };
10299                 Self {
10300                         contents,
10301                         result_ok: o.result_ok,
10302                 }
10303         }
10304 }
10305 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10306         fn clone(&self) -> Self {
10307                 if self.result_ok {
10308                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10309                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10310                         } }
10311                 } else {
10312                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10314                         } }
10315                 }
10316         }
10317 }
10318 #[no_mangle]
10319 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10320 /// but with all dynamically-allocated buffers duplicated in new buffers.
10321 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10322 #[repr(C)]
10323 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10324 /// This corresponds to std::vector in C++
10325 pub struct CVec_ChannelMonitorZ {
10326         /// The elements in the array.
10327         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10328         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10329         /// The number of elements pointed to by `data`.
10330         pub datalen: usize
10331 }
10332 impl CVec_ChannelMonitorZ {
10333         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10334                 if self.datalen == 0 { return Vec::new(); }
10335                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10336                 self.data = core::ptr::null_mut();
10337                 self.datalen = 0;
10338                 ret
10339         }
10340         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10341                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10342         }
10343 }
10344 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10345         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10346                 let datalen = v.len();
10347                 let data = Box::into_raw(v.into_boxed_slice());
10348                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10349         }
10350 }
10351 #[no_mangle]
10352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10353 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10354 impl Drop for CVec_ChannelMonitorZ {
10355         fn drop(&mut self) {
10356                 if self.datalen == 0 { return; }
10357                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10358         }
10359 }
10360 #[repr(C)]
10361 /// A tuple of 2 elements. See the individual fields for the types contained.
10362 pub struct C2Tuple_BlockHashChannelManagerZ {
10363         /// The element at position 0
10364         pub a: crate::c_types::ThirtyTwoBytes,
10365         /// The element at position 1
10366         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10367 }
10368 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10369         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10370                 Self {
10371                         a: tup.0,
10372                         b: tup.1,
10373                 }
10374         }
10375 }
10376 impl C2Tuple_BlockHashChannelManagerZ {
10377         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10378                 (self.a, self.b)
10379         }
10380 }
10381 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10382 #[no_mangle]
10383 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10384         C2Tuple_BlockHashChannelManagerZ { a, b, }
10385 }
10386
10387 #[no_mangle]
10388 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10389 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10390 #[repr(C)]
10391 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10392 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10393         /// A pointer to the contents in the success state.
10394         /// Reading from this pointer when `result_ok` is not set is undefined.
10395         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10396         /// A pointer to the contents in the error state.
10397         /// Reading from this pointer when `result_ok` is set is undefined.
10398         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10399 }
10400 #[repr(C)]
10401 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10402 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10404 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10405         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10406         /// `err` or `result` depending on the state of `result_ok`.
10407         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10408         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10409         pub result_ok: bool,
10410 }
10411 #[no_mangle]
10412 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10413 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10414         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10415                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10416                         result: Box::into_raw(Box::new(o)),
10417                 },
10418                 result_ok: true,
10419         }
10420 }
10421 #[no_mangle]
10422 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10423 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10424         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10425                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10426                         err: Box::into_raw(Box::new(e)),
10427                 },
10428                 result_ok: false,
10429         }
10430 }
10431 /// Checks if the given object is currently in the success state
10432 #[no_mangle]
10433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
10434         o.result_ok
10435 }
10436 #[no_mangle]
10437 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10438 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10439 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10440         fn drop(&mut self) {
10441                 if self.result_ok {
10442                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10443                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10444                         }
10445                 } else {
10446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10448                         }
10449                 }
10450         }
10451 }
10452 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10453         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10454                 let contents = if o.result_ok {
10455                         let result = unsafe { o.contents.result };
10456                         unsafe { o.contents.result = core::ptr::null_mut() };
10457                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10458                 } else {
10459                         let err = unsafe { o.contents.err };
10460                         unsafe { o.contents.err = core::ptr::null_mut(); }
10461                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10462                 };
10463                 Self {
10464                         contents,
10465                         result_ok: o.result_ok,
10466                 }
10467         }
10468 }
10469 #[repr(C)]
10470 /// The contents of CResult_ChannelConfigDecodeErrorZ
10471 pub union CResult_ChannelConfigDecodeErrorZPtr {
10472         /// A pointer to the contents in the success state.
10473         /// Reading from this pointer when `result_ok` is not set is undefined.
10474         pub result: *mut crate::lightning::util::config::ChannelConfig,
10475         /// A pointer to the contents in the error state.
10476         /// Reading from this pointer when `result_ok` is set is undefined.
10477         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10478 }
10479 #[repr(C)]
10480 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10481 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10482 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10483 pub struct CResult_ChannelConfigDecodeErrorZ {
10484         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10485         /// `err` or `result` depending on the state of `result_ok`.
10486         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10487         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10488         pub result_ok: bool,
10489 }
10490 #[no_mangle]
10491 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10492 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10493         CResult_ChannelConfigDecodeErrorZ {
10494                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10495                         result: Box::into_raw(Box::new(o)),
10496                 },
10497                 result_ok: true,
10498         }
10499 }
10500 #[no_mangle]
10501 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10502 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10503         CResult_ChannelConfigDecodeErrorZ {
10504                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10505                         err: Box::into_raw(Box::new(e)),
10506                 },
10507                 result_ok: false,
10508         }
10509 }
10510 /// Checks if the given object is currently in the success state
10511 #[no_mangle]
10512 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10513         o.result_ok
10514 }
10515 #[no_mangle]
10516 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10517 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10518 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10519         fn drop(&mut self) {
10520                 if self.result_ok {
10521                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10522                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10523                         }
10524                 } else {
10525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10527                         }
10528                 }
10529         }
10530 }
10531 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10532         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10533                 let contents = if o.result_ok {
10534                         let result = unsafe { o.contents.result };
10535                         unsafe { o.contents.result = core::ptr::null_mut() };
10536                         CResult_ChannelConfigDecodeErrorZPtr { result }
10537                 } else {
10538                         let err = unsafe { o.contents.err };
10539                         unsafe { o.contents.err = core::ptr::null_mut(); }
10540                         CResult_ChannelConfigDecodeErrorZPtr { err }
10541                 };
10542                 Self {
10543                         contents,
10544                         result_ok: o.result_ok,
10545                 }
10546         }
10547 }
10548 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10549         fn clone(&self) -> Self {
10550                 if self.result_ok {
10551                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10552                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10553                         } }
10554                 } else {
10555                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10556                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10557                         } }
10558                 }
10559         }
10560 }
10561 #[no_mangle]
10562 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10563 /// but with all dynamically-allocated buffers duplicated in new buffers.
10564 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10565 #[repr(C)]
10566 #[derive(Clone)]
10567 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10568 pub enum COption_APIErrorZ {
10569         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10570         Some(crate::lightning::util::errors::APIError),
10571         /// When we're in this state, this COption_APIErrorZ contains nothing
10572         None
10573 }
10574 impl COption_APIErrorZ {
10575         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10576                 if let Self::None = self { false } else { true }
10577         }
10578         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10579                 !self.is_some()
10580         }
10581         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10582                 if let Self::Some(v) = self { v } else { unreachable!() }
10583         }
10584 }
10585 #[no_mangle]
10586 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10587 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10588         COption_APIErrorZ::Some(o)
10589 }
10590 #[no_mangle]
10591 /// Constructs a new COption_APIErrorZ containing nothing
10592 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10593         COption_APIErrorZ::None
10594 }
10595 #[no_mangle]
10596 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10597 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10598 #[no_mangle]
10599 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10600 /// but with all dynamically-allocated buffers duplicated in new buffers.
10601 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10602 #[repr(C)]
10603 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10604 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10605         /// A pointer to the contents in the success state.
10606         /// Reading from this pointer when `result_ok` is not set is undefined.
10607         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10608         /// A pointer to the contents in the error state.
10609         /// Reading from this pointer when `result_ok` is set is undefined.
10610         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10611 }
10612 #[repr(C)]
10613 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10614 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10616 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10617         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10618         /// `err` or `result` depending on the state of `result_ok`.
10619         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10620         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10621         pub result_ok: bool,
10622 }
10623 #[no_mangle]
10624 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10625 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10626         CResult_COption_APIErrorZDecodeErrorZ {
10627                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10628                         result: Box::into_raw(Box::new(o)),
10629                 },
10630                 result_ok: true,
10631         }
10632 }
10633 #[no_mangle]
10634 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10635 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10636         CResult_COption_APIErrorZDecodeErrorZ {
10637                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10638                         err: Box::into_raw(Box::new(e)),
10639                 },
10640                 result_ok: false,
10641         }
10642 }
10643 /// Checks if the given object is currently in the success state
10644 #[no_mangle]
10645 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10646         o.result_ok
10647 }
10648 #[no_mangle]
10649 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10650 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10651 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10652         fn drop(&mut self) {
10653                 if self.result_ok {
10654                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10655                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10656                         }
10657                 } else {
10658                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10659                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10660                         }
10661                 }
10662         }
10663 }
10664 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10665         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10666                 let contents = if o.result_ok {
10667                         let result = unsafe { o.contents.result };
10668                         unsafe { o.contents.result = core::ptr::null_mut() };
10669                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
10670                 } else {
10671                         let err = unsafe { o.contents.err };
10672                         unsafe { o.contents.err = core::ptr::null_mut(); }
10673                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
10674                 };
10675                 Self {
10676                         contents,
10677                         result_ok: o.result_ok,
10678                 }
10679         }
10680 }
10681 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10682         fn clone(&self) -> Self {
10683                 if self.result_ok {
10684                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10685                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10686                         } }
10687                 } else {
10688                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10689                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10690                         } }
10691                 }
10692         }
10693 }
10694 #[no_mangle]
10695 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10696 /// but with all dynamically-allocated buffers duplicated in new buffers.
10697 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10698 #[repr(C)]
10699 /// The contents of CResult_UntrustedStringDecodeErrorZ
10700 pub union CResult_UntrustedStringDecodeErrorZPtr {
10701         /// A pointer to the contents in the success state.
10702         /// Reading from this pointer when `result_ok` is not set is undefined.
10703         pub result: *mut crate::lightning::util::string::UntrustedString,
10704         /// A pointer to the contents in the error state.
10705         /// Reading from this pointer when `result_ok` is set is undefined.
10706         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10707 }
10708 #[repr(C)]
10709 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
10710 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
10711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10712 pub struct CResult_UntrustedStringDecodeErrorZ {
10713         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
10714         /// `err` or `result` depending on the state of `result_ok`.
10715         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
10716         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
10717         pub result_ok: bool,
10718 }
10719 #[no_mangle]
10720 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
10721 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
10722         CResult_UntrustedStringDecodeErrorZ {
10723                 contents: CResult_UntrustedStringDecodeErrorZPtr {
10724                         result: Box::into_raw(Box::new(o)),
10725                 },
10726                 result_ok: true,
10727         }
10728 }
10729 #[no_mangle]
10730 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
10731 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
10732         CResult_UntrustedStringDecodeErrorZ {
10733                 contents: CResult_UntrustedStringDecodeErrorZPtr {
10734                         err: Box::into_raw(Box::new(e)),
10735                 },
10736                 result_ok: false,
10737         }
10738 }
10739 /// Checks if the given object is currently in the success state
10740 #[no_mangle]
10741 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
10742         o.result_ok
10743 }
10744 #[no_mangle]
10745 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
10746 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
10747 impl Drop for CResult_UntrustedStringDecodeErrorZ {
10748         fn drop(&mut self) {
10749                 if self.result_ok {
10750                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10751                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10752                         }
10753                 } else {
10754                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10755                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10756                         }
10757                 }
10758         }
10759 }
10760 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
10761         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
10762                 let contents = if o.result_ok {
10763                         let result = unsafe { o.contents.result };
10764                         unsafe { o.contents.result = core::ptr::null_mut() };
10765                         CResult_UntrustedStringDecodeErrorZPtr { result }
10766                 } else {
10767                         let err = unsafe { o.contents.err };
10768                         unsafe { o.contents.err = core::ptr::null_mut(); }
10769                         CResult_UntrustedStringDecodeErrorZPtr { err }
10770                 };
10771                 Self {
10772                         contents,
10773                         result_ok: o.result_ok,
10774                 }
10775         }
10776 }
10777 impl Clone for CResult_UntrustedStringDecodeErrorZ {
10778         fn clone(&self) -> Self {
10779                 if self.result_ok {
10780                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
10781                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
10782                         } }
10783                 } else {
10784                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
10785                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10786                         } }
10787                 }
10788         }
10789 }
10790 #[no_mangle]
10791 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
10792 /// but with all dynamically-allocated buffers duplicated in new buffers.
10793 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
10794 #[repr(C)]
10795 /// The contents of CResult_OutPointDecodeErrorZ
10796 pub union CResult_OutPointDecodeErrorZPtr {
10797         /// A pointer to the contents in the success state.
10798         /// Reading from this pointer when `result_ok` is not set is undefined.
10799         pub result: *mut crate::lightning::chain::transaction::OutPoint,
10800         /// A pointer to the contents in the error state.
10801         /// Reading from this pointer when `result_ok` is set is undefined.
10802         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10803 }
10804 #[repr(C)]
10805 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10806 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10808 pub struct CResult_OutPointDecodeErrorZ {
10809         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10810         /// `err` or `result` depending on the state of `result_ok`.
10811         pub contents: CResult_OutPointDecodeErrorZPtr,
10812         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10813         pub result_ok: bool,
10814 }
10815 #[no_mangle]
10816 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10817 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10818         CResult_OutPointDecodeErrorZ {
10819                 contents: CResult_OutPointDecodeErrorZPtr {
10820                         result: Box::into_raw(Box::new(o)),
10821                 },
10822                 result_ok: true,
10823         }
10824 }
10825 #[no_mangle]
10826 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10827 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10828         CResult_OutPointDecodeErrorZ {
10829                 contents: CResult_OutPointDecodeErrorZPtr {
10830                         err: Box::into_raw(Box::new(e)),
10831                 },
10832                 result_ok: false,
10833         }
10834 }
10835 /// Checks if the given object is currently in the success state
10836 #[no_mangle]
10837 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10838         o.result_ok
10839 }
10840 #[no_mangle]
10841 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10842 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10843 impl Drop for CResult_OutPointDecodeErrorZ {
10844         fn drop(&mut self) {
10845                 if self.result_ok {
10846                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10847                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10848                         }
10849                 } else {
10850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10852                         }
10853                 }
10854         }
10855 }
10856 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10857         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10858                 let contents = if o.result_ok {
10859                         let result = unsafe { o.contents.result };
10860                         unsafe { o.contents.result = core::ptr::null_mut() };
10861                         CResult_OutPointDecodeErrorZPtr { result }
10862                 } else {
10863                         let err = unsafe { o.contents.err };
10864                         unsafe { o.contents.err = core::ptr::null_mut(); }
10865                         CResult_OutPointDecodeErrorZPtr { err }
10866                 };
10867                 Self {
10868                         contents,
10869                         result_ok: o.result_ok,
10870                 }
10871         }
10872 }
10873 impl Clone for CResult_OutPointDecodeErrorZ {
10874         fn clone(&self) -> Self {
10875                 if self.result_ok {
10876                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10877                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10878                         } }
10879                 } else {
10880                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10881                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10882                         } }
10883                 }
10884         }
10885 }
10886 #[no_mangle]
10887 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10888 /// but with all dynamically-allocated buffers duplicated in new buffers.
10889 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10890 #[repr(C)]
10891 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10892 pub enum COption_TypeZ {
10893         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10894         Some(crate::lightning::ln::wire::Type),
10895         /// When we're in this state, this COption_TypeZ contains nothing
10896         None
10897 }
10898 impl COption_TypeZ {
10899         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10900                 if let Self::None = self { false } else { true }
10901         }
10902         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10903                 !self.is_some()
10904         }
10905         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10906                 if let Self::Some(v) = self { v } else { unreachable!() }
10907         }
10908 }
10909 #[no_mangle]
10910 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10911 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10912         COption_TypeZ::Some(o)
10913 }
10914 #[no_mangle]
10915 /// Constructs a new COption_TypeZ containing nothing
10916 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10917         COption_TypeZ::None
10918 }
10919 #[no_mangle]
10920 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10921 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10922 #[repr(C)]
10923 /// The contents of CResult_COption_TypeZDecodeErrorZ
10924 pub union CResult_COption_TypeZDecodeErrorZPtr {
10925         /// A pointer to the contents in the success state.
10926         /// Reading from this pointer when `result_ok` is not set is undefined.
10927         pub result: *mut crate::c_types::derived::COption_TypeZ,
10928         /// A pointer to the contents in the error state.
10929         /// Reading from this pointer when `result_ok` is set is undefined.
10930         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10931 }
10932 #[repr(C)]
10933 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10934 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10936 pub struct CResult_COption_TypeZDecodeErrorZ {
10937         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10938         /// `err` or `result` depending on the state of `result_ok`.
10939         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10940         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10941         pub result_ok: bool,
10942 }
10943 #[no_mangle]
10944 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10945 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10946         CResult_COption_TypeZDecodeErrorZ {
10947                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10948                         result: Box::into_raw(Box::new(o)),
10949                 },
10950                 result_ok: true,
10951         }
10952 }
10953 #[no_mangle]
10954 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10955 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10956         CResult_COption_TypeZDecodeErrorZ {
10957                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10958                         err: Box::into_raw(Box::new(e)),
10959                 },
10960                 result_ok: false,
10961         }
10962 }
10963 /// Checks if the given object is currently in the success state
10964 #[no_mangle]
10965 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10966         o.result_ok
10967 }
10968 #[no_mangle]
10969 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10970 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10971 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10972         fn drop(&mut self) {
10973                 if self.result_ok {
10974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10976                         }
10977                 } else {
10978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10980                         }
10981                 }
10982         }
10983 }
10984 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10985         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10986                 let contents = if o.result_ok {
10987                         let result = unsafe { o.contents.result };
10988                         unsafe { o.contents.result = core::ptr::null_mut() };
10989                         CResult_COption_TypeZDecodeErrorZPtr { result }
10990                 } else {
10991                         let err = unsafe { o.contents.err };
10992                         unsafe { o.contents.err = core::ptr::null_mut(); }
10993                         CResult_COption_TypeZDecodeErrorZPtr { err }
10994                 };
10995                 Self {
10996                         contents,
10997                         result_ok: o.result_ok,
10998                 }
10999         }
11000 }
11001 #[repr(C)]
11002 /// The contents of CResult_PaymentIdPaymentErrorZ
11003 pub union CResult_PaymentIdPaymentErrorZPtr {
11004         /// A pointer to the contents in the success state.
11005         /// Reading from this pointer when `result_ok` is not set is undefined.
11006         pub result: *mut crate::c_types::ThirtyTwoBytes,
11007         /// A pointer to the contents in the error state.
11008         /// Reading from this pointer when `result_ok` is set is undefined.
11009         pub err: *mut crate::lightning_invoice::payment::PaymentError,
11010 }
11011 #[repr(C)]
11012 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
11013 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
11014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11015 pub struct CResult_PaymentIdPaymentErrorZ {
11016         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
11017         /// `err` or `result` depending on the state of `result_ok`.
11018         pub contents: CResult_PaymentIdPaymentErrorZPtr,
11019         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
11020         pub result_ok: bool,
11021 }
11022 #[no_mangle]
11023 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
11024 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
11025         CResult_PaymentIdPaymentErrorZ {
11026                 contents: CResult_PaymentIdPaymentErrorZPtr {
11027                         result: Box::into_raw(Box::new(o)),
11028                 },
11029                 result_ok: true,
11030         }
11031 }
11032 #[no_mangle]
11033 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
11034 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
11035         CResult_PaymentIdPaymentErrorZ {
11036                 contents: CResult_PaymentIdPaymentErrorZPtr {
11037                         err: Box::into_raw(Box::new(e)),
11038                 },
11039                 result_ok: false,
11040         }
11041 }
11042 /// Checks if the given object is currently in the success state
11043 #[no_mangle]
11044 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
11045         o.result_ok
11046 }
11047 #[no_mangle]
11048 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
11049 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
11050 impl Drop for CResult_PaymentIdPaymentErrorZ {
11051         fn drop(&mut self) {
11052                 if self.result_ok {
11053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11055                         }
11056                 } else {
11057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11059                         }
11060                 }
11061         }
11062 }
11063 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
11064         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
11065                 let contents = if o.result_ok {
11066                         let result = unsafe { o.contents.result };
11067                         unsafe { o.contents.result = core::ptr::null_mut() };
11068                         CResult_PaymentIdPaymentErrorZPtr { result }
11069                 } else {
11070                         let err = unsafe { o.contents.err };
11071                         unsafe { o.contents.err = core::ptr::null_mut(); }
11072                         CResult_PaymentIdPaymentErrorZPtr { err }
11073                 };
11074                 Self {
11075                         contents,
11076                         result_ok: o.result_ok,
11077                 }
11078         }
11079 }
11080 impl Clone for CResult_PaymentIdPaymentErrorZ {
11081         fn clone(&self) -> Self {
11082                 if self.result_ok {
11083                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
11084                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
11085                         } }
11086                 } else {
11087                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
11088                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11089                         } }
11090                 }
11091         }
11092 }
11093 #[no_mangle]
11094 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
11095 /// but with all dynamically-allocated buffers duplicated in new buffers.
11096 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
11097 #[repr(C)]
11098 /// The contents of CResult_NonePaymentErrorZ
11099 pub union CResult_NonePaymentErrorZPtr {
11100         /// Note that this value is always NULL, as there are no contents in the OK variant
11101         pub result: *mut core::ffi::c_void,
11102         /// A pointer to the contents in the error state.
11103         /// Reading from this pointer when `result_ok` is set is undefined.
11104         pub err: *mut crate::lightning_invoice::payment::PaymentError,
11105 }
11106 #[repr(C)]
11107 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
11108 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
11109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11110 pub struct CResult_NonePaymentErrorZ {
11111         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
11112         /// `err` or `result` depending on the state of `result_ok`.
11113         pub contents: CResult_NonePaymentErrorZPtr,
11114         /// Whether this CResult_NonePaymentErrorZ represents a success state.
11115         pub result_ok: bool,
11116 }
11117 #[no_mangle]
11118 /// Creates a new CResult_NonePaymentErrorZ in the success state.
11119 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
11120         CResult_NonePaymentErrorZ {
11121                 contents: CResult_NonePaymentErrorZPtr {
11122                         result: core::ptr::null_mut(),
11123                 },
11124                 result_ok: true,
11125         }
11126 }
11127 #[no_mangle]
11128 /// Creates a new CResult_NonePaymentErrorZ in the error state.
11129 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
11130         CResult_NonePaymentErrorZ {
11131                 contents: CResult_NonePaymentErrorZPtr {
11132                         err: Box::into_raw(Box::new(e)),
11133                 },
11134                 result_ok: false,
11135         }
11136 }
11137 /// Checks if the given object is currently in the success state
11138 #[no_mangle]
11139 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
11140         o.result_ok
11141 }
11142 #[no_mangle]
11143 /// Frees any resources used by the CResult_NonePaymentErrorZ.
11144 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
11145 impl Drop for CResult_NonePaymentErrorZ {
11146         fn drop(&mut self) {
11147                 if self.result_ok {
11148                 } else {
11149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11151                         }
11152                 }
11153         }
11154 }
11155 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
11156         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
11157                 let contents = if o.result_ok {
11158                         let _ = unsafe { Box::from_raw(o.contents.result) };
11159                         o.contents.result = core::ptr::null_mut();
11160                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
11161                 } else {
11162                         let err = unsafe { o.contents.err };
11163                         unsafe { o.contents.err = core::ptr::null_mut(); }
11164                         CResult_NonePaymentErrorZPtr { err }
11165                 };
11166                 Self {
11167                         contents,
11168                         result_ok: o.result_ok,
11169                 }
11170         }
11171 }
11172 impl Clone for CResult_NonePaymentErrorZ {
11173         fn clone(&self) -> Self {
11174                 if self.result_ok {
11175                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
11176                                 result: core::ptr::null_mut()
11177                         } }
11178                 } else {
11179                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
11180                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11181                         } }
11182                 }
11183         }
11184 }
11185 #[no_mangle]
11186 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
11187 /// but with all dynamically-allocated buffers duplicated in new buffers.
11188 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
11189 #[repr(C)]
11190 /// The contents of CResult_StringErrorZ
11191 pub union CResult_StringErrorZPtr {
11192         /// A pointer to the contents in the success state.
11193         /// Reading from this pointer when `result_ok` is not set is undefined.
11194         pub result: *mut crate::c_types::Str,
11195         /// A pointer to the contents in the error state.
11196         /// Reading from this pointer when `result_ok` is set is undefined.
11197         pub err: *mut crate::c_types::Secp256k1Error,
11198 }
11199 #[repr(C)]
11200 /// A CResult_StringErrorZ represents the result of a fallible operation,
11201 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11203 pub struct CResult_StringErrorZ {
11204         /// The contents of this CResult_StringErrorZ, accessible via either
11205         /// `err` or `result` depending on the state of `result_ok`.
11206         pub contents: CResult_StringErrorZPtr,
11207         /// Whether this CResult_StringErrorZ represents a success state.
11208         pub result_ok: bool,
11209 }
11210 #[no_mangle]
11211 /// Creates a new CResult_StringErrorZ in the success state.
11212 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11213         CResult_StringErrorZ {
11214                 contents: CResult_StringErrorZPtr {
11215                         result: Box::into_raw(Box::new(o)),
11216                 },
11217                 result_ok: true,
11218         }
11219 }
11220 #[no_mangle]
11221 /// Creates a new CResult_StringErrorZ in the error state.
11222 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11223         CResult_StringErrorZ {
11224                 contents: CResult_StringErrorZPtr {
11225                         err: Box::into_raw(Box::new(e)),
11226                 },
11227                 result_ok: false,
11228         }
11229 }
11230 /// Checks if the given object is currently in the success state
11231 #[no_mangle]
11232 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11233         o.result_ok
11234 }
11235 #[no_mangle]
11236 /// Frees any resources used by the CResult_StringErrorZ.
11237 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11238 impl Drop for CResult_StringErrorZ {
11239         fn drop(&mut self) {
11240                 if self.result_ok {
11241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11243                         }
11244                 } else {
11245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11247                         }
11248                 }
11249         }
11250 }
11251 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11252         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11253                 let contents = if o.result_ok {
11254                         let result = unsafe { o.contents.result };
11255                         unsafe { o.contents.result = core::ptr::null_mut() };
11256                         CResult_StringErrorZPtr { result }
11257                 } else {
11258                         let err = unsafe { o.contents.err };
11259                         unsafe { o.contents.err = core::ptr::null_mut(); }
11260                         CResult_StringErrorZPtr { err }
11261                 };
11262                 Self {
11263                         contents,
11264                         result_ok: o.result_ok,
11265                 }
11266         }
11267 }
11268 impl Clone for CResult_StringErrorZ {
11269         fn clone(&self) -> Self {
11270                 if self.result_ok {
11271                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
11272                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11273                         } }
11274                 } else {
11275                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
11276                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11277                         } }
11278                 }
11279         }
11280 }
11281 #[no_mangle]
11282 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11283 /// but with all dynamically-allocated buffers duplicated in new buffers.
11284 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11285 #[repr(C)]
11286 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11287 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11288         /// A pointer to the contents in the success state.
11289         /// Reading from this pointer when `result_ok` is not set is undefined.
11290         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11291         /// A pointer to the contents in the error state.
11292         /// Reading from this pointer when `result_ok` is set is undefined.
11293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11294 }
11295 #[repr(C)]
11296 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11297 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11299 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11300         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11301         /// `err` or `result` depending on the state of `result_ok`.
11302         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11303         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11304         pub result_ok: bool,
11305 }
11306 #[no_mangle]
11307 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11308 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11309         CResult_ChannelMonitorUpdateDecodeErrorZ {
11310                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11311                         result: Box::into_raw(Box::new(o)),
11312                 },
11313                 result_ok: true,
11314         }
11315 }
11316 #[no_mangle]
11317 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11318 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11319         CResult_ChannelMonitorUpdateDecodeErrorZ {
11320                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11321                         err: Box::into_raw(Box::new(e)),
11322                 },
11323                 result_ok: false,
11324         }
11325 }
11326 /// Checks if the given object is currently in the success state
11327 #[no_mangle]
11328 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11329         o.result_ok
11330 }
11331 #[no_mangle]
11332 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11333 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11334 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11335         fn drop(&mut self) {
11336                 if self.result_ok {
11337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11339                         }
11340                 } else {
11341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11343                         }
11344                 }
11345         }
11346 }
11347 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11349                 let contents = if o.result_ok {
11350                         let result = unsafe { o.contents.result };
11351                         unsafe { o.contents.result = core::ptr::null_mut() };
11352                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11353                 } else {
11354                         let err = unsafe { o.contents.err };
11355                         unsafe { o.contents.err = core::ptr::null_mut(); }
11356                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11357                 };
11358                 Self {
11359                         contents,
11360                         result_ok: o.result_ok,
11361                 }
11362         }
11363 }
11364 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11365         fn clone(&self) -> Self {
11366                 if self.result_ok {
11367                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11368                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11369                         } }
11370                 } else {
11371                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11373                         } }
11374                 }
11375         }
11376 }
11377 #[no_mangle]
11378 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11379 /// but with all dynamically-allocated buffers duplicated in new buffers.
11380 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11381 #[repr(C)]
11382 #[derive(Clone)]
11383 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11384 pub enum COption_MonitorEventZ {
11385         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11386         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11387         /// When we're in this state, this COption_MonitorEventZ contains nothing
11388         None
11389 }
11390 impl COption_MonitorEventZ {
11391         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11392                 if let Self::None = self { false } else { true }
11393         }
11394         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11395                 !self.is_some()
11396         }
11397         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11398                 if let Self::Some(v) = self { v } else { unreachable!() }
11399         }
11400 }
11401 #[no_mangle]
11402 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11403 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11404         COption_MonitorEventZ::Some(o)
11405 }
11406 #[no_mangle]
11407 /// Constructs a new COption_MonitorEventZ containing nothing
11408 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11409         COption_MonitorEventZ::None
11410 }
11411 #[no_mangle]
11412 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11413 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11414 #[no_mangle]
11415 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11416 /// but with all dynamically-allocated buffers duplicated in new buffers.
11417 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11418 #[repr(C)]
11419 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11420 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11421         /// A pointer to the contents in the success state.
11422         /// Reading from this pointer when `result_ok` is not set is undefined.
11423         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11424         /// A pointer to the contents in the error state.
11425         /// Reading from this pointer when `result_ok` is set is undefined.
11426         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11427 }
11428 #[repr(C)]
11429 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11430 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11432 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11433         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11434         /// `err` or `result` depending on the state of `result_ok`.
11435         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11436         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11437         pub result_ok: bool,
11438 }
11439 #[no_mangle]
11440 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11441 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11442         CResult_COption_MonitorEventZDecodeErrorZ {
11443                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11444                         result: Box::into_raw(Box::new(o)),
11445                 },
11446                 result_ok: true,
11447         }
11448 }
11449 #[no_mangle]
11450 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11451 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11452         CResult_COption_MonitorEventZDecodeErrorZ {
11453                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11454                         err: Box::into_raw(Box::new(e)),
11455                 },
11456                 result_ok: false,
11457         }
11458 }
11459 /// Checks if the given object is currently in the success state
11460 #[no_mangle]
11461 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11462         o.result_ok
11463 }
11464 #[no_mangle]
11465 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11466 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11467 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11468         fn drop(&mut self) {
11469                 if self.result_ok {
11470                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11471                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11472                         }
11473                 } else {
11474                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11475                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11476                         }
11477                 }
11478         }
11479 }
11480 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11481         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11482                 let contents = if o.result_ok {
11483                         let result = unsafe { o.contents.result };
11484                         unsafe { o.contents.result = core::ptr::null_mut() };
11485                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11486                 } else {
11487                         let err = unsafe { o.contents.err };
11488                         unsafe { o.contents.err = core::ptr::null_mut(); }
11489                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11490                 };
11491                 Self {
11492                         contents,
11493                         result_ok: o.result_ok,
11494                 }
11495         }
11496 }
11497 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11498         fn clone(&self) -> Self {
11499                 if self.result_ok {
11500                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11501                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11502                         } }
11503                 } else {
11504                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11505                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11506                         } }
11507                 }
11508         }
11509 }
11510 #[no_mangle]
11511 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11512 /// but with all dynamically-allocated buffers duplicated in new buffers.
11513 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11514 #[repr(C)]
11515 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11516 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11517         /// A pointer to the contents in the success state.
11518         /// Reading from this pointer when `result_ok` is not set is undefined.
11519         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11520         /// A pointer to the contents in the error state.
11521         /// Reading from this pointer when `result_ok` is set is undefined.
11522         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11523 }
11524 #[repr(C)]
11525 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11526 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11528 pub struct CResult_HTLCUpdateDecodeErrorZ {
11529         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11530         /// `err` or `result` depending on the state of `result_ok`.
11531         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11532         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11533         pub result_ok: bool,
11534 }
11535 #[no_mangle]
11536 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11537 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11538         CResult_HTLCUpdateDecodeErrorZ {
11539                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11540                         result: Box::into_raw(Box::new(o)),
11541                 },
11542                 result_ok: true,
11543         }
11544 }
11545 #[no_mangle]
11546 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11547 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11548         CResult_HTLCUpdateDecodeErrorZ {
11549                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11550                         err: Box::into_raw(Box::new(e)),
11551                 },
11552                 result_ok: false,
11553         }
11554 }
11555 /// Checks if the given object is currently in the success state
11556 #[no_mangle]
11557 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11558         o.result_ok
11559 }
11560 #[no_mangle]
11561 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11562 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11563 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11564         fn drop(&mut self) {
11565                 if self.result_ok {
11566                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11567                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11568                         }
11569                 } else {
11570                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11571                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11572                         }
11573                 }
11574         }
11575 }
11576 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11577         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11578                 let contents = if o.result_ok {
11579                         let result = unsafe { o.contents.result };
11580                         unsafe { o.contents.result = core::ptr::null_mut() };
11581                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11582                 } else {
11583                         let err = unsafe { o.contents.err };
11584                         unsafe { o.contents.err = core::ptr::null_mut(); }
11585                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11586                 };
11587                 Self {
11588                         contents,
11589                         result_ok: o.result_ok,
11590                 }
11591         }
11592 }
11593 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11594         fn clone(&self) -> Self {
11595                 if self.result_ok {
11596                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11597                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11598                         } }
11599                 } else {
11600                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11601                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11602                         } }
11603                 }
11604         }
11605 }
11606 #[no_mangle]
11607 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11608 /// but with all dynamically-allocated buffers duplicated in new buffers.
11609 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11610 #[repr(C)]
11611 /// A tuple of 2 elements. See the individual fields for the types contained.
11612 pub struct C2Tuple_OutPointScriptZ {
11613         /// The element at position 0
11614         pub a: crate::lightning::chain::transaction::OutPoint,
11615         /// The element at position 1
11616         pub b: crate::c_types::derived::CVec_u8Z,
11617 }
11618 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11619         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11620                 Self {
11621                         a: tup.0,
11622                         b: tup.1,
11623                 }
11624         }
11625 }
11626 impl C2Tuple_OutPointScriptZ {
11627         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11628                 (self.a, self.b)
11629         }
11630 }
11631 impl Clone for C2Tuple_OutPointScriptZ {
11632         fn clone(&self) -> Self {
11633                 Self {
11634                         a: Clone::clone(&self.a),
11635                         b: Clone::clone(&self.b),
11636                 }
11637         }
11638 }
11639 #[no_mangle]
11640 /// Creates a new tuple which has the same data as `orig`
11641 /// but with all dynamically-allocated buffers duplicated in new buffers.
11642 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11643 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11644 #[no_mangle]
11645 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11646         C2Tuple_OutPointScriptZ { a, b, }
11647 }
11648
11649 #[no_mangle]
11650 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11651 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11652 #[repr(C)]
11653 /// A tuple of 2 elements. See the individual fields for the types contained.
11654 pub struct C2Tuple_u32ScriptZ {
11655         /// The element at position 0
11656         pub a: u32,
11657         /// The element at position 1
11658         pub b: crate::c_types::derived::CVec_u8Z,
11659 }
11660 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11661         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11662                 Self {
11663                         a: tup.0,
11664                         b: tup.1,
11665                 }
11666         }
11667 }
11668 impl C2Tuple_u32ScriptZ {
11669         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11670                 (self.a, self.b)
11671         }
11672 }
11673 impl Clone for C2Tuple_u32ScriptZ {
11674         fn clone(&self) -> Self {
11675                 Self {
11676                         a: Clone::clone(&self.a),
11677                         b: Clone::clone(&self.b),
11678                 }
11679         }
11680 }
11681 #[no_mangle]
11682 /// Creates a new tuple which has the same data as `orig`
11683 /// but with all dynamically-allocated buffers duplicated in new buffers.
11684 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11685 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11686 #[no_mangle]
11687 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11688         C2Tuple_u32ScriptZ { a, b, }
11689 }
11690
11691 #[no_mangle]
11692 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11693 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11694 #[repr(C)]
11695 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11696 /// This corresponds to std::vector in C++
11697 pub struct CVec_C2Tuple_u32ScriptZZ {
11698         /// The elements in the array.
11699         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11700         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11701         /// The number of elements pointed to by `data`.
11702         pub datalen: usize
11703 }
11704 impl CVec_C2Tuple_u32ScriptZZ {
11705         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11706                 if self.datalen == 0 { return Vec::new(); }
11707                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11708                 self.data = core::ptr::null_mut();
11709                 self.datalen = 0;
11710                 ret
11711         }
11712         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11713                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11714         }
11715 }
11716 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11717         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11718                 let datalen = v.len();
11719                 let data = Box::into_raw(v.into_boxed_slice());
11720                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11721         }
11722 }
11723 #[no_mangle]
11724 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11725 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11726 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11727         fn drop(&mut self) {
11728                 if self.datalen == 0 { return; }
11729                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11730         }
11731 }
11732 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11733         fn clone(&self) -> Self {
11734                 let mut res = Vec::new();
11735                 if self.datalen == 0 { return Self::from(res); }
11736                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11737                 Self::from(res)
11738         }
11739 }
11740 #[repr(C)]
11741 /// A tuple of 2 elements. See the individual fields for the types contained.
11742 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11743         /// The element at position 0
11744         pub a: crate::c_types::ThirtyTwoBytes,
11745         /// The element at position 1
11746         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11747 }
11748 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11749         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11750                 Self {
11751                         a: tup.0,
11752                         b: tup.1,
11753                 }
11754         }
11755 }
11756 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11757         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11758                 (self.a, self.b)
11759         }
11760 }
11761 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11762         fn clone(&self) -> Self {
11763                 Self {
11764                         a: Clone::clone(&self.a),
11765                         b: Clone::clone(&self.b),
11766                 }
11767         }
11768 }
11769 #[no_mangle]
11770 /// Creates a new tuple which has the same data as `orig`
11771 /// but with all dynamically-allocated buffers duplicated in new buffers.
11772 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11773 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11774 #[no_mangle]
11775 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11776         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11777 }
11778
11779 #[no_mangle]
11780 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11781 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11782 #[repr(C)]
11783 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11784 /// This corresponds to std::vector in C++
11785 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11786         /// The elements in the array.
11787         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11788         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11789         /// The number of elements pointed to by `data`.
11790         pub datalen: usize
11791 }
11792 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11793         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11794                 if self.datalen == 0 { return Vec::new(); }
11795                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11796                 self.data = core::ptr::null_mut();
11797                 self.datalen = 0;
11798                 ret
11799         }
11800         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11801                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11802         }
11803 }
11804 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11805         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11806                 let datalen = v.len();
11807                 let data = Box::into_raw(v.into_boxed_slice());
11808                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11809         }
11810 }
11811 #[no_mangle]
11812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11813 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11814 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11815         fn drop(&mut self) {
11816                 if self.datalen == 0 { return; }
11817                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11818         }
11819 }
11820 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11821         fn clone(&self) -> Self {
11822                 let mut res = Vec::new();
11823                 if self.datalen == 0 { return Self::from(res); }
11824                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11825                 Self::from(res)
11826         }
11827 }
11828 #[repr(C)]
11829 /// A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
11830 /// This corresponds to std::vector in C++
11831 pub struct CVec_EventZ {
11832         /// The elements in the array.
11833         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11834         pub data: *mut crate::lightning::events::Event,
11835         /// The number of elements pointed to by `data`.
11836         pub datalen: usize
11837 }
11838 impl CVec_EventZ {
11839         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::Event> {
11840                 if self.datalen == 0 { return Vec::new(); }
11841                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11842                 self.data = core::ptr::null_mut();
11843                 self.datalen = 0;
11844                 ret
11845         }
11846         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::Event] {
11847                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11848         }
11849 }
11850 impl From<Vec<crate::lightning::events::Event>> for CVec_EventZ {
11851         fn from(v: Vec<crate::lightning::events::Event>) -> Self {
11852                 let datalen = v.len();
11853                 let data = Box::into_raw(v.into_boxed_slice());
11854                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11855         }
11856 }
11857 #[no_mangle]
11858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11859 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11860 impl Drop for CVec_EventZ {
11861         fn drop(&mut self) {
11862                 if self.datalen == 0 { return; }
11863                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11864         }
11865 }
11866 impl Clone for CVec_EventZ {
11867         fn clone(&self) -> Self {
11868                 let mut res = Vec::new();
11869                 if self.datalen == 0 { return Self::from(res); }
11870                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11871                 Self::from(res)
11872         }
11873 }
11874 #[repr(C)]
11875 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11876 /// This corresponds to std::vector in C++
11877 pub struct CVec_TransactionZ {
11878         /// The elements in the array.
11879         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11880         pub data: *mut crate::c_types::Transaction,
11881         /// The number of elements pointed to by `data`.
11882         pub datalen: usize
11883 }
11884 impl CVec_TransactionZ {
11885         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11886                 if self.datalen == 0 { return Vec::new(); }
11887                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11888                 self.data = core::ptr::null_mut();
11889                 self.datalen = 0;
11890                 ret
11891         }
11892         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11893                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11894         }
11895 }
11896 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11897         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11898                 let datalen = v.len();
11899                 let data = Box::into_raw(v.into_boxed_slice());
11900                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11901         }
11902 }
11903 #[no_mangle]
11904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11905 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11906 impl Drop for CVec_TransactionZ {
11907         fn drop(&mut self) {
11908                 if self.datalen == 0 { return; }
11909                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11910         }
11911 }
11912 impl Clone for CVec_TransactionZ {
11913         fn clone(&self) -> Self {
11914                 let mut res = Vec::new();
11915                 if self.datalen == 0 { return Self::from(res); }
11916                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11917                 Self::from(res)
11918         }
11919 }
11920 #[repr(C)]
11921 /// A tuple of 2 elements. See the individual fields for the types contained.
11922 pub struct C2Tuple_u32TxOutZ {
11923         /// The element at position 0
11924         pub a: u32,
11925         /// The element at position 1
11926         pub b: crate::c_types::TxOut,
11927 }
11928 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11929         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11930                 Self {
11931                         a: tup.0,
11932                         b: tup.1,
11933                 }
11934         }
11935 }
11936 impl C2Tuple_u32TxOutZ {
11937         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11938                 (self.a, self.b)
11939         }
11940 }
11941 impl Clone for C2Tuple_u32TxOutZ {
11942         fn clone(&self) -> Self {
11943                 Self {
11944                         a: Clone::clone(&self.a),
11945                         b: Clone::clone(&self.b),
11946                 }
11947         }
11948 }
11949 #[no_mangle]
11950 /// Creates a new tuple which has the same data as `orig`
11951 /// but with all dynamically-allocated buffers duplicated in new buffers.
11952 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11953 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11954 #[no_mangle]
11955 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11956         C2Tuple_u32TxOutZ { a, b, }
11957 }
11958
11959 #[no_mangle]
11960 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11961 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11962 #[repr(C)]
11963 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11964 /// This corresponds to std::vector in C++
11965 pub struct CVec_C2Tuple_u32TxOutZZ {
11966         /// The elements in the array.
11967         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11968         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11969         /// The number of elements pointed to by `data`.
11970         pub datalen: usize
11971 }
11972 impl CVec_C2Tuple_u32TxOutZZ {
11973         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11974                 if self.datalen == 0 { return Vec::new(); }
11975                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11976                 self.data = core::ptr::null_mut();
11977                 self.datalen = 0;
11978                 ret
11979         }
11980         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11981                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11982         }
11983 }
11984 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11985         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11986                 let datalen = v.len();
11987                 let data = Box::into_raw(v.into_boxed_slice());
11988                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11989         }
11990 }
11991 #[no_mangle]
11992 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11993 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11994 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11995         fn drop(&mut self) {
11996                 if self.datalen == 0 { return; }
11997                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11998         }
11999 }
12000 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12001         fn clone(&self) -> Self {
12002                 let mut res = Vec::new();
12003                 if self.datalen == 0 { return Self::from(res); }
12004                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12005                 Self::from(res)
12006         }
12007 }
12008 #[repr(C)]
12009 /// A tuple of 2 elements. See the individual fields for the types contained.
12010 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12011         /// The element at position 0
12012         pub a: crate::c_types::ThirtyTwoBytes,
12013         /// The element at position 1
12014         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12015 }
12016 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12017         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12018                 Self {
12019                         a: tup.0,
12020                         b: tup.1,
12021                 }
12022         }
12023 }
12024 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12025         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12026                 (self.a, self.b)
12027         }
12028 }
12029 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12030         fn clone(&self) -> Self {
12031                 Self {
12032                         a: Clone::clone(&self.a),
12033                         b: Clone::clone(&self.b),
12034                 }
12035         }
12036 }
12037 #[no_mangle]
12038 /// Creates a new tuple which has the same data as `orig`
12039 /// but with all dynamically-allocated buffers duplicated in new buffers.
12040 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12041 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12042 #[no_mangle]
12043 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12044         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12045 }
12046
12047 #[no_mangle]
12048 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12049 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12050 #[repr(C)]
12051 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12052 /// This corresponds to std::vector in C++
12053 pub struct CVec_TransactionOutputsZ {
12054         /// The elements in the array.
12055         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12056         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12057         /// The number of elements pointed to by `data`.
12058         pub datalen: usize
12059 }
12060 impl CVec_TransactionOutputsZ {
12061         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12062                 if self.datalen == 0 { return Vec::new(); }
12063                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12064                 self.data = core::ptr::null_mut();
12065                 self.datalen = 0;
12066                 ret
12067         }
12068         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12069                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12070         }
12071 }
12072 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12073         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12074                 let datalen = v.len();
12075                 let data = Box::into_raw(v.into_boxed_slice());
12076                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12077         }
12078 }
12079 #[no_mangle]
12080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12081 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12082 impl Drop for CVec_TransactionOutputsZ {
12083         fn drop(&mut self) {
12084                 if self.datalen == 0 { return; }
12085                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12086         }
12087 }
12088 impl Clone for CVec_TransactionOutputsZ {
12089         fn clone(&self) -> Self {
12090                 let mut res = Vec::new();
12091                 if self.datalen == 0 { return Self::from(res); }
12092                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12093                 Self::from(res)
12094         }
12095 }
12096 #[repr(C)]
12097 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12098 /// This corresponds to std::vector in C++
12099 pub struct CVec_BalanceZ {
12100         /// The elements in the array.
12101         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12102         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12103         /// The number of elements pointed to by `data`.
12104         pub datalen: usize
12105 }
12106 impl CVec_BalanceZ {
12107         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12108                 if self.datalen == 0 { return Vec::new(); }
12109                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12110                 self.data = core::ptr::null_mut();
12111                 self.datalen = 0;
12112                 ret
12113         }
12114         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12115                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12116         }
12117 }
12118 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12119         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12120                 let datalen = v.len();
12121                 let data = Box::into_raw(v.into_boxed_slice());
12122                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12123         }
12124 }
12125 #[no_mangle]
12126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12127 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12128 impl Drop for CVec_BalanceZ {
12129         fn drop(&mut self) {
12130                 if self.datalen == 0 { return; }
12131                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12132         }
12133 }
12134 impl Clone for CVec_BalanceZ {
12135         fn clone(&self) -> Self {
12136                 let mut res = Vec::new();
12137                 if self.datalen == 0 { return Self::from(res); }
12138                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12139                 Self::from(res)
12140         }
12141 }
12142 #[repr(C)]
12143 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12144 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12145         /// A pointer to the contents in the success state.
12146         /// Reading from this pointer when `result_ok` is not set is undefined.
12147         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12148         /// A pointer to the contents in the error state.
12149         /// Reading from this pointer when `result_ok` is set is undefined.
12150         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12151 }
12152 #[repr(C)]
12153 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12154 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12156 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12157         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12158         /// `err` or `result` depending on the state of `result_ok`.
12159         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12160         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12161         pub result_ok: bool,
12162 }
12163 #[no_mangle]
12164 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12165 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12166         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12167                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12168                         result: Box::into_raw(Box::new(o)),
12169                 },
12170                 result_ok: true,
12171         }
12172 }
12173 #[no_mangle]
12174 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12175 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12176         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12177                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12178                         err: Box::into_raw(Box::new(e)),
12179                 },
12180                 result_ok: false,
12181         }
12182 }
12183 /// Checks if the given object is currently in the success state
12184 #[no_mangle]
12185 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12186         o.result_ok
12187 }
12188 #[no_mangle]
12189 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12190 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12191 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12192         fn drop(&mut self) {
12193                 if self.result_ok {
12194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12196                         }
12197                 } else {
12198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12200                         }
12201                 }
12202         }
12203 }
12204 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12205         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12206                 let contents = if o.result_ok {
12207                         let result = unsafe { o.contents.result };
12208                         unsafe { o.contents.result = core::ptr::null_mut() };
12209                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12210                 } else {
12211                         let err = unsafe { o.contents.err };
12212                         unsafe { o.contents.err = core::ptr::null_mut(); }
12213                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12214                 };
12215                 Self {
12216                         contents,
12217                         result_ok: o.result_ok,
12218                 }
12219         }
12220 }
12221 #[repr(C)]
12222 /// A tuple of 2 elements. See the individual fields for the types contained.
12223 pub struct C2Tuple_PublicKeyTypeZ {
12224         /// The element at position 0
12225         pub a: crate::c_types::PublicKey,
12226         /// The element at position 1
12227         pub b: crate::lightning::ln::wire::Type,
12228 }
12229 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12230         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12231                 Self {
12232                         a: tup.0,
12233                         b: tup.1,
12234                 }
12235         }
12236 }
12237 impl C2Tuple_PublicKeyTypeZ {
12238         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12239                 (self.a, self.b)
12240         }
12241 }
12242 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12243 #[no_mangle]
12244 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12245         C2Tuple_PublicKeyTypeZ { a, b, }
12246 }
12247
12248 #[no_mangle]
12249 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12250 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12251 #[repr(C)]
12252 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12253 /// This corresponds to std::vector in C++
12254 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12255         /// The elements in the array.
12256         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12257         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12258         /// The number of elements pointed to by `data`.
12259         pub datalen: usize
12260 }
12261 impl CVec_C2Tuple_PublicKeyTypeZZ {
12262         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12263                 if self.datalen == 0 { return Vec::new(); }
12264                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12265                 self.data = core::ptr::null_mut();
12266                 self.datalen = 0;
12267                 ret
12268         }
12269         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12270                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12271         }
12272 }
12273 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12274         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12275                 let datalen = v.len();
12276                 let data = Box::into_raw(v.into_boxed_slice());
12277                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12278         }
12279 }
12280 #[no_mangle]
12281 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12282 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12283 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12284         fn drop(&mut self) {
12285                 if self.datalen == 0 { return; }
12286                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12287         }
12288 }
12289 #[repr(C)]
12290 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12291 pub enum COption_CustomOnionMessageContentsZ {
12292         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12293         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12294         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12295         None
12296 }
12297 impl COption_CustomOnionMessageContentsZ {
12298         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12299                 if let Self::None = self { false } else { true }
12300         }
12301         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12302                 !self.is_some()
12303         }
12304         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12305                 if let Self::Some(v) = self { v } else { unreachable!() }
12306         }
12307 }
12308 #[no_mangle]
12309 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12310 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12311         COption_CustomOnionMessageContentsZ::Some(o)
12312 }
12313 #[no_mangle]
12314 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12315 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12316         COption_CustomOnionMessageContentsZ::None
12317 }
12318 #[no_mangle]
12319 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12320 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12321 #[repr(C)]
12322 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12323 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12324         /// A pointer to the contents in the success state.
12325         /// Reading from this pointer when `result_ok` is not set is undefined.
12326         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12327         /// A pointer to the contents in the error state.
12328         /// Reading from this pointer when `result_ok` is set is undefined.
12329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12330 }
12331 #[repr(C)]
12332 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12333 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12335 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12336         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12337         /// `err` or `result` depending on the state of `result_ok`.
12338         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12339         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12340         pub result_ok: bool,
12341 }
12342 #[no_mangle]
12343 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12344 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12345         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12346                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12347                         result: Box::into_raw(Box::new(o)),
12348                 },
12349                 result_ok: true,
12350         }
12351 }
12352 #[no_mangle]
12353 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12354 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12355         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12356                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12357                         err: Box::into_raw(Box::new(e)),
12358                 },
12359                 result_ok: false,
12360         }
12361 }
12362 /// Checks if the given object is currently in the success state
12363 #[no_mangle]
12364 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12365         o.result_ok
12366 }
12367 #[no_mangle]
12368 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12369 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12370 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12371         fn drop(&mut self) {
12372                 if self.result_ok {
12373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12375                         }
12376                 } else {
12377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12379                         }
12380                 }
12381         }
12382 }
12383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12384         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12385                 let contents = if o.result_ok {
12386                         let result = unsafe { o.contents.result };
12387                         unsafe { o.contents.result = core::ptr::null_mut() };
12388                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12389                 } else {
12390                         let err = unsafe { o.contents.err };
12391                         unsafe { o.contents.err = core::ptr::null_mut(); }
12392                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12393                 };
12394                 Self {
12395                         contents,
12396                         result_ok: o.result_ok,
12397                 }
12398         }
12399 }
12400 #[repr(C)]
12401 #[derive(Clone)]
12402 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12403 pub enum COption_NetAddressZ {
12404         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12405         Some(crate::lightning::ln::msgs::NetAddress),
12406         /// When we're in this state, this COption_NetAddressZ contains nothing
12407         None
12408 }
12409 impl COption_NetAddressZ {
12410         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12411                 if let Self::None = self { false } else { true }
12412         }
12413         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12414                 !self.is_some()
12415         }
12416         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12417                 if let Self::Some(v) = self { v } else { unreachable!() }
12418         }
12419 }
12420 #[no_mangle]
12421 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12422 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12423         COption_NetAddressZ::Some(o)
12424 }
12425 #[no_mangle]
12426 /// Constructs a new COption_NetAddressZ containing nothing
12427 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12428         COption_NetAddressZ::None
12429 }
12430 #[no_mangle]
12431 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12432 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12433 #[no_mangle]
12434 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12435 /// but with all dynamically-allocated buffers duplicated in new buffers.
12436 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12437 #[repr(C)]
12438 /// A tuple of 2 elements. See the individual fields for the types contained.
12439 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
12440         /// The element at position 0
12441         pub a: crate::c_types::PublicKey,
12442         /// The element at position 1
12443         pub b: crate::c_types::derived::COption_NetAddressZ,
12444 }
12445 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
12446         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
12447                 Self {
12448                         a: tup.0,
12449                         b: tup.1,
12450                 }
12451         }
12452 }
12453 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
12454         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
12455                 (self.a, self.b)
12456         }
12457 }
12458 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
12459         fn clone(&self) -> Self {
12460                 Self {
12461                         a: Clone::clone(&self.a),
12462                         b: Clone::clone(&self.b),
12463                 }
12464         }
12465 }
12466 #[no_mangle]
12467 /// Creates a new tuple which has the same data as `orig`
12468 /// but with all dynamically-allocated buffers duplicated in new buffers.
12469 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
12470 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
12471 #[no_mangle]
12472 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
12473         C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
12474 }
12475
12476 #[no_mangle]
12477 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
12478 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
12479 #[repr(C)]
12480 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
12481 /// This corresponds to std::vector in C++
12482 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12483         /// The elements in the array.
12484         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12485         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
12486         /// The number of elements pointed to by `data`.
12487         pub datalen: usize
12488 }
12489 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12490         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
12491                 if self.datalen == 0 { return Vec::new(); }
12492                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12493                 self.data = core::ptr::null_mut();
12494                 self.datalen = 0;
12495                 ret
12496         }
12497         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
12498                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12499         }
12500 }
12501 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12502         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
12503                 let datalen = v.len();
12504                 let data = Box::into_raw(v.into_boxed_slice());
12505                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12506         }
12507 }
12508 #[no_mangle]
12509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12510 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
12511 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12512         fn drop(&mut self) {
12513                 if self.datalen == 0 { return; }
12514                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12515         }
12516 }
12517 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12518         fn clone(&self) -> Self {
12519                 let mut res = Vec::new();
12520                 if self.datalen == 0 { return Self::from(res); }
12521                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12522                 Self::from(res)
12523         }
12524 }
12525 #[repr(C)]
12526 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12527 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12528         /// A pointer to the contents in the success state.
12529         /// Reading from this pointer when `result_ok` is not set is undefined.
12530         pub result: *mut crate::c_types::derived::CVec_u8Z,
12531         /// A pointer to the contents in the error state.
12532         /// Reading from this pointer when `result_ok` is set is undefined.
12533         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12534 }
12535 #[repr(C)]
12536 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12537 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12539 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12540         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12541         /// `err` or `result` depending on the state of `result_ok`.
12542         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12543         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12544         pub result_ok: bool,
12545 }
12546 #[no_mangle]
12547 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12548 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12549         CResult_CVec_u8ZPeerHandleErrorZ {
12550                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12551                         result: Box::into_raw(Box::new(o)),
12552                 },
12553                 result_ok: true,
12554         }
12555 }
12556 #[no_mangle]
12557 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12558 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12559         CResult_CVec_u8ZPeerHandleErrorZ {
12560                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12561                         err: Box::into_raw(Box::new(e)),
12562                 },
12563                 result_ok: false,
12564         }
12565 }
12566 /// Checks if the given object is currently in the success state
12567 #[no_mangle]
12568 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12569         o.result_ok
12570 }
12571 #[no_mangle]
12572 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12573 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12574 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12575         fn drop(&mut self) {
12576                 if self.result_ok {
12577                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12578                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12579                         }
12580                 } else {
12581                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12582                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12583                         }
12584                 }
12585         }
12586 }
12587 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12588         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12589                 let contents = if o.result_ok {
12590                         let result = unsafe { o.contents.result };
12591                         unsafe { o.contents.result = core::ptr::null_mut() };
12592                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12593                 } else {
12594                         let err = unsafe { o.contents.err };
12595                         unsafe { o.contents.err = core::ptr::null_mut(); }
12596                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12597                 };
12598                 Self {
12599                         contents,
12600                         result_ok: o.result_ok,
12601                 }
12602         }
12603 }
12604 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12605         fn clone(&self) -> Self {
12606                 if self.result_ok {
12607                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12608                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12609                         } }
12610                 } else {
12611                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12612                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12613                         } }
12614                 }
12615         }
12616 }
12617 #[no_mangle]
12618 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12619 /// but with all dynamically-allocated buffers duplicated in new buffers.
12620 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12621 #[repr(C)]
12622 /// The contents of CResult_NonePeerHandleErrorZ
12623 pub union CResult_NonePeerHandleErrorZPtr {
12624         /// Note that this value is always NULL, as there are no contents in the OK variant
12625         pub result: *mut core::ffi::c_void,
12626         /// A pointer to the contents in the error state.
12627         /// Reading from this pointer when `result_ok` is set is undefined.
12628         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12629 }
12630 #[repr(C)]
12631 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12632 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12634 pub struct CResult_NonePeerHandleErrorZ {
12635         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12636         /// `err` or `result` depending on the state of `result_ok`.
12637         pub contents: CResult_NonePeerHandleErrorZPtr,
12638         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12639         pub result_ok: bool,
12640 }
12641 #[no_mangle]
12642 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12643 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12644         CResult_NonePeerHandleErrorZ {
12645                 contents: CResult_NonePeerHandleErrorZPtr {
12646                         result: core::ptr::null_mut(),
12647                 },
12648                 result_ok: true,
12649         }
12650 }
12651 #[no_mangle]
12652 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12653 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12654         CResult_NonePeerHandleErrorZ {
12655                 contents: CResult_NonePeerHandleErrorZPtr {
12656                         err: Box::into_raw(Box::new(e)),
12657                 },
12658                 result_ok: false,
12659         }
12660 }
12661 /// Checks if the given object is currently in the success state
12662 #[no_mangle]
12663 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12664         o.result_ok
12665 }
12666 #[no_mangle]
12667 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12668 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12669 impl Drop for CResult_NonePeerHandleErrorZ {
12670         fn drop(&mut self) {
12671                 if self.result_ok {
12672                 } else {
12673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12675                         }
12676                 }
12677         }
12678 }
12679 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12680         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12681                 let contents = if o.result_ok {
12682                         let _ = unsafe { Box::from_raw(o.contents.result) };
12683                         o.contents.result = core::ptr::null_mut();
12684                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12685                 } else {
12686                         let err = unsafe { o.contents.err };
12687                         unsafe { o.contents.err = core::ptr::null_mut(); }
12688                         CResult_NonePeerHandleErrorZPtr { err }
12689                 };
12690                 Self {
12691                         contents,
12692                         result_ok: o.result_ok,
12693                 }
12694         }
12695 }
12696 impl Clone for CResult_NonePeerHandleErrorZ {
12697         fn clone(&self) -> Self {
12698                 if self.result_ok {
12699                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12700                                 result: core::ptr::null_mut()
12701                         } }
12702                 } else {
12703                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12704                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12705                         } }
12706                 }
12707         }
12708 }
12709 #[no_mangle]
12710 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12711 /// but with all dynamically-allocated buffers duplicated in new buffers.
12712 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12713 #[repr(C)]
12714 /// The contents of CResult_boolPeerHandleErrorZ
12715 pub union CResult_boolPeerHandleErrorZPtr {
12716         /// A pointer to the contents in the success state.
12717         /// Reading from this pointer when `result_ok` is not set is undefined.
12718         pub result: *mut bool,
12719         /// A pointer to the contents in the error state.
12720         /// Reading from this pointer when `result_ok` is set is undefined.
12721         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12722 }
12723 #[repr(C)]
12724 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12725 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12727 pub struct CResult_boolPeerHandleErrorZ {
12728         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12729         /// `err` or `result` depending on the state of `result_ok`.
12730         pub contents: CResult_boolPeerHandleErrorZPtr,
12731         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12732         pub result_ok: bool,
12733 }
12734 #[no_mangle]
12735 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12736 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12737         CResult_boolPeerHandleErrorZ {
12738                 contents: CResult_boolPeerHandleErrorZPtr {
12739                         result: Box::into_raw(Box::new(o)),
12740                 },
12741                 result_ok: true,
12742         }
12743 }
12744 #[no_mangle]
12745 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12746 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12747         CResult_boolPeerHandleErrorZ {
12748                 contents: CResult_boolPeerHandleErrorZPtr {
12749                         err: Box::into_raw(Box::new(e)),
12750                 },
12751                 result_ok: false,
12752         }
12753 }
12754 /// Checks if the given object is currently in the success state
12755 #[no_mangle]
12756 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12757         o.result_ok
12758 }
12759 #[no_mangle]
12760 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12761 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12762 impl Drop for CResult_boolPeerHandleErrorZ {
12763         fn drop(&mut self) {
12764                 if self.result_ok {
12765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12767                         }
12768                 } else {
12769                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12770                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12771                         }
12772                 }
12773         }
12774 }
12775 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12776         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12777                 let contents = if o.result_ok {
12778                         let result = unsafe { o.contents.result };
12779                         unsafe { o.contents.result = core::ptr::null_mut() };
12780                         CResult_boolPeerHandleErrorZPtr { result }
12781                 } else {
12782                         let err = unsafe { o.contents.err };
12783                         unsafe { o.contents.err = core::ptr::null_mut(); }
12784                         CResult_boolPeerHandleErrorZPtr { err }
12785                 };
12786                 Self {
12787                         contents,
12788                         result_ok: o.result_ok,
12789                 }
12790         }
12791 }
12792 impl Clone for CResult_boolPeerHandleErrorZ {
12793         fn clone(&self) -> Self {
12794                 if self.result_ok {
12795                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12796                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12797                         } }
12798                 } else {
12799                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12800                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12801                         } }
12802                 }
12803         }
12804 }
12805 #[no_mangle]
12806 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12807 /// but with all dynamically-allocated buffers duplicated in new buffers.
12808 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12809 #[repr(C)]
12810 /// The contents of CResult_TxOutUtxoLookupErrorZ
12811 pub union CResult_TxOutUtxoLookupErrorZPtr {
12812         /// A pointer to the contents in the success state.
12813         /// Reading from this pointer when `result_ok` is not set is undefined.
12814         pub result: *mut crate::c_types::TxOut,
12815         /// A pointer to the contents in the error state.
12816         /// Reading from this pointer when `result_ok` is set is undefined.
12817         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12818 }
12819 #[repr(C)]
12820 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12821 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12823 pub struct CResult_TxOutUtxoLookupErrorZ {
12824         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12825         /// `err` or `result` depending on the state of `result_ok`.
12826         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12827         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12828         pub result_ok: bool,
12829 }
12830 #[no_mangle]
12831 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12832 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12833         CResult_TxOutUtxoLookupErrorZ {
12834                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12835                         result: Box::into_raw(Box::new(o)),
12836                 },
12837                 result_ok: true,
12838         }
12839 }
12840 #[no_mangle]
12841 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12842 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12843         CResult_TxOutUtxoLookupErrorZ {
12844                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12845                         err: Box::into_raw(Box::new(e)),
12846                 },
12847                 result_ok: false,
12848         }
12849 }
12850 /// Checks if the given object is currently in the success state
12851 #[no_mangle]
12852 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12853         o.result_ok
12854 }
12855 #[no_mangle]
12856 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12857 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12858 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12859         fn drop(&mut self) {
12860                 if self.result_ok {
12861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12863                         }
12864                 } else {
12865                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12866                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12867                         }
12868                 }
12869         }
12870 }
12871 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12872         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12873                 let contents = if o.result_ok {
12874                         let result = unsafe { o.contents.result };
12875                         unsafe { o.contents.result = core::ptr::null_mut() };
12876                         CResult_TxOutUtxoLookupErrorZPtr { result }
12877                 } else {
12878                         let err = unsafe { o.contents.err };
12879                         unsafe { o.contents.err = core::ptr::null_mut(); }
12880                         CResult_TxOutUtxoLookupErrorZPtr { err }
12881                 };
12882                 Self {
12883                         contents,
12884                         result_ok: o.result_ok,
12885                 }
12886         }
12887 }
12888 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12889         fn clone(&self) -> Self {
12890                 if self.result_ok {
12891                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12892                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12893                         } }
12894                 } else {
12895                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12896                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12897                         } }
12898                 }
12899         }
12900 }
12901 #[no_mangle]
12902 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12903 /// but with all dynamically-allocated buffers duplicated in new buffers.
12904 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12905 #[repr(C)]
12906 /// The contents of CResult_NoneSendErrorZ
12907 pub union CResult_NoneSendErrorZPtr {
12908         /// Note that this value is always NULL, as there are no contents in the OK variant
12909         pub result: *mut core::ffi::c_void,
12910         /// A pointer to the contents in the error state.
12911         /// Reading from this pointer when `result_ok` is set is undefined.
12912         pub err: *mut crate::lightning::onion_message::messenger::SendError,
12913 }
12914 #[repr(C)]
12915 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12916 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12918 pub struct CResult_NoneSendErrorZ {
12919         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12920         /// `err` or `result` depending on the state of `result_ok`.
12921         pub contents: CResult_NoneSendErrorZPtr,
12922         /// Whether this CResult_NoneSendErrorZ represents a success state.
12923         pub result_ok: bool,
12924 }
12925 #[no_mangle]
12926 /// Creates a new CResult_NoneSendErrorZ in the success state.
12927 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12928         CResult_NoneSendErrorZ {
12929                 contents: CResult_NoneSendErrorZPtr {
12930                         result: core::ptr::null_mut(),
12931                 },
12932                 result_ok: true,
12933         }
12934 }
12935 #[no_mangle]
12936 /// Creates a new CResult_NoneSendErrorZ in the error state.
12937 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12938         CResult_NoneSendErrorZ {
12939                 contents: CResult_NoneSendErrorZPtr {
12940                         err: Box::into_raw(Box::new(e)),
12941                 },
12942                 result_ok: false,
12943         }
12944 }
12945 /// Checks if the given object is currently in the success state
12946 #[no_mangle]
12947 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12948         o.result_ok
12949 }
12950 #[no_mangle]
12951 /// Frees any resources used by the CResult_NoneSendErrorZ.
12952 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12953 impl Drop for CResult_NoneSendErrorZ {
12954         fn drop(&mut self) {
12955                 if self.result_ok {
12956                 } else {
12957                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12958                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12959                         }
12960                 }
12961         }
12962 }
12963 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12964         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12965                 let contents = if o.result_ok {
12966                         let _ = unsafe { Box::from_raw(o.contents.result) };
12967                         o.contents.result = core::ptr::null_mut();
12968                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12969                 } else {
12970                         let err = unsafe { o.contents.err };
12971                         unsafe { o.contents.err = core::ptr::null_mut(); }
12972                         CResult_NoneSendErrorZPtr { err }
12973                 };
12974                 Self {
12975                         contents,
12976                         result_ok: o.result_ok,
12977                 }
12978         }
12979 }
12980 #[repr(C)]
12981 /// The contents of CResult_BlindedPathNoneZ
12982 pub union CResult_BlindedPathNoneZPtr {
12983         /// A pointer to the contents in the success state.
12984         /// Reading from this pointer when `result_ok` is not set is undefined.
12985         pub result: *mut crate::lightning::blinded_path::BlindedPath,
12986         /// Note that this value is always NULL, as there are no contents in the Err variant
12987         pub err: *mut core::ffi::c_void,
12988 }
12989 #[repr(C)]
12990 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
12991 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
12992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12993 pub struct CResult_BlindedPathNoneZ {
12994         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
12995         /// `err` or `result` depending on the state of `result_ok`.
12996         pub contents: CResult_BlindedPathNoneZPtr,
12997         /// Whether this CResult_BlindedPathNoneZ represents a success state.
12998         pub result_ok: bool,
12999 }
13000 #[no_mangle]
13001 /// Creates a new CResult_BlindedPathNoneZ in the success state.
13002 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
13003         CResult_BlindedPathNoneZ {
13004                 contents: CResult_BlindedPathNoneZPtr {
13005                         result: Box::into_raw(Box::new(o)),
13006                 },
13007                 result_ok: true,
13008         }
13009 }
13010 #[no_mangle]
13011 /// Creates a new CResult_BlindedPathNoneZ in the error state.
13012 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
13013         CResult_BlindedPathNoneZ {
13014                 contents: CResult_BlindedPathNoneZPtr {
13015                         err: core::ptr::null_mut(),
13016                 },
13017                 result_ok: false,
13018         }
13019 }
13020 /// Checks if the given object is currently in the success state
13021 #[no_mangle]
13022 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
13023         o.result_ok
13024 }
13025 #[no_mangle]
13026 /// Frees any resources used by the CResult_BlindedPathNoneZ.
13027 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
13028 impl Drop for CResult_BlindedPathNoneZ {
13029         fn drop(&mut self) {
13030                 if self.result_ok {
13031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13033                         }
13034                 } else {
13035                 }
13036         }
13037 }
13038 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
13039         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
13040                 let contents = if o.result_ok {
13041                         let result = unsafe { o.contents.result };
13042                         unsafe { o.contents.result = core::ptr::null_mut() };
13043                         CResult_BlindedPathNoneZPtr { result }
13044                 } else {
13045                         let _ = unsafe { Box::from_raw(o.contents.err) };
13046                         o.contents.err = core::ptr::null_mut();
13047                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
13048                 };
13049                 Self {
13050                         contents,
13051                         result_ok: o.result_ok,
13052                 }
13053         }
13054 }
13055 impl Clone for CResult_BlindedPathNoneZ {
13056         fn clone(&self) -> Self {
13057                 if self.result_ok {
13058                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
13059                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13060                         } }
13061                 } else {
13062                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
13063                                 err: core::ptr::null_mut()
13064                         } }
13065                 }
13066         }
13067 }
13068 #[no_mangle]
13069 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
13070 /// but with all dynamically-allocated buffers duplicated in new buffers.
13071 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
13072 #[repr(C)]
13073 /// The contents of CResult_BlindedPathDecodeErrorZ
13074 pub union CResult_BlindedPathDecodeErrorZPtr {
13075         /// A pointer to the contents in the success state.
13076         /// Reading from this pointer when `result_ok` is not set is undefined.
13077         pub result: *mut crate::lightning::blinded_path::BlindedPath,
13078         /// A pointer to the contents in the error state.
13079         /// Reading from this pointer when `result_ok` is set is undefined.
13080         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13081 }
13082 #[repr(C)]
13083 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
13084 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
13085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13086 pub struct CResult_BlindedPathDecodeErrorZ {
13087         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
13088         /// `err` or `result` depending on the state of `result_ok`.
13089         pub contents: CResult_BlindedPathDecodeErrorZPtr,
13090         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
13091         pub result_ok: bool,
13092 }
13093 #[no_mangle]
13094 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
13095 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
13096         CResult_BlindedPathDecodeErrorZ {
13097                 contents: CResult_BlindedPathDecodeErrorZPtr {
13098                         result: Box::into_raw(Box::new(o)),
13099                 },
13100                 result_ok: true,
13101         }
13102 }
13103 #[no_mangle]
13104 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
13105 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
13106         CResult_BlindedPathDecodeErrorZ {
13107                 contents: CResult_BlindedPathDecodeErrorZPtr {
13108                         err: Box::into_raw(Box::new(e)),
13109                 },
13110                 result_ok: false,
13111         }
13112 }
13113 /// Checks if the given object is currently in the success state
13114 #[no_mangle]
13115 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
13116         o.result_ok
13117 }
13118 #[no_mangle]
13119 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
13120 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
13121 impl Drop for CResult_BlindedPathDecodeErrorZ {
13122         fn drop(&mut self) {
13123                 if self.result_ok {
13124                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13125                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13126                         }
13127                 } else {
13128                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13129                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13130                         }
13131                 }
13132         }
13133 }
13134 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
13135         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
13136                 let contents = if o.result_ok {
13137                         let result = unsafe { o.contents.result };
13138                         unsafe { o.contents.result = core::ptr::null_mut() };
13139                         CResult_BlindedPathDecodeErrorZPtr { result }
13140                 } else {
13141                         let err = unsafe { o.contents.err };
13142                         unsafe { o.contents.err = core::ptr::null_mut(); }
13143                         CResult_BlindedPathDecodeErrorZPtr { err }
13144                 };
13145                 Self {
13146                         contents,
13147                         result_ok: o.result_ok,
13148                 }
13149         }
13150 }
13151 impl Clone for CResult_BlindedPathDecodeErrorZ {
13152         fn clone(&self) -> Self {
13153                 if self.result_ok {
13154                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
13155                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13156                         } }
13157                 } else {
13158                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
13159                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13160                         } }
13161                 }
13162         }
13163 }
13164 #[no_mangle]
13165 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
13166 /// but with all dynamically-allocated buffers duplicated in new buffers.
13167 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
13168 #[repr(C)]
13169 /// The contents of CResult_BlindedHopDecodeErrorZ
13170 pub union CResult_BlindedHopDecodeErrorZPtr {
13171         /// A pointer to the contents in the success state.
13172         /// Reading from this pointer when `result_ok` is not set is undefined.
13173         pub result: *mut crate::lightning::blinded_path::BlindedHop,
13174         /// A pointer to the contents in the error state.
13175         /// Reading from this pointer when `result_ok` is set is undefined.
13176         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13177 }
13178 #[repr(C)]
13179 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
13180 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
13181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13182 pub struct CResult_BlindedHopDecodeErrorZ {
13183         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
13184         /// `err` or `result` depending on the state of `result_ok`.
13185         pub contents: CResult_BlindedHopDecodeErrorZPtr,
13186         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
13187         pub result_ok: bool,
13188 }
13189 #[no_mangle]
13190 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
13191 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
13192         CResult_BlindedHopDecodeErrorZ {
13193                 contents: CResult_BlindedHopDecodeErrorZPtr {
13194                         result: Box::into_raw(Box::new(o)),
13195                 },
13196                 result_ok: true,
13197         }
13198 }
13199 #[no_mangle]
13200 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
13201 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
13202         CResult_BlindedHopDecodeErrorZ {
13203                 contents: CResult_BlindedHopDecodeErrorZPtr {
13204                         err: Box::into_raw(Box::new(e)),
13205                 },
13206                 result_ok: false,
13207         }
13208 }
13209 /// Checks if the given object is currently in the success state
13210 #[no_mangle]
13211 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
13212         o.result_ok
13213 }
13214 #[no_mangle]
13215 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
13216 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
13217 impl Drop for CResult_BlindedHopDecodeErrorZ {
13218         fn drop(&mut self) {
13219                 if self.result_ok {
13220                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13221                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13222                         }
13223                 } else {
13224                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13225                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13226                         }
13227                 }
13228         }
13229 }
13230 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
13231         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
13232                 let contents = if o.result_ok {
13233                         let result = unsafe { o.contents.result };
13234                         unsafe { o.contents.result = core::ptr::null_mut() };
13235                         CResult_BlindedHopDecodeErrorZPtr { result }
13236                 } else {
13237                         let err = unsafe { o.contents.err };
13238                         unsafe { o.contents.err = core::ptr::null_mut(); }
13239                         CResult_BlindedHopDecodeErrorZPtr { err }
13240                 };
13241                 Self {
13242                         contents,
13243                         result_ok: o.result_ok,
13244                 }
13245         }
13246 }
13247 impl Clone for CResult_BlindedHopDecodeErrorZ {
13248         fn clone(&self) -> Self {
13249                 if self.result_ok {
13250                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
13251                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
13252                         } }
13253                 } else {
13254                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
13255                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13256                         } }
13257                 }
13258         }
13259 }
13260 #[no_mangle]
13261 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
13262 /// but with all dynamically-allocated buffers duplicated in new buffers.
13263 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
13264 #[repr(C)]
13265 /// The contents of CResult_SiPrefixParseErrorZ
13266 pub union CResult_SiPrefixParseErrorZPtr {
13267         /// A pointer to the contents in the success state.
13268         /// Reading from this pointer when `result_ok` is not set is undefined.
13269         pub result: *mut crate::lightning_invoice::SiPrefix,
13270         /// A pointer to the contents in the error state.
13271         /// Reading from this pointer when `result_ok` is set is undefined.
13272         pub err: *mut crate::lightning_invoice::ParseError,
13273 }
13274 #[repr(C)]
13275 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
13276 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
13277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13278 pub struct CResult_SiPrefixParseErrorZ {
13279         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
13280         /// `err` or `result` depending on the state of `result_ok`.
13281         pub contents: CResult_SiPrefixParseErrorZPtr,
13282         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
13283         pub result_ok: bool,
13284 }
13285 #[no_mangle]
13286 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
13287 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
13288         CResult_SiPrefixParseErrorZ {
13289                 contents: CResult_SiPrefixParseErrorZPtr {
13290                         result: Box::into_raw(Box::new(o)),
13291                 },
13292                 result_ok: true,
13293         }
13294 }
13295 #[no_mangle]
13296 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
13297 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
13298         CResult_SiPrefixParseErrorZ {
13299                 contents: CResult_SiPrefixParseErrorZPtr {
13300                         err: Box::into_raw(Box::new(e)),
13301                 },
13302                 result_ok: false,
13303         }
13304 }
13305 /// Checks if the given object is currently in the success state
13306 #[no_mangle]
13307 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
13308         o.result_ok
13309 }
13310 #[no_mangle]
13311 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
13312 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
13313 impl Drop for CResult_SiPrefixParseErrorZ {
13314         fn drop(&mut self) {
13315                 if self.result_ok {
13316                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13317                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13318                         }
13319                 } else {
13320                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13321                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13322                         }
13323                 }
13324         }
13325 }
13326 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
13327         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
13328                 let contents = if o.result_ok {
13329                         let result = unsafe { o.contents.result };
13330                         unsafe { o.contents.result = core::ptr::null_mut() };
13331                         CResult_SiPrefixParseErrorZPtr { result }
13332                 } else {
13333                         let err = unsafe { o.contents.err };
13334                         unsafe { o.contents.err = core::ptr::null_mut(); }
13335                         CResult_SiPrefixParseErrorZPtr { err }
13336                 };
13337                 Self {
13338                         contents,
13339                         result_ok: o.result_ok,
13340                 }
13341         }
13342 }
13343 impl Clone for CResult_SiPrefixParseErrorZ {
13344         fn clone(&self) -> Self {
13345                 if self.result_ok {
13346                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
13347                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
13348                         } }
13349                 } else {
13350                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
13351                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13352                         } }
13353                 }
13354         }
13355 }
13356 #[no_mangle]
13357 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
13358 /// but with all dynamically-allocated buffers duplicated in new buffers.
13359 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
13360 #[repr(C)]
13361 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
13362 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
13363         /// A pointer to the contents in the success state.
13364         /// Reading from this pointer when `result_ok` is not set is undefined.
13365         pub result: *mut crate::lightning_invoice::Invoice,
13366         /// A pointer to the contents in the error state.
13367         /// Reading from this pointer when `result_ok` is set is undefined.
13368         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
13369 }
13370 #[repr(C)]
13371 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
13372 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
13373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13374 pub struct CResult_InvoiceParseOrSemanticErrorZ {
13375         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
13376         /// `err` or `result` depending on the state of `result_ok`.
13377         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
13378         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
13379         pub result_ok: bool,
13380 }
13381 #[no_mangle]
13382 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
13383 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
13384         CResult_InvoiceParseOrSemanticErrorZ {
13385                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13386                         result: Box::into_raw(Box::new(o)),
13387                 },
13388                 result_ok: true,
13389         }
13390 }
13391 #[no_mangle]
13392 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
13393 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
13394         CResult_InvoiceParseOrSemanticErrorZ {
13395                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13396                         err: Box::into_raw(Box::new(e)),
13397                 },
13398                 result_ok: false,
13399         }
13400 }
13401 /// Checks if the given object is currently in the success state
13402 #[no_mangle]
13403 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
13404         o.result_ok
13405 }
13406 #[no_mangle]
13407 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
13408 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
13409 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
13410         fn drop(&mut self) {
13411                 if self.result_ok {
13412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13414                         }
13415                 } else {
13416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13418                         }
13419                 }
13420         }
13421 }
13422 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
13423         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
13424                 let contents = if o.result_ok {
13425                         let result = unsafe { o.contents.result };
13426                         unsafe { o.contents.result = core::ptr::null_mut() };
13427                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
13428                 } else {
13429                         let err = unsafe { o.contents.err };
13430                         unsafe { o.contents.err = core::ptr::null_mut(); }
13431                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
13432                 };
13433                 Self {
13434                         contents,
13435                         result_ok: o.result_ok,
13436                 }
13437         }
13438 }
13439 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
13440         fn clone(&self) -> Self {
13441                 if self.result_ok {
13442                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13443                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13444                         } }
13445                 } else {
13446                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13447                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
13448                         } }
13449                 }
13450         }
13451 }
13452 #[no_mangle]
13453 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
13454 /// but with all dynamically-allocated buffers duplicated in new buffers.
13455 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
13456 #[repr(C)]
13457 /// The contents of CResult_SignedRawInvoiceParseErrorZ
13458 pub union CResult_SignedRawInvoiceParseErrorZPtr {
13459         /// A pointer to the contents in the success state.
13460         /// Reading from this pointer when `result_ok` is not set is undefined.
13461         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
13462         /// A pointer to the contents in the error state.
13463         /// Reading from this pointer when `result_ok` is set is undefined.
13464         pub err: *mut crate::lightning_invoice::ParseError,
13465 }
13466 #[repr(C)]
13467 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
13468 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
13469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13470 pub struct CResult_SignedRawInvoiceParseErrorZ {
13471         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
13472         /// `err` or `result` depending on the state of `result_ok`.
13473         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
13474         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
13475         pub result_ok: bool,
13476 }
13477 #[no_mangle]
13478 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
13479 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
13480         CResult_SignedRawInvoiceParseErrorZ {
13481                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13482                         result: Box::into_raw(Box::new(o)),
13483                 },
13484                 result_ok: true,
13485         }
13486 }
13487 #[no_mangle]
13488 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
13489 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
13490         CResult_SignedRawInvoiceParseErrorZ {
13491                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13492                         err: Box::into_raw(Box::new(e)),
13493                 },
13494                 result_ok: false,
13495         }
13496 }
13497 /// Checks if the given object is currently in the success state
13498 #[no_mangle]
13499 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
13500         o.result_ok
13501 }
13502 #[no_mangle]
13503 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
13504 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
13505 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
13506         fn drop(&mut self) {
13507                 if self.result_ok {
13508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13510                         }
13511                 } else {
13512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13514                         }
13515                 }
13516         }
13517 }
13518 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
13519         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
13520                 let contents = if o.result_ok {
13521                         let result = unsafe { o.contents.result };
13522                         unsafe { o.contents.result = core::ptr::null_mut() };
13523                         CResult_SignedRawInvoiceParseErrorZPtr { result }
13524                 } else {
13525                         let err = unsafe { o.contents.err };
13526                         unsafe { o.contents.err = core::ptr::null_mut(); }
13527                         CResult_SignedRawInvoiceParseErrorZPtr { err }
13528                 };
13529                 Self {
13530                         contents,
13531                         result_ok: o.result_ok,
13532                 }
13533         }
13534 }
13535 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
13536         fn clone(&self) -> Self {
13537                 if self.result_ok {
13538                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13539                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
13540                         } }
13541                 } else {
13542                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13543                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13544                         } }
13545                 }
13546         }
13547 }
13548 #[no_mangle]
13549 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
13550 /// but with all dynamically-allocated buffers duplicated in new buffers.
13551 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
13552 #[repr(C)]
13553 /// A tuple of 3 elements. See the individual fields for the types contained.
13554 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13555         /// The element at position 0
13556         pub a: crate::lightning_invoice::RawInvoice,
13557         /// The element at position 1
13558         pub b: crate::c_types::ThirtyTwoBytes,
13559         /// The element at position 2
13560         pub c: crate::lightning_invoice::InvoiceSignature,
13561 }
13562 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13563         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
13564                 Self {
13565                         a: tup.0,
13566                         b: tup.1,
13567                         c: tup.2,
13568                 }
13569         }
13570 }
13571 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13572         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
13573                 (self.a, self.b, self.c)
13574         }
13575 }
13576 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13577         fn clone(&self) -> Self {
13578                 Self {
13579                         a: Clone::clone(&self.a),
13580                         b: Clone::clone(&self.b),
13581                         c: Clone::clone(&self.c),
13582                 }
13583         }
13584 }
13585 #[no_mangle]
13586 /// Creates a new tuple which has the same data as `orig`
13587 /// but with all dynamically-allocated buffers duplicated in new buffers.
13588 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
13589 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13590 #[no_mangle]
13591 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13592         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
13593 }
13594
13595 #[no_mangle]
13596 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13597 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
13598 #[repr(C)]
13599 /// The contents of CResult_PayeePubKeyErrorZ
13600 pub union CResult_PayeePubKeyErrorZPtr {
13601         /// A pointer to the contents in the success state.
13602         /// Reading from this pointer when `result_ok` is not set is undefined.
13603         pub result: *mut crate::lightning_invoice::PayeePubKey,
13604         /// A pointer to the contents in the error state.
13605         /// Reading from this pointer when `result_ok` is set is undefined.
13606         pub err: *mut crate::c_types::Secp256k1Error,
13607 }
13608 #[repr(C)]
13609 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
13610 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
13611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13612 pub struct CResult_PayeePubKeyErrorZ {
13613         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
13614         /// `err` or `result` depending on the state of `result_ok`.
13615         pub contents: CResult_PayeePubKeyErrorZPtr,
13616         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
13617         pub result_ok: bool,
13618 }
13619 #[no_mangle]
13620 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
13621 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
13622         CResult_PayeePubKeyErrorZ {
13623                 contents: CResult_PayeePubKeyErrorZPtr {
13624                         result: Box::into_raw(Box::new(o)),
13625                 },
13626                 result_ok: true,
13627         }
13628 }
13629 #[no_mangle]
13630 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
13631 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
13632         CResult_PayeePubKeyErrorZ {
13633                 contents: CResult_PayeePubKeyErrorZPtr {
13634                         err: Box::into_raw(Box::new(e)),
13635                 },
13636                 result_ok: false,
13637         }
13638 }
13639 /// Checks if the given object is currently in the success state
13640 #[no_mangle]
13641 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
13642         o.result_ok
13643 }
13644 #[no_mangle]
13645 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
13646 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
13647 impl Drop for CResult_PayeePubKeyErrorZ {
13648         fn drop(&mut self) {
13649                 if self.result_ok {
13650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13652                         }
13653                 } else {
13654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13656                         }
13657                 }
13658         }
13659 }
13660 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
13661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
13662                 let contents = if o.result_ok {
13663                         let result = unsafe { o.contents.result };
13664                         unsafe { o.contents.result = core::ptr::null_mut() };
13665                         CResult_PayeePubKeyErrorZPtr { result }
13666                 } else {
13667                         let err = unsafe { o.contents.err };
13668                         unsafe { o.contents.err = core::ptr::null_mut(); }
13669                         CResult_PayeePubKeyErrorZPtr { err }
13670                 };
13671                 Self {
13672                         contents,
13673                         result_ok: o.result_ok,
13674                 }
13675         }
13676 }
13677 impl Clone for CResult_PayeePubKeyErrorZ {
13678         fn clone(&self) -> Self {
13679                 if self.result_ok {
13680                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
13681                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
13682                         } }
13683                 } else {
13684                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
13685                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
13686                         } }
13687                 }
13688         }
13689 }
13690 #[no_mangle]
13691 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13692 /// but with all dynamically-allocated buffers duplicated in new buffers.
13693 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
13694 #[repr(C)]
13695 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
13696 /// This corresponds to std::vector in C++
13697 pub struct CVec_PrivateRouteZ {
13698         /// The elements in the array.
13699         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13700         pub data: *mut crate::lightning_invoice::PrivateRoute,
13701         /// The number of elements pointed to by `data`.
13702         pub datalen: usize
13703 }
13704 impl CVec_PrivateRouteZ {
13705         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
13706                 if self.datalen == 0 { return Vec::new(); }
13707                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13708                 self.data = core::ptr::null_mut();
13709                 self.datalen = 0;
13710                 ret
13711         }
13712         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
13713                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13714         }
13715 }
13716 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
13717         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
13718                 let datalen = v.len();
13719                 let data = Box::into_raw(v.into_boxed_slice());
13720                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13721         }
13722 }
13723 #[no_mangle]
13724 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13725 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
13726 impl Drop for CVec_PrivateRouteZ {
13727         fn drop(&mut self) {
13728                 if self.datalen == 0 { return; }
13729                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13730         }
13731 }
13732 impl Clone for CVec_PrivateRouteZ {
13733         fn clone(&self) -> Self {
13734                 let mut res = Vec::new();
13735                 if self.datalen == 0 { return Self::from(res); }
13736                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13737                 Self::from(res)
13738         }
13739 }
13740 #[repr(C)]
13741 /// The contents of CResult_PositiveTimestampCreationErrorZ
13742 pub union CResult_PositiveTimestampCreationErrorZPtr {
13743         /// A pointer to the contents in the success state.
13744         /// Reading from this pointer when `result_ok` is not set is undefined.
13745         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
13746         /// A pointer to the contents in the error state.
13747         /// Reading from this pointer when `result_ok` is set is undefined.
13748         pub err: *mut crate::lightning_invoice::CreationError,
13749 }
13750 #[repr(C)]
13751 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
13752 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
13753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13754 pub struct CResult_PositiveTimestampCreationErrorZ {
13755         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
13756         /// `err` or `result` depending on the state of `result_ok`.
13757         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
13758         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
13759         pub result_ok: bool,
13760 }
13761 #[no_mangle]
13762 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13763 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
13764         CResult_PositiveTimestampCreationErrorZ {
13765                 contents: CResult_PositiveTimestampCreationErrorZPtr {
13766                         result: Box::into_raw(Box::new(o)),
13767                 },
13768                 result_ok: true,
13769         }
13770 }
13771 #[no_mangle]
13772 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13773 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
13774         CResult_PositiveTimestampCreationErrorZ {
13775                 contents: CResult_PositiveTimestampCreationErrorZPtr {
13776                         err: Box::into_raw(Box::new(e)),
13777                 },
13778                 result_ok: false,
13779         }
13780 }
13781 /// Checks if the given object is currently in the success state
13782 #[no_mangle]
13783 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
13784         o.result_ok
13785 }
13786 #[no_mangle]
13787 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13788 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
13789 impl Drop for CResult_PositiveTimestampCreationErrorZ {
13790         fn drop(&mut self) {
13791                 if self.result_ok {
13792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13794                         }
13795                 } else {
13796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13798                         }
13799                 }
13800         }
13801 }
13802 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
13803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
13804                 let contents = if o.result_ok {
13805                         let result = unsafe { o.contents.result };
13806                         unsafe { o.contents.result = core::ptr::null_mut() };
13807                         CResult_PositiveTimestampCreationErrorZPtr { result }
13808                 } else {
13809                         let err = unsafe { o.contents.err };
13810                         unsafe { o.contents.err = core::ptr::null_mut(); }
13811                         CResult_PositiveTimestampCreationErrorZPtr { err }
13812                 };
13813                 Self {
13814                         contents,
13815                         result_ok: o.result_ok,
13816                 }
13817         }
13818 }
13819 impl Clone for CResult_PositiveTimestampCreationErrorZ {
13820         fn clone(&self) -> Self {
13821                 if self.result_ok {
13822                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13823                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13824                         } }
13825                 } else {
13826                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13827                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13828                         } }
13829                 }
13830         }
13831 }
13832 #[no_mangle]
13833 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13834 /// but with all dynamically-allocated buffers duplicated in new buffers.
13835 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13836 #[repr(C)]
13837 /// The contents of CResult_NoneSemanticErrorZ
13838 pub union CResult_NoneSemanticErrorZPtr {
13839         /// Note that this value is always NULL, as there are no contents in the OK variant
13840         pub result: *mut core::ffi::c_void,
13841         /// A pointer to the contents in the error state.
13842         /// Reading from this pointer when `result_ok` is set is undefined.
13843         pub err: *mut crate::lightning_invoice::SemanticError,
13844 }
13845 #[repr(C)]
13846 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13847 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13849 pub struct CResult_NoneSemanticErrorZ {
13850         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13851         /// `err` or `result` depending on the state of `result_ok`.
13852         pub contents: CResult_NoneSemanticErrorZPtr,
13853         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13854         pub result_ok: bool,
13855 }
13856 #[no_mangle]
13857 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13858 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13859         CResult_NoneSemanticErrorZ {
13860                 contents: CResult_NoneSemanticErrorZPtr {
13861                         result: core::ptr::null_mut(),
13862                 },
13863                 result_ok: true,
13864         }
13865 }
13866 #[no_mangle]
13867 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13868 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13869         CResult_NoneSemanticErrorZ {
13870                 contents: CResult_NoneSemanticErrorZPtr {
13871                         err: Box::into_raw(Box::new(e)),
13872                 },
13873                 result_ok: false,
13874         }
13875 }
13876 /// Checks if the given object is currently in the success state
13877 #[no_mangle]
13878 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13879         o.result_ok
13880 }
13881 #[no_mangle]
13882 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13883 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13884 impl Drop for CResult_NoneSemanticErrorZ {
13885         fn drop(&mut self) {
13886                 if self.result_ok {
13887                 } else {
13888                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13889                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13890                         }
13891                 }
13892         }
13893 }
13894 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13895         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13896                 let contents = if o.result_ok {
13897                         let _ = unsafe { Box::from_raw(o.contents.result) };
13898                         o.contents.result = core::ptr::null_mut();
13899                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13900                 } else {
13901                         let err = unsafe { o.contents.err };
13902                         unsafe { o.contents.err = core::ptr::null_mut(); }
13903                         CResult_NoneSemanticErrorZPtr { err }
13904                 };
13905                 Self {
13906                         contents,
13907                         result_ok: o.result_ok,
13908                 }
13909         }
13910 }
13911 impl Clone for CResult_NoneSemanticErrorZ {
13912         fn clone(&self) -> Self {
13913                 if self.result_ok {
13914                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13915                                 result: core::ptr::null_mut()
13916                         } }
13917                 } else {
13918                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13919                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13920                         } }
13921                 }
13922         }
13923 }
13924 #[no_mangle]
13925 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13926 /// but with all dynamically-allocated buffers duplicated in new buffers.
13927 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13928 #[repr(C)]
13929 /// The contents of CResult_InvoiceSemanticErrorZ
13930 pub union CResult_InvoiceSemanticErrorZPtr {
13931         /// A pointer to the contents in the success state.
13932         /// Reading from this pointer when `result_ok` is not set is undefined.
13933         pub result: *mut crate::lightning_invoice::Invoice,
13934         /// A pointer to the contents in the error state.
13935         /// Reading from this pointer when `result_ok` is set is undefined.
13936         pub err: *mut crate::lightning_invoice::SemanticError,
13937 }
13938 #[repr(C)]
13939 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13940 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13941 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13942 pub struct CResult_InvoiceSemanticErrorZ {
13943         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13944         /// `err` or `result` depending on the state of `result_ok`.
13945         pub contents: CResult_InvoiceSemanticErrorZPtr,
13946         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13947         pub result_ok: bool,
13948 }
13949 #[no_mangle]
13950 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13951 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13952         CResult_InvoiceSemanticErrorZ {
13953                 contents: CResult_InvoiceSemanticErrorZPtr {
13954                         result: Box::into_raw(Box::new(o)),
13955                 },
13956                 result_ok: true,
13957         }
13958 }
13959 #[no_mangle]
13960 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13961 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13962         CResult_InvoiceSemanticErrorZ {
13963                 contents: CResult_InvoiceSemanticErrorZPtr {
13964                         err: Box::into_raw(Box::new(e)),
13965                 },
13966                 result_ok: false,
13967         }
13968 }
13969 /// Checks if the given object is currently in the success state
13970 #[no_mangle]
13971 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13972         o.result_ok
13973 }
13974 #[no_mangle]
13975 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13976 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13977 impl Drop for CResult_InvoiceSemanticErrorZ {
13978         fn drop(&mut self) {
13979                 if self.result_ok {
13980                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13981                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13982                         }
13983                 } else {
13984                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13985                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13986                         }
13987                 }
13988         }
13989 }
13990 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13991         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13992                 let contents = if o.result_ok {
13993                         let result = unsafe { o.contents.result };
13994                         unsafe { o.contents.result = core::ptr::null_mut() };
13995                         CResult_InvoiceSemanticErrorZPtr { result }
13996                 } else {
13997                         let err = unsafe { o.contents.err };
13998                         unsafe { o.contents.err = core::ptr::null_mut(); }
13999                         CResult_InvoiceSemanticErrorZPtr { err }
14000                 };
14001                 Self {
14002                         contents,
14003                         result_ok: o.result_ok,
14004                 }
14005         }
14006 }
14007 impl Clone for CResult_InvoiceSemanticErrorZ {
14008         fn clone(&self) -> Self {
14009                 if self.result_ok {
14010                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
14011                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14012                         } }
14013                 } else {
14014                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
14015                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
14016                         } }
14017                 }
14018         }
14019 }
14020 #[no_mangle]
14021 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14022 /// but with all dynamically-allocated buffers duplicated in new buffers.
14023 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
14024 #[repr(C)]
14025 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14026 /// This corresponds to std::vector in C++
14027 pub struct CVec_AddressZ {
14028         /// The elements in the array.
14029         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14030         pub data: *mut crate::c_types::Str,
14031         /// The number of elements pointed to by `data`.
14032         pub datalen: usize
14033 }
14034 impl CVec_AddressZ {
14035         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14036                 if self.datalen == 0 { return Vec::new(); }
14037                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14038                 self.data = core::ptr::null_mut();
14039                 self.datalen = 0;
14040                 ret
14041         }
14042         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14043                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14044         }
14045 }
14046 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
14047         fn from(v: Vec<crate::c_types::Str>) -> Self {
14048                 let datalen = v.len();
14049                 let data = Box::into_raw(v.into_boxed_slice());
14050                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14051         }
14052 }
14053 #[no_mangle]
14054 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14055 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
14056 impl Drop for CVec_AddressZ {
14057         fn drop(&mut self) {
14058                 if self.datalen == 0 { return; }
14059                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14060         }
14061 }
14062 impl Clone for CVec_AddressZ {
14063         fn clone(&self) -> Self {
14064                 let mut res = Vec::new();
14065                 if self.datalen == 0 { return Self::from(res); }
14066                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14067                 Self::from(res)
14068         }
14069 }
14070 #[repr(C)]
14071 /// The contents of CResult_DescriptionCreationErrorZ
14072 pub union CResult_DescriptionCreationErrorZPtr {
14073         /// A pointer to the contents in the success state.
14074         /// Reading from this pointer when `result_ok` is not set is undefined.
14075         pub result: *mut crate::lightning_invoice::Description,
14076         /// A pointer to the contents in the error state.
14077         /// Reading from this pointer when `result_ok` is set is undefined.
14078         pub err: *mut crate::lightning_invoice::CreationError,
14079 }
14080 #[repr(C)]
14081 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
14082 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
14083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14084 pub struct CResult_DescriptionCreationErrorZ {
14085         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
14086         /// `err` or `result` depending on the state of `result_ok`.
14087         pub contents: CResult_DescriptionCreationErrorZPtr,
14088         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
14089         pub result_ok: bool,
14090 }
14091 #[no_mangle]
14092 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
14093 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
14094         CResult_DescriptionCreationErrorZ {
14095                 contents: CResult_DescriptionCreationErrorZPtr {
14096                         result: Box::into_raw(Box::new(o)),
14097                 },
14098                 result_ok: true,
14099         }
14100 }
14101 #[no_mangle]
14102 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
14103 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
14104         CResult_DescriptionCreationErrorZ {
14105                 contents: CResult_DescriptionCreationErrorZPtr {
14106                         err: Box::into_raw(Box::new(e)),
14107                 },
14108                 result_ok: false,
14109         }
14110 }
14111 /// Checks if the given object is currently in the success state
14112 #[no_mangle]
14113 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
14114         o.result_ok
14115 }
14116 #[no_mangle]
14117 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
14118 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
14119 impl Drop for CResult_DescriptionCreationErrorZ {
14120         fn drop(&mut self) {
14121                 if self.result_ok {
14122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14124                         }
14125                 } else {
14126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14128                         }
14129                 }
14130         }
14131 }
14132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
14133         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
14134                 let contents = if o.result_ok {
14135                         let result = unsafe { o.contents.result };
14136                         unsafe { o.contents.result = core::ptr::null_mut() };
14137                         CResult_DescriptionCreationErrorZPtr { result }
14138                 } else {
14139                         let err = unsafe { o.contents.err };
14140                         unsafe { o.contents.err = core::ptr::null_mut(); }
14141                         CResult_DescriptionCreationErrorZPtr { err }
14142                 };
14143                 Self {
14144                         contents,
14145                         result_ok: o.result_ok,
14146                 }
14147         }
14148 }
14149 impl Clone for CResult_DescriptionCreationErrorZ {
14150         fn clone(&self) -> Self {
14151                 if self.result_ok {
14152                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
14153                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
14154                         } }
14155                 } else {
14156                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
14157                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14158                         } }
14159                 }
14160         }
14161 }
14162 #[no_mangle]
14163 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14164 /// but with all dynamically-allocated buffers duplicated in new buffers.
14165 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
14166 #[repr(C)]
14167 /// The contents of CResult_PrivateRouteCreationErrorZ
14168 pub union CResult_PrivateRouteCreationErrorZPtr {
14169         /// A pointer to the contents in the success state.
14170         /// Reading from this pointer when `result_ok` is not set is undefined.
14171         pub result: *mut crate::lightning_invoice::PrivateRoute,
14172         /// A pointer to the contents in the error state.
14173         /// Reading from this pointer when `result_ok` is set is undefined.
14174         pub err: *mut crate::lightning_invoice::CreationError,
14175 }
14176 #[repr(C)]
14177 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
14178 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
14179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14180 pub struct CResult_PrivateRouteCreationErrorZ {
14181         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
14182         /// `err` or `result` depending on the state of `result_ok`.
14183         pub contents: CResult_PrivateRouteCreationErrorZPtr,
14184         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
14185         pub result_ok: bool,
14186 }
14187 #[no_mangle]
14188 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14189 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
14190         CResult_PrivateRouteCreationErrorZ {
14191                 contents: CResult_PrivateRouteCreationErrorZPtr {
14192                         result: Box::into_raw(Box::new(o)),
14193                 },
14194                 result_ok: true,
14195         }
14196 }
14197 #[no_mangle]
14198 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14199 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
14200         CResult_PrivateRouteCreationErrorZ {
14201                 contents: CResult_PrivateRouteCreationErrorZPtr {
14202                         err: Box::into_raw(Box::new(e)),
14203                 },
14204                 result_ok: false,
14205         }
14206 }
14207 /// Checks if the given object is currently in the success state
14208 #[no_mangle]
14209 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
14210         o.result_ok
14211 }
14212 #[no_mangle]
14213 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14214 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
14215 impl Drop for CResult_PrivateRouteCreationErrorZ {
14216         fn drop(&mut self) {
14217                 if self.result_ok {
14218                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14219                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14220                         }
14221                 } else {
14222                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14223                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14224                         }
14225                 }
14226         }
14227 }
14228 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
14229         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
14230                 let contents = if o.result_ok {
14231                         let result = unsafe { o.contents.result };
14232                         unsafe { o.contents.result = core::ptr::null_mut() };
14233                         CResult_PrivateRouteCreationErrorZPtr { result }
14234                 } else {
14235                         let err = unsafe { o.contents.err };
14236                         unsafe { o.contents.err = core::ptr::null_mut(); }
14237                         CResult_PrivateRouteCreationErrorZPtr { err }
14238                 };
14239                 Self {
14240                         contents,
14241                         result_ok: o.result_ok,
14242                 }
14243         }
14244 }
14245 impl Clone for CResult_PrivateRouteCreationErrorZ {
14246         fn clone(&self) -> Self {
14247                 if self.result_ok {
14248                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
14249                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
14250                         } }
14251                 } else {
14252                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
14253                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14254                         } }
14255                 }
14256         }
14257 }
14258 #[no_mangle]
14259 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14260 /// but with all dynamically-allocated buffers duplicated in new buffers.
14261 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
14262 #[repr(C)]
14263 /// The contents of CResult_NetAddressDecodeErrorZ
14264 pub union CResult_NetAddressDecodeErrorZPtr {
14265         /// A pointer to the contents in the success state.
14266         /// Reading from this pointer when `result_ok` is not set is undefined.
14267         pub result: *mut crate::lightning::ln::msgs::NetAddress,
14268         /// A pointer to the contents in the error state.
14269         /// Reading from this pointer when `result_ok` is set is undefined.
14270         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14271 }
14272 #[repr(C)]
14273 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
14274 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
14275 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14276 pub struct CResult_NetAddressDecodeErrorZ {
14277         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
14278         /// `err` or `result` depending on the state of `result_ok`.
14279         pub contents: CResult_NetAddressDecodeErrorZPtr,
14280         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
14281         pub result_ok: bool,
14282 }
14283 #[no_mangle]
14284 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
14285 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
14286         CResult_NetAddressDecodeErrorZ {
14287                 contents: CResult_NetAddressDecodeErrorZPtr {
14288                         result: Box::into_raw(Box::new(o)),
14289                 },
14290                 result_ok: true,
14291         }
14292 }
14293 #[no_mangle]
14294 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
14295 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
14296         CResult_NetAddressDecodeErrorZ {
14297                 contents: CResult_NetAddressDecodeErrorZPtr {
14298                         err: Box::into_raw(Box::new(e)),
14299                 },
14300                 result_ok: false,
14301         }
14302 }
14303 /// Checks if the given object is currently in the success state
14304 #[no_mangle]
14305 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
14306         o.result_ok
14307 }
14308 #[no_mangle]
14309 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
14310 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
14311 impl Drop for CResult_NetAddressDecodeErrorZ {
14312         fn drop(&mut self) {
14313                 if self.result_ok {
14314                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14315                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14316                         }
14317                 } else {
14318                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14319                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14320                         }
14321                 }
14322         }
14323 }
14324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
14325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
14326                 let contents = if o.result_ok {
14327                         let result = unsafe { o.contents.result };
14328                         unsafe { o.contents.result = core::ptr::null_mut() };
14329                         CResult_NetAddressDecodeErrorZPtr { result }
14330                 } else {
14331                         let err = unsafe { o.contents.err };
14332                         unsafe { o.contents.err = core::ptr::null_mut(); }
14333                         CResult_NetAddressDecodeErrorZPtr { err }
14334                 };
14335                 Self {
14336                         contents,
14337                         result_ok: o.result_ok,
14338                 }
14339         }
14340 }
14341 impl Clone for CResult_NetAddressDecodeErrorZ {
14342         fn clone(&self) -> Self {
14343                 if self.result_ok {
14344                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
14345                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
14346                         } }
14347                 } else {
14348                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
14349                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14350                         } }
14351                 }
14352         }
14353 }
14354 #[no_mangle]
14355 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14356 /// but with all dynamically-allocated buffers duplicated in new buffers.
14357 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
14358 #[repr(C)]
14359 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14360 /// This corresponds to std::vector in C++
14361 pub struct CVec_UpdateAddHTLCZ {
14362         /// The elements in the array.
14363         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14364         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14365         /// The number of elements pointed to by `data`.
14366         pub datalen: usize
14367 }
14368 impl CVec_UpdateAddHTLCZ {
14369         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14370                 if self.datalen == 0 { return Vec::new(); }
14371                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14372                 self.data = core::ptr::null_mut();
14373                 self.datalen = 0;
14374                 ret
14375         }
14376         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14377                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14378         }
14379 }
14380 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14381         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14382                 let datalen = v.len();
14383                 let data = Box::into_raw(v.into_boxed_slice());
14384                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14385         }
14386 }
14387 #[no_mangle]
14388 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14389 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14390 impl Drop for CVec_UpdateAddHTLCZ {
14391         fn drop(&mut self) {
14392                 if self.datalen == 0 { return; }
14393                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14394         }
14395 }
14396 impl Clone for CVec_UpdateAddHTLCZ {
14397         fn clone(&self) -> Self {
14398                 let mut res = Vec::new();
14399                 if self.datalen == 0 { return Self::from(res); }
14400                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14401                 Self::from(res)
14402         }
14403 }
14404 #[repr(C)]
14405 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14406 /// This corresponds to std::vector in C++
14407 pub struct CVec_UpdateFulfillHTLCZ {
14408         /// The elements in the array.
14409         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14410         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14411         /// The number of elements pointed to by `data`.
14412         pub datalen: usize
14413 }
14414 impl CVec_UpdateFulfillHTLCZ {
14415         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14416                 if self.datalen == 0 { return Vec::new(); }
14417                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14418                 self.data = core::ptr::null_mut();
14419                 self.datalen = 0;
14420                 ret
14421         }
14422         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14423                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14424         }
14425 }
14426 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14427         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14428                 let datalen = v.len();
14429                 let data = Box::into_raw(v.into_boxed_slice());
14430                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14431         }
14432 }
14433 #[no_mangle]
14434 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14435 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14436 impl Drop for CVec_UpdateFulfillHTLCZ {
14437         fn drop(&mut self) {
14438                 if self.datalen == 0 { return; }
14439                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14440         }
14441 }
14442 impl Clone for CVec_UpdateFulfillHTLCZ {
14443         fn clone(&self) -> Self {
14444                 let mut res = Vec::new();
14445                 if self.datalen == 0 { return Self::from(res); }
14446                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14447                 Self::from(res)
14448         }
14449 }
14450 #[repr(C)]
14451 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14452 /// This corresponds to std::vector in C++
14453 pub struct CVec_UpdateFailHTLCZ {
14454         /// The elements in the array.
14455         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14456         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14457         /// The number of elements pointed to by `data`.
14458         pub datalen: usize
14459 }
14460 impl CVec_UpdateFailHTLCZ {
14461         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14462                 if self.datalen == 0 { return Vec::new(); }
14463                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14464                 self.data = core::ptr::null_mut();
14465                 self.datalen = 0;
14466                 ret
14467         }
14468         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14469                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14470         }
14471 }
14472 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14473         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14474                 let datalen = v.len();
14475                 let data = Box::into_raw(v.into_boxed_slice());
14476                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14477         }
14478 }
14479 #[no_mangle]
14480 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14481 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14482 impl Drop for CVec_UpdateFailHTLCZ {
14483         fn drop(&mut self) {
14484                 if self.datalen == 0 { return; }
14485                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14486         }
14487 }
14488 impl Clone for CVec_UpdateFailHTLCZ {
14489         fn clone(&self) -> Self {
14490                 let mut res = Vec::new();
14491                 if self.datalen == 0 { return Self::from(res); }
14492                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14493                 Self::from(res)
14494         }
14495 }
14496 #[repr(C)]
14497 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14498 /// This corresponds to std::vector in C++
14499 pub struct CVec_UpdateFailMalformedHTLCZ {
14500         /// The elements in the array.
14501         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14502         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14503         /// The number of elements pointed to by `data`.
14504         pub datalen: usize
14505 }
14506 impl CVec_UpdateFailMalformedHTLCZ {
14507         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14508                 if self.datalen == 0 { return Vec::new(); }
14509                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14510                 self.data = core::ptr::null_mut();
14511                 self.datalen = 0;
14512                 ret
14513         }
14514         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14515                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14516         }
14517 }
14518 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14519         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14520                 let datalen = v.len();
14521                 let data = Box::into_raw(v.into_boxed_slice());
14522                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14523         }
14524 }
14525 #[no_mangle]
14526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14527 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14528 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14529         fn drop(&mut self) {
14530                 if self.datalen == 0 { return; }
14531                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14532         }
14533 }
14534 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14535         fn clone(&self) -> Self {
14536                 let mut res = Vec::new();
14537                 if self.datalen == 0 { return Self::from(res); }
14538                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14539                 Self::from(res)
14540         }
14541 }
14542 #[repr(C)]
14543 /// The contents of CResult_AcceptChannelDecodeErrorZ
14544 pub union CResult_AcceptChannelDecodeErrorZPtr {
14545         /// A pointer to the contents in the success state.
14546         /// Reading from this pointer when `result_ok` is not set is undefined.
14547         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14548         /// A pointer to the contents in the error state.
14549         /// Reading from this pointer when `result_ok` is set is undefined.
14550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14551 }
14552 #[repr(C)]
14553 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14554 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14556 pub struct CResult_AcceptChannelDecodeErrorZ {
14557         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14558         /// `err` or `result` depending on the state of `result_ok`.
14559         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14560         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14561         pub result_ok: bool,
14562 }
14563 #[no_mangle]
14564 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14565 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14566         CResult_AcceptChannelDecodeErrorZ {
14567                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14568                         result: Box::into_raw(Box::new(o)),
14569                 },
14570                 result_ok: true,
14571         }
14572 }
14573 #[no_mangle]
14574 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14575 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14576         CResult_AcceptChannelDecodeErrorZ {
14577                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14578                         err: Box::into_raw(Box::new(e)),
14579                 },
14580                 result_ok: false,
14581         }
14582 }
14583 /// Checks if the given object is currently in the success state
14584 #[no_mangle]
14585 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14586         o.result_ok
14587 }
14588 #[no_mangle]
14589 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14590 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14591 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14592         fn drop(&mut self) {
14593                 if self.result_ok {
14594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14596                         }
14597                 } else {
14598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14600                         }
14601                 }
14602         }
14603 }
14604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14606                 let contents = if o.result_ok {
14607                         let result = unsafe { o.contents.result };
14608                         unsafe { o.contents.result = core::ptr::null_mut() };
14609                         CResult_AcceptChannelDecodeErrorZPtr { result }
14610                 } else {
14611                         let err = unsafe { o.contents.err };
14612                         unsafe { o.contents.err = core::ptr::null_mut(); }
14613                         CResult_AcceptChannelDecodeErrorZPtr { err }
14614                 };
14615                 Self {
14616                         contents,
14617                         result_ok: o.result_ok,
14618                 }
14619         }
14620 }
14621 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14622         fn clone(&self) -> Self {
14623                 if self.result_ok {
14624                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14625                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14626                         } }
14627                 } else {
14628                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14630                         } }
14631                 }
14632         }
14633 }
14634 #[no_mangle]
14635 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14636 /// but with all dynamically-allocated buffers duplicated in new buffers.
14637 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14638 #[repr(C)]
14639 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14640 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14641         /// A pointer to the contents in the success state.
14642         /// Reading from this pointer when `result_ok` is not set is undefined.
14643         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14644         /// A pointer to the contents in the error state.
14645         /// Reading from this pointer when `result_ok` is set is undefined.
14646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14647 }
14648 #[repr(C)]
14649 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14650 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14652 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14653         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14654         /// `err` or `result` depending on the state of `result_ok`.
14655         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14656         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14657         pub result_ok: bool,
14658 }
14659 #[no_mangle]
14660 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14661 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14662         CResult_AnnouncementSignaturesDecodeErrorZ {
14663                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14664                         result: Box::into_raw(Box::new(o)),
14665                 },
14666                 result_ok: true,
14667         }
14668 }
14669 #[no_mangle]
14670 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14671 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14672         CResult_AnnouncementSignaturesDecodeErrorZ {
14673                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14674                         err: Box::into_raw(Box::new(e)),
14675                 },
14676                 result_ok: false,
14677         }
14678 }
14679 /// Checks if the given object is currently in the success state
14680 #[no_mangle]
14681 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14682         o.result_ok
14683 }
14684 #[no_mangle]
14685 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14686 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14687 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14688         fn drop(&mut self) {
14689                 if self.result_ok {
14690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14692                         }
14693                 } else {
14694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14696                         }
14697                 }
14698         }
14699 }
14700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14702                 let contents = if o.result_ok {
14703                         let result = unsafe { o.contents.result };
14704                         unsafe { o.contents.result = core::ptr::null_mut() };
14705                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14706                 } else {
14707                         let err = unsafe { o.contents.err };
14708                         unsafe { o.contents.err = core::ptr::null_mut(); }
14709                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14710                 };
14711                 Self {
14712                         contents,
14713                         result_ok: o.result_ok,
14714                 }
14715         }
14716 }
14717 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14718         fn clone(&self) -> Self {
14719                 if self.result_ok {
14720                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14721                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14722                         } }
14723                 } else {
14724                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14726                         } }
14727                 }
14728         }
14729 }
14730 #[no_mangle]
14731 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14732 /// but with all dynamically-allocated buffers duplicated in new buffers.
14733 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14734 #[repr(C)]
14735 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14736 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14737         /// A pointer to the contents in the success state.
14738         /// Reading from this pointer when `result_ok` is not set is undefined.
14739         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14740         /// A pointer to the contents in the error state.
14741         /// Reading from this pointer when `result_ok` is set is undefined.
14742         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14743 }
14744 #[repr(C)]
14745 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14746 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14748 pub struct CResult_ChannelReestablishDecodeErrorZ {
14749         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14750         /// `err` or `result` depending on the state of `result_ok`.
14751         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14752         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14753         pub result_ok: bool,
14754 }
14755 #[no_mangle]
14756 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14757 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14758         CResult_ChannelReestablishDecodeErrorZ {
14759                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14760                         result: Box::into_raw(Box::new(o)),
14761                 },
14762                 result_ok: true,
14763         }
14764 }
14765 #[no_mangle]
14766 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14767 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14768         CResult_ChannelReestablishDecodeErrorZ {
14769                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14770                         err: Box::into_raw(Box::new(e)),
14771                 },
14772                 result_ok: false,
14773         }
14774 }
14775 /// Checks if the given object is currently in the success state
14776 #[no_mangle]
14777 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14778         o.result_ok
14779 }
14780 #[no_mangle]
14781 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14782 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14783 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14784         fn drop(&mut self) {
14785                 if self.result_ok {
14786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14788                         }
14789                 } else {
14790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14792                         }
14793                 }
14794         }
14795 }
14796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14797         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14798                 let contents = if o.result_ok {
14799                         let result = unsafe { o.contents.result };
14800                         unsafe { o.contents.result = core::ptr::null_mut() };
14801                         CResult_ChannelReestablishDecodeErrorZPtr { result }
14802                 } else {
14803                         let err = unsafe { o.contents.err };
14804                         unsafe { o.contents.err = core::ptr::null_mut(); }
14805                         CResult_ChannelReestablishDecodeErrorZPtr { err }
14806                 };
14807                 Self {
14808                         contents,
14809                         result_ok: o.result_ok,
14810                 }
14811         }
14812 }
14813 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14814         fn clone(&self) -> Self {
14815                 if self.result_ok {
14816                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14817                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14818                         } }
14819                 } else {
14820                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14821                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14822                         } }
14823                 }
14824         }
14825 }
14826 #[no_mangle]
14827 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14828 /// but with all dynamically-allocated buffers duplicated in new buffers.
14829 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14830 #[repr(C)]
14831 /// The contents of CResult_ClosingSignedDecodeErrorZ
14832 pub union CResult_ClosingSignedDecodeErrorZPtr {
14833         /// A pointer to the contents in the success state.
14834         /// Reading from this pointer when `result_ok` is not set is undefined.
14835         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14836         /// A pointer to the contents in the error state.
14837         /// Reading from this pointer when `result_ok` is set is undefined.
14838         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14839 }
14840 #[repr(C)]
14841 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14842 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14844 pub struct CResult_ClosingSignedDecodeErrorZ {
14845         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14846         /// `err` or `result` depending on the state of `result_ok`.
14847         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14848         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14849         pub result_ok: bool,
14850 }
14851 #[no_mangle]
14852 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14853 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14854         CResult_ClosingSignedDecodeErrorZ {
14855                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14856                         result: Box::into_raw(Box::new(o)),
14857                 },
14858                 result_ok: true,
14859         }
14860 }
14861 #[no_mangle]
14862 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14863 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14864         CResult_ClosingSignedDecodeErrorZ {
14865                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14866                         err: Box::into_raw(Box::new(e)),
14867                 },
14868                 result_ok: false,
14869         }
14870 }
14871 /// Checks if the given object is currently in the success state
14872 #[no_mangle]
14873 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14874         o.result_ok
14875 }
14876 #[no_mangle]
14877 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14878 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14879 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14880         fn drop(&mut self) {
14881                 if self.result_ok {
14882                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14883                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14884                         }
14885                 } else {
14886                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14887                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14888                         }
14889                 }
14890         }
14891 }
14892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14893         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14894                 let contents = if o.result_ok {
14895                         let result = unsafe { o.contents.result };
14896                         unsafe { o.contents.result = core::ptr::null_mut() };
14897                         CResult_ClosingSignedDecodeErrorZPtr { result }
14898                 } else {
14899                         let err = unsafe { o.contents.err };
14900                         unsafe { o.contents.err = core::ptr::null_mut(); }
14901                         CResult_ClosingSignedDecodeErrorZPtr { err }
14902                 };
14903                 Self {
14904                         contents,
14905                         result_ok: o.result_ok,
14906                 }
14907         }
14908 }
14909 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14910         fn clone(&self) -> Self {
14911                 if self.result_ok {
14912                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14913                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14914                         } }
14915                 } else {
14916                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14917                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14918                         } }
14919                 }
14920         }
14921 }
14922 #[no_mangle]
14923 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14924 /// but with all dynamically-allocated buffers duplicated in new buffers.
14925 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14926 #[repr(C)]
14927 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14928 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14929         /// A pointer to the contents in the success state.
14930         /// Reading from this pointer when `result_ok` is not set is undefined.
14931         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14932         /// A pointer to the contents in the error state.
14933         /// Reading from this pointer when `result_ok` is set is undefined.
14934         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14935 }
14936 #[repr(C)]
14937 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14938 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14940 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14941         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14942         /// `err` or `result` depending on the state of `result_ok`.
14943         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14944         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14945         pub result_ok: bool,
14946 }
14947 #[no_mangle]
14948 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14949 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14950         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14951                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14952                         result: Box::into_raw(Box::new(o)),
14953                 },
14954                 result_ok: true,
14955         }
14956 }
14957 #[no_mangle]
14958 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14959 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14960         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14961                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14962                         err: Box::into_raw(Box::new(e)),
14963                 },
14964                 result_ok: false,
14965         }
14966 }
14967 /// Checks if the given object is currently in the success state
14968 #[no_mangle]
14969 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14970         o.result_ok
14971 }
14972 #[no_mangle]
14973 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14974 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14975 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14976         fn drop(&mut self) {
14977                 if self.result_ok {
14978                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14979                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14980                         }
14981                 } else {
14982                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14983                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14984                         }
14985                 }
14986         }
14987 }
14988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14989         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14990                 let contents = if o.result_ok {
14991                         let result = unsafe { o.contents.result };
14992                         unsafe { o.contents.result = core::ptr::null_mut() };
14993                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14994                 } else {
14995                         let err = unsafe { o.contents.err };
14996                         unsafe { o.contents.err = core::ptr::null_mut(); }
14997                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14998                 };
14999                 Self {
15000                         contents,
15001                         result_ok: o.result_ok,
15002                 }
15003         }
15004 }
15005 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
15006         fn clone(&self) -> Self {
15007                 if self.result_ok {
15008                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15009                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
15010                         } }
15011                 } else {
15012                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15013                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15014                         } }
15015                 }
15016         }
15017 }
15018 #[no_mangle]
15019 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15020 /// but with all dynamically-allocated buffers duplicated in new buffers.
15021 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
15022 #[repr(C)]
15023 /// The contents of CResult_CommitmentSignedDecodeErrorZ
15024 pub union CResult_CommitmentSignedDecodeErrorZPtr {
15025         /// A pointer to the contents in the success state.
15026         /// Reading from this pointer when `result_ok` is not set is undefined.
15027         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
15028         /// A pointer to the contents in the error state.
15029         /// Reading from this pointer when `result_ok` is set is undefined.
15030         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15031 }
15032 #[repr(C)]
15033 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
15034 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15036 pub struct CResult_CommitmentSignedDecodeErrorZ {
15037         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
15038         /// `err` or `result` depending on the state of `result_ok`.
15039         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
15040         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
15041         pub result_ok: bool,
15042 }
15043 #[no_mangle]
15044 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15045 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
15046         CResult_CommitmentSignedDecodeErrorZ {
15047                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15048                         result: Box::into_raw(Box::new(o)),
15049                 },
15050                 result_ok: true,
15051         }
15052 }
15053 #[no_mangle]
15054 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15055 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
15056         CResult_CommitmentSignedDecodeErrorZ {
15057                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15058                         err: Box::into_raw(Box::new(e)),
15059                 },
15060                 result_ok: false,
15061         }
15062 }
15063 /// Checks if the given object is currently in the success state
15064 #[no_mangle]
15065 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
15066         o.result_ok
15067 }
15068 #[no_mangle]
15069 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15070 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
15071 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
15072         fn drop(&mut self) {
15073                 if self.result_ok {
15074                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15075                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15076                         }
15077                 } else {
15078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15080                         }
15081                 }
15082         }
15083 }
15084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15086                 let contents = if o.result_ok {
15087                         let result = unsafe { o.contents.result };
15088                         unsafe { o.contents.result = core::ptr::null_mut() };
15089                         CResult_CommitmentSignedDecodeErrorZPtr { result }
15090                 } else {
15091                         let err = unsafe { o.contents.err };
15092                         unsafe { o.contents.err = core::ptr::null_mut(); }
15093                         CResult_CommitmentSignedDecodeErrorZPtr { err }
15094                 };
15095                 Self {
15096                         contents,
15097                         result_ok: o.result_ok,
15098                 }
15099         }
15100 }
15101 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15102         fn clone(&self) -> Self {
15103                 if self.result_ok {
15104                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15105                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15106                         } }
15107                 } else {
15108                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15109                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15110                         } }
15111                 }
15112         }
15113 }
15114 #[no_mangle]
15115 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15116 /// but with all dynamically-allocated buffers duplicated in new buffers.
15117 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15118 #[repr(C)]
15119 /// The contents of CResult_FundingCreatedDecodeErrorZ
15120 pub union CResult_FundingCreatedDecodeErrorZPtr {
15121         /// A pointer to the contents in the success state.
15122         /// Reading from this pointer when `result_ok` is not set is undefined.
15123         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15124         /// A pointer to the contents in the error state.
15125         /// Reading from this pointer when `result_ok` is set is undefined.
15126         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15127 }
15128 #[repr(C)]
15129 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15130 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15132 pub struct CResult_FundingCreatedDecodeErrorZ {
15133         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15134         /// `err` or `result` depending on the state of `result_ok`.
15135         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15136         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15137         pub result_ok: bool,
15138 }
15139 #[no_mangle]
15140 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15141 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15142         CResult_FundingCreatedDecodeErrorZ {
15143                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15144                         result: Box::into_raw(Box::new(o)),
15145                 },
15146                 result_ok: true,
15147         }
15148 }
15149 #[no_mangle]
15150 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15151 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15152         CResult_FundingCreatedDecodeErrorZ {
15153                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15154                         err: Box::into_raw(Box::new(e)),
15155                 },
15156                 result_ok: false,
15157         }
15158 }
15159 /// Checks if the given object is currently in the success state
15160 #[no_mangle]
15161 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15162         o.result_ok
15163 }
15164 #[no_mangle]
15165 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15166 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15167 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15168         fn drop(&mut self) {
15169                 if self.result_ok {
15170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15172                         }
15173                 } else {
15174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15176                         }
15177                 }
15178         }
15179 }
15180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15182                 let contents = if o.result_ok {
15183                         let result = unsafe { o.contents.result };
15184                         unsafe { o.contents.result = core::ptr::null_mut() };
15185                         CResult_FundingCreatedDecodeErrorZPtr { result }
15186                 } else {
15187                         let err = unsafe { o.contents.err };
15188                         unsafe { o.contents.err = core::ptr::null_mut(); }
15189                         CResult_FundingCreatedDecodeErrorZPtr { err }
15190                 };
15191                 Self {
15192                         contents,
15193                         result_ok: o.result_ok,
15194                 }
15195         }
15196 }
15197 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15198         fn clone(&self) -> Self {
15199                 if self.result_ok {
15200                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15201                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15202                         } }
15203                 } else {
15204                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15205                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15206                         } }
15207                 }
15208         }
15209 }
15210 #[no_mangle]
15211 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15212 /// but with all dynamically-allocated buffers duplicated in new buffers.
15213 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15214 #[repr(C)]
15215 /// The contents of CResult_FundingSignedDecodeErrorZ
15216 pub union CResult_FundingSignedDecodeErrorZPtr {
15217         /// A pointer to the contents in the success state.
15218         /// Reading from this pointer when `result_ok` is not set is undefined.
15219         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15220         /// A pointer to the contents in the error state.
15221         /// Reading from this pointer when `result_ok` is set is undefined.
15222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15223 }
15224 #[repr(C)]
15225 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15226 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15228 pub struct CResult_FundingSignedDecodeErrorZ {
15229         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15230         /// `err` or `result` depending on the state of `result_ok`.
15231         pub contents: CResult_FundingSignedDecodeErrorZPtr,
15232         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15233         pub result_ok: bool,
15234 }
15235 #[no_mangle]
15236 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15237 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15238         CResult_FundingSignedDecodeErrorZ {
15239                 contents: CResult_FundingSignedDecodeErrorZPtr {
15240                         result: Box::into_raw(Box::new(o)),
15241                 },
15242                 result_ok: true,
15243         }
15244 }
15245 #[no_mangle]
15246 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15247 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15248         CResult_FundingSignedDecodeErrorZ {
15249                 contents: CResult_FundingSignedDecodeErrorZPtr {
15250                         err: Box::into_raw(Box::new(e)),
15251                 },
15252                 result_ok: false,
15253         }
15254 }
15255 /// Checks if the given object is currently in the success state
15256 #[no_mangle]
15257 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15258         o.result_ok
15259 }
15260 #[no_mangle]
15261 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15262 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15263 impl Drop for CResult_FundingSignedDecodeErrorZ {
15264         fn drop(&mut self) {
15265                 if self.result_ok {
15266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15268                         }
15269                 } else {
15270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15272                         }
15273                 }
15274         }
15275 }
15276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15277         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15278                 let contents = if o.result_ok {
15279                         let result = unsafe { o.contents.result };
15280                         unsafe { o.contents.result = core::ptr::null_mut() };
15281                         CResult_FundingSignedDecodeErrorZPtr { result }
15282                 } else {
15283                         let err = unsafe { o.contents.err };
15284                         unsafe { o.contents.err = core::ptr::null_mut(); }
15285                         CResult_FundingSignedDecodeErrorZPtr { err }
15286                 };
15287                 Self {
15288                         contents,
15289                         result_ok: o.result_ok,
15290                 }
15291         }
15292 }
15293 impl Clone for CResult_FundingSignedDecodeErrorZ {
15294         fn clone(&self) -> Self {
15295                 if self.result_ok {
15296                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15297                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15298                         } }
15299                 } else {
15300                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15301                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15302                         } }
15303                 }
15304         }
15305 }
15306 #[no_mangle]
15307 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15308 /// but with all dynamically-allocated buffers duplicated in new buffers.
15309 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15310 #[repr(C)]
15311 /// The contents of CResult_ChannelReadyDecodeErrorZ
15312 pub union CResult_ChannelReadyDecodeErrorZPtr {
15313         /// A pointer to the contents in the success state.
15314         /// Reading from this pointer when `result_ok` is not set is undefined.
15315         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15316         /// A pointer to the contents in the error state.
15317         /// Reading from this pointer when `result_ok` is set is undefined.
15318         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15319 }
15320 #[repr(C)]
15321 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_ChannelReadyDecodeErrorZ {
15325         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15326         /// `err` or `result` depending on the state of `result_ok`.
15327         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15328         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15329         pub result_ok: bool,
15330 }
15331 #[no_mangle]
15332 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15333 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15334         CResult_ChannelReadyDecodeErrorZ {
15335                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15336                         result: Box::into_raw(Box::new(o)),
15337                 },
15338                 result_ok: true,
15339         }
15340 }
15341 #[no_mangle]
15342 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15343 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15344         CResult_ChannelReadyDecodeErrorZ {
15345                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15346                         err: Box::into_raw(Box::new(e)),
15347                 },
15348                 result_ok: false,
15349         }
15350 }
15351 /// Checks if the given object is currently in the success state
15352 #[no_mangle]
15353 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15354         o.result_ok
15355 }
15356 #[no_mangle]
15357 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15358 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15359 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15360         fn drop(&mut self) {
15361                 if self.result_ok {
15362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15364                         }
15365                 } else {
15366                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15367                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15368                         }
15369                 }
15370         }
15371 }
15372 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15373         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15374                 let contents = if o.result_ok {
15375                         let result = unsafe { o.contents.result };
15376                         unsafe { o.contents.result = core::ptr::null_mut() };
15377                         CResult_ChannelReadyDecodeErrorZPtr { result }
15378                 } else {
15379                         let err = unsafe { o.contents.err };
15380                         unsafe { o.contents.err = core::ptr::null_mut(); }
15381                         CResult_ChannelReadyDecodeErrorZPtr { err }
15382                 };
15383                 Self {
15384                         contents,
15385                         result_ok: o.result_ok,
15386                 }
15387         }
15388 }
15389 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15390         fn clone(&self) -> Self {
15391                 if self.result_ok {
15392                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15393                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15394                         } }
15395                 } else {
15396                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15397                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15398                         } }
15399                 }
15400         }
15401 }
15402 #[no_mangle]
15403 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15404 /// but with all dynamically-allocated buffers duplicated in new buffers.
15405 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15406 #[repr(C)]
15407 /// The contents of CResult_InitDecodeErrorZ
15408 pub union CResult_InitDecodeErrorZPtr {
15409         /// A pointer to the contents in the success state.
15410         /// Reading from this pointer when `result_ok` is not set is undefined.
15411         pub result: *mut crate::lightning::ln::msgs::Init,
15412         /// A pointer to the contents in the error state.
15413         /// Reading from this pointer when `result_ok` is set is undefined.
15414         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15415 }
15416 #[repr(C)]
15417 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15418 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15420 pub struct CResult_InitDecodeErrorZ {
15421         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15422         /// `err` or `result` depending on the state of `result_ok`.
15423         pub contents: CResult_InitDecodeErrorZPtr,
15424         /// Whether this CResult_InitDecodeErrorZ represents a success state.
15425         pub result_ok: bool,
15426 }
15427 #[no_mangle]
15428 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15429 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15430         CResult_InitDecodeErrorZ {
15431                 contents: CResult_InitDecodeErrorZPtr {
15432                         result: Box::into_raw(Box::new(o)),
15433                 },
15434                 result_ok: true,
15435         }
15436 }
15437 #[no_mangle]
15438 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15439 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15440         CResult_InitDecodeErrorZ {
15441                 contents: CResult_InitDecodeErrorZPtr {
15442                         err: Box::into_raw(Box::new(e)),
15443                 },
15444                 result_ok: false,
15445         }
15446 }
15447 /// Checks if the given object is currently in the success state
15448 #[no_mangle]
15449 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15450         o.result_ok
15451 }
15452 #[no_mangle]
15453 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15454 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15455 impl Drop for CResult_InitDecodeErrorZ {
15456         fn drop(&mut self) {
15457                 if self.result_ok {
15458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15460                         }
15461                 } else {
15462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15464                         }
15465                 }
15466         }
15467 }
15468 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15469         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15470                 let contents = if o.result_ok {
15471                         let result = unsafe { o.contents.result };
15472                         unsafe { o.contents.result = core::ptr::null_mut() };
15473                         CResult_InitDecodeErrorZPtr { result }
15474                 } else {
15475                         let err = unsafe { o.contents.err };
15476                         unsafe { o.contents.err = core::ptr::null_mut(); }
15477                         CResult_InitDecodeErrorZPtr { err }
15478                 };
15479                 Self {
15480                         contents,
15481                         result_ok: o.result_ok,
15482                 }
15483         }
15484 }
15485 impl Clone for CResult_InitDecodeErrorZ {
15486         fn clone(&self) -> Self {
15487                 if self.result_ok {
15488                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15489                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15490                         } }
15491                 } else {
15492                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15493                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15494                         } }
15495                 }
15496         }
15497 }
15498 #[no_mangle]
15499 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15500 /// but with all dynamically-allocated buffers duplicated in new buffers.
15501 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15502 #[repr(C)]
15503 /// The contents of CResult_OpenChannelDecodeErrorZ
15504 pub union CResult_OpenChannelDecodeErrorZPtr {
15505         /// A pointer to the contents in the success state.
15506         /// Reading from this pointer when `result_ok` is not set is undefined.
15507         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15508         /// A pointer to the contents in the error state.
15509         /// Reading from this pointer when `result_ok` is set is undefined.
15510         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15511 }
15512 #[repr(C)]
15513 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15514 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15516 pub struct CResult_OpenChannelDecodeErrorZ {
15517         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15518         /// `err` or `result` depending on the state of `result_ok`.
15519         pub contents: CResult_OpenChannelDecodeErrorZPtr,
15520         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15521         pub result_ok: bool,
15522 }
15523 #[no_mangle]
15524 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15525 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15526         CResult_OpenChannelDecodeErrorZ {
15527                 contents: CResult_OpenChannelDecodeErrorZPtr {
15528                         result: Box::into_raw(Box::new(o)),
15529                 },
15530                 result_ok: true,
15531         }
15532 }
15533 #[no_mangle]
15534 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15535 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15536         CResult_OpenChannelDecodeErrorZ {
15537                 contents: CResult_OpenChannelDecodeErrorZPtr {
15538                         err: Box::into_raw(Box::new(e)),
15539                 },
15540                 result_ok: false,
15541         }
15542 }
15543 /// Checks if the given object is currently in the success state
15544 #[no_mangle]
15545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15546         o.result_ok
15547 }
15548 #[no_mangle]
15549 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15550 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15551 impl Drop for CResult_OpenChannelDecodeErrorZ {
15552         fn drop(&mut self) {
15553                 if self.result_ok {
15554                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15555                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15556                         }
15557                 } else {
15558                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15559                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15560                         }
15561                 }
15562         }
15563 }
15564 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15565         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15566                 let contents = if o.result_ok {
15567                         let result = unsafe { o.contents.result };
15568                         unsafe { o.contents.result = core::ptr::null_mut() };
15569                         CResult_OpenChannelDecodeErrorZPtr { result }
15570                 } else {
15571                         let err = unsafe { o.contents.err };
15572                         unsafe { o.contents.err = core::ptr::null_mut(); }
15573                         CResult_OpenChannelDecodeErrorZPtr { err }
15574                 };
15575                 Self {
15576                         contents,
15577                         result_ok: o.result_ok,
15578                 }
15579         }
15580 }
15581 impl Clone for CResult_OpenChannelDecodeErrorZ {
15582         fn clone(&self) -> Self {
15583                 if self.result_ok {
15584                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15585                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15586                         } }
15587                 } else {
15588                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15589                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15590                         } }
15591                 }
15592         }
15593 }
15594 #[no_mangle]
15595 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15596 /// but with all dynamically-allocated buffers duplicated in new buffers.
15597 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15598 #[repr(C)]
15599 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15600 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15601         /// A pointer to the contents in the success state.
15602         /// Reading from this pointer when `result_ok` is not set is undefined.
15603         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15604         /// A pointer to the contents in the error state.
15605         /// Reading from this pointer when `result_ok` is set is undefined.
15606         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15607 }
15608 #[repr(C)]
15609 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15610 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15612 pub struct CResult_RevokeAndACKDecodeErrorZ {
15613         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15614         /// `err` or `result` depending on the state of `result_ok`.
15615         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15616         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15617         pub result_ok: bool,
15618 }
15619 #[no_mangle]
15620 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15621 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15622         CResult_RevokeAndACKDecodeErrorZ {
15623                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15624                         result: Box::into_raw(Box::new(o)),
15625                 },
15626                 result_ok: true,
15627         }
15628 }
15629 #[no_mangle]
15630 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15631 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15632         CResult_RevokeAndACKDecodeErrorZ {
15633                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15634                         err: Box::into_raw(Box::new(e)),
15635                 },
15636                 result_ok: false,
15637         }
15638 }
15639 /// Checks if the given object is currently in the success state
15640 #[no_mangle]
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15642         o.result_ok
15643 }
15644 #[no_mangle]
15645 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15646 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15647 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15648         fn drop(&mut self) {
15649                 if self.result_ok {
15650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15652                         }
15653                 } else {
15654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15656                         }
15657                 }
15658         }
15659 }
15660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15662                 let contents = if o.result_ok {
15663                         let result = unsafe { o.contents.result };
15664                         unsafe { o.contents.result = core::ptr::null_mut() };
15665                         CResult_RevokeAndACKDecodeErrorZPtr { result }
15666                 } else {
15667                         let err = unsafe { o.contents.err };
15668                         unsafe { o.contents.err = core::ptr::null_mut(); }
15669                         CResult_RevokeAndACKDecodeErrorZPtr { err }
15670                 };
15671                 Self {
15672                         contents,
15673                         result_ok: o.result_ok,
15674                 }
15675         }
15676 }
15677 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15678         fn clone(&self) -> Self {
15679                 if self.result_ok {
15680                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15681                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15682                         } }
15683                 } else {
15684                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15685                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15686                         } }
15687                 }
15688         }
15689 }
15690 #[no_mangle]
15691 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15692 /// but with all dynamically-allocated buffers duplicated in new buffers.
15693 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15694 #[repr(C)]
15695 /// The contents of CResult_ShutdownDecodeErrorZ
15696 pub union CResult_ShutdownDecodeErrorZPtr {
15697         /// A pointer to the contents in the success state.
15698         /// Reading from this pointer when `result_ok` is not set is undefined.
15699         pub result: *mut crate::lightning::ln::msgs::Shutdown,
15700         /// A pointer to the contents in the error state.
15701         /// Reading from this pointer when `result_ok` is set is undefined.
15702         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15703 }
15704 #[repr(C)]
15705 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15706 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15708 pub struct CResult_ShutdownDecodeErrorZ {
15709         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15710         /// `err` or `result` depending on the state of `result_ok`.
15711         pub contents: CResult_ShutdownDecodeErrorZPtr,
15712         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15713         pub result_ok: bool,
15714 }
15715 #[no_mangle]
15716 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15717 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15718         CResult_ShutdownDecodeErrorZ {
15719                 contents: CResult_ShutdownDecodeErrorZPtr {
15720                         result: Box::into_raw(Box::new(o)),
15721                 },
15722                 result_ok: true,
15723         }
15724 }
15725 #[no_mangle]
15726 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15727 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15728         CResult_ShutdownDecodeErrorZ {
15729                 contents: CResult_ShutdownDecodeErrorZPtr {
15730                         err: Box::into_raw(Box::new(e)),
15731                 },
15732                 result_ok: false,
15733         }
15734 }
15735 /// Checks if the given object is currently in the success state
15736 #[no_mangle]
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15738         o.result_ok
15739 }
15740 #[no_mangle]
15741 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15742 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15743 impl Drop for CResult_ShutdownDecodeErrorZ {
15744         fn drop(&mut self) {
15745                 if self.result_ok {
15746                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15747                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15748                         }
15749                 } else {
15750                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15751                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15752                         }
15753                 }
15754         }
15755 }
15756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15757         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15758                 let contents = if o.result_ok {
15759                         let result = unsafe { o.contents.result };
15760                         unsafe { o.contents.result = core::ptr::null_mut() };
15761                         CResult_ShutdownDecodeErrorZPtr { result }
15762                 } else {
15763                         let err = unsafe { o.contents.err };
15764                         unsafe { o.contents.err = core::ptr::null_mut(); }
15765                         CResult_ShutdownDecodeErrorZPtr { err }
15766                 };
15767                 Self {
15768                         contents,
15769                         result_ok: o.result_ok,
15770                 }
15771         }
15772 }
15773 impl Clone for CResult_ShutdownDecodeErrorZ {
15774         fn clone(&self) -> Self {
15775                 if self.result_ok {
15776                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15777                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15778                         } }
15779                 } else {
15780                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15781                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15782                         } }
15783                 }
15784         }
15785 }
15786 #[no_mangle]
15787 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15788 /// but with all dynamically-allocated buffers duplicated in new buffers.
15789 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15790 #[repr(C)]
15791 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15792 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15793         /// A pointer to the contents in the success state.
15794         /// Reading from this pointer when `result_ok` is not set is undefined.
15795         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15796         /// A pointer to the contents in the error state.
15797         /// Reading from this pointer when `result_ok` is set is undefined.
15798         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15799 }
15800 #[repr(C)]
15801 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15802 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15804 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15805         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15806         /// `err` or `result` depending on the state of `result_ok`.
15807         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15808         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15809         pub result_ok: bool,
15810 }
15811 #[no_mangle]
15812 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15813 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15814         CResult_UpdateFailHTLCDecodeErrorZ {
15815                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15816                         result: Box::into_raw(Box::new(o)),
15817                 },
15818                 result_ok: true,
15819         }
15820 }
15821 #[no_mangle]
15822 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15823 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15824         CResult_UpdateFailHTLCDecodeErrorZ {
15825                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15826                         err: Box::into_raw(Box::new(e)),
15827                 },
15828                 result_ok: false,
15829         }
15830 }
15831 /// Checks if the given object is currently in the success state
15832 #[no_mangle]
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15834         o.result_ok
15835 }
15836 #[no_mangle]
15837 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15838 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15839 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15840         fn drop(&mut self) {
15841                 if self.result_ok {
15842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15844                         }
15845                 } else {
15846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15848                         }
15849                 }
15850         }
15851 }
15852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15853         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15854                 let contents = if o.result_ok {
15855                         let result = unsafe { o.contents.result };
15856                         unsafe { o.contents.result = core::ptr::null_mut() };
15857                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15858                 } else {
15859                         let err = unsafe { o.contents.err };
15860                         unsafe { o.contents.err = core::ptr::null_mut(); }
15861                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15862                 };
15863                 Self {
15864                         contents,
15865                         result_ok: o.result_ok,
15866                 }
15867         }
15868 }
15869 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15870         fn clone(&self) -> Self {
15871                 if self.result_ok {
15872                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15873                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15874                         } }
15875                 } else {
15876                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15877                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15878                         } }
15879                 }
15880         }
15881 }
15882 #[no_mangle]
15883 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15884 /// but with all dynamically-allocated buffers duplicated in new buffers.
15885 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15886 #[repr(C)]
15887 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15888 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15889         /// A pointer to the contents in the success state.
15890         /// Reading from this pointer when `result_ok` is not set is undefined.
15891         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15892         /// A pointer to the contents in the error state.
15893         /// Reading from this pointer when `result_ok` is set is undefined.
15894         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15895 }
15896 #[repr(C)]
15897 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15898 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15900 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15901         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15902         /// `err` or `result` depending on the state of `result_ok`.
15903         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15904         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15905         pub result_ok: bool,
15906 }
15907 #[no_mangle]
15908 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15909 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15910         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15911                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15912                         result: Box::into_raw(Box::new(o)),
15913                 },
15914                 result_ok: true,
15915         }
15916 }
15917 #[no_mangle]
15918 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15919 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15920         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15921                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15922                         err: Box::into_raw(Box::new(e)),
15923                 },
15924                 result_ok: false,
15925         }
15926 }
15927 /// Checks if the given object is currently in the success state
15928 #[no_mangle]
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15930         o.result_ok
15931 }
15932 #[no_mangle]
15933 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15934 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15935 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15936         fn drop(&mut self) {
15937                 if self.result_ok {
15938                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15939                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15940                         }
15941                 } else {
15942                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15943                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15944                         }
15945                 }
15946         }
15947 }
15948 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15949         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15950                 let contents = if o.result_ok {
15951                         let result = unsafe { o.contents.result };
15952                         unsafe { o.contents.result = core::ptr::null_mut() };
15953                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15954                 } else {
15955                         let err = unsafe { o.contents.err };
15956                         unsafe { o.contents.err = core::ptr::null_mut(); }
15957                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15958                 };
15959                 Self {
15960                         contents,
15961                         result_ok: o.result_ok,
15962                 }
15963         }
15964 }
15965 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15966         fn clone(&self) -> Self {
15967                 if self.result_ok {
15968                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15969                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15970                         } }
15971                 } else {
15972                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15973                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15974                         } }
15975                 }
15976         }
15977 }
15978 #[no_mangle]
15979 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15980 /// but with all dynamically-allocated buffers duplicated in new buffers.
15981 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15982 #[repr(C)]
15983 /// The contents of CResult_UpdateFeeDecodeErrorZ
15984 pub union CResult_UpdateFeeDecodeErrorZPtr {
15985         /// A pointer to the contents in the success state.
15986         /// Reading from this pointer when `result_ok` is not set is undefined.
15987         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15988         /// A pointer to the contents in the error state.
15989         /// Reading from this pointer when `result_ok` is set is undefined.
15990         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15991 }
15992 #[repr(C)]
15993 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15994 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15996 pub struct CResult_UpdateFeeDecodeErrorZ {
15997         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15998         /// `err` or `result` depending on the state of `result_ok`.
15999         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
16000         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
16001         pub result_ok: bool,
16002 }
16003 #[no_mangle]
16004 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16005 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16006         CResult_UpdateFeeDecodeErrorZ {
16007                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16008                         result: Box::into_raw(Box::new(o)),
16009                 },
16010                 result_ok: true,
16011         }
16012 }
16013 #[no_mangle]
16014 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16015 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16016         CResult_UpdateFeeDecodeErrorZ {
16017                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16018                         err: Box::into_raw(Box::new(e)),
16019                 },
16020                 result_ok: false,
16021         }
16022 }
16023 /// Checks if the given object is currently in the success state
16024 #[no_mangle]
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16026         o.result_ok
16027 }
16028 #[no_mangle]
16029 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16030 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16031 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16032         fn drop(&mut self) {
16033                 if self.result_ok {
16034                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16035                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16036                         }
16037                 } else {
16038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16040                         }
16041                 }
16042         }
16043 }
16044 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16045         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16046                 let contents = if o.result_ok {
16047                         let result = unsafe { o.contents.result };
16048                         unsafe { o.contents.result = core::ptr::null_mut() };
16049                         CResult_UpdateFeeDecodeErrorZPtr { result }
16050                 } else {
16051                         let err = unsafe { o.contents.err };
16052                         unsafe { o.contents.err = core::ptr::null_mut(); }
16053                         CResult_UpdateFeeDecodeErrorZPtr { err }
16054                 };
16055                 Self {
16056                         contents,
16057                         result_ok: o.result_ok,
16058                 }
16059         }
16060 }
16061 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16062         fn clone(&self) -> Self {
16063                 if self.result_ok {
16064                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16065                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16066                         } }
16067                 } else {
16068                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16069                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16070                         } }
16071                 }
16072         }
16073 }
16074 #[no_mangle]
16075 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16076 /// but with all dynamically-allocated buffers duplicated in new buffers.
16077 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16078 #[repr(C)]
16079 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16080 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16081         /// A pointer to the contents in the success state.
16082         /// Reading from this pointer when `result_ok` is not set is undefined.
16083         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16084         /// A pointer to the contents in the error state.
16085         /// Reading from this pointer when `result_ok` is set is undefined.
16086         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16087 }
16088 #[repr(C)]
16089 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16090 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16092 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16093         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16094         /// `err` or `result` depending on the state of `result_ok`.
16095         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16096         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16097         pub result_ok: bool,
16098 }
16099 #[no_mangle]
16100 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16101 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16102         CResult_UpdateFulfillHTLCDecodeErrorZ {
16103                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16104                         result: Box::into_raw(Box::new(o)),
16105                 },
16106                 result_ok: true,
16107         }
16108 }
16109 #[no_mangle]
16110 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16111 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16112         CResult_UpdateFulfillHTLCDecodeErrorZ {
16113                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16114                         err: Box::into_raw(Box::new(e)),
16115                 },
16116                 result_ok: false,
16117         }
16118 }
16119 /// Checks if the given object is currently in the success state
16120 #[no_mangle]
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16122         o.result_ok
16123 }
16124 #[no_mangle]
16125 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16126 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16127 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16128         fn drop(&mut self) {
16129                 if self.result_ok {
16130                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16131                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16132                         }
16133                 } else {
16134                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16135                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16136                         }
16137                 }
16138         }
16139 }
16140 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16141         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16142                 let contents = if o.result_ok {
16143                         let result = unsafe { o.contents.result };
16144                         unsafe { o.contents.result = core::ptr::null_mut() };
16145                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16146                 } else {
16147                         let err = unsafe { o.contents.err };
16148                         unsafe { o.contents.err = core::ptr::null_mut(); }
16149                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16150                 };
16151                 Self {
16152                         contents,
16153                         result_ok: o.result_ok,
16154                 }
16155         }
16156 }
16157 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16158         fn clone(&self) -> Self {
16159                 if self.result_ok {
16160                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16161                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16162                         } }
16163                 } else {
16164                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16165                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16166                         } }
16167                 }
16168         }
16169 }
16170 #[no_mangle]
16171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16172 /// but with all dynamically-allocated buffers duplicated in new buffers.
16173 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16174 #[repr(C)]
16175 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16176 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16177         /// A pointer to the contents in the success state.
16178         /// Reading from this pointer when `result_ok` is not set is undefined.
16179         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16180         /// A pointer to the contents in the error state.
16181         /// Reading from this pointer when `result_ok` is set is undefined.
16182         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16183 }
16184 #[repr(C)]
16185 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16186 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16188 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16189         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16190         /// `err` or `result` depending on the state of `result_ok`.
16191         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16192         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16193         pub result_ok: bool,
16194 }
16195 #[no_mangle]
16196 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16197 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16198         CResult_UpdateAddHTLCDecodeErrorZ {
16199                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16200                         result: Box::into_raw(Box::new(o)),
16201                 },
16202                 result_ok: true,
16203         }
16204 }
16205 #[no_mangle]
16206 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16207 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16208         CResult_UpdateAddHTLCDecodeErrorZ {
16209                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16210                         err: Box::into_raw(Box::new(e)),
16211                 },
16212                 result_ok: false,
16213         }
16214 }
16215 /// Checks if the given object is currently in the success state
16216 #[no_mangle]
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16218         o.result_ok
16219 }
16220 #[no_mangle]
16221 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16222 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16223 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16224         fn drop(&mut self) {
16225                 if self.result_ok {
16226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16228                         }
16229                 } else {
16230                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16231                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16232                         }
16233                 }
16234         }
16235 }
16236 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16237         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16238                 let contents = if o.result_ok {
16239                         let result = unsafe { o.contents.result };
16240                         unsafe { o.contents.result = core::ptr::null_mut() };
16241                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16242                 } else {
16243                         let err = unsafe { o.contents.err };
16244                         unsafe { o.contents.err = core::ptr::null_mut(); }
16245                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16246                 };
16247                 Self {
16248                         contents,
16249                         result_ok: o.result_ok,
16250                 }
16251         }
16252 }
16253 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16254         fn clone(&self) -> Self {
16255                 if self.result_ok {
16256                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16257                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16258                         } }
16259                 } else {
16260                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16261                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16262                         } }
16263                 }
16264         }
16265 }
16266 #[no_mangle]
16267 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16268 /// but with all dynamically-allocated buffers duplicated in new buffers.
16269 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16270 #[repr(C)]
16271 /// The contents of CResult_OnionMessageDecodeErrorZ
16272 pub union CResult_OnionMessageDecodeErrorZPtr {
16273         /// A pointer to the contents in the success state.
16274         /// Reading from this pointer when `result_ok` is not set is undefined.
16275         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16276         /// A pointer to the contents in the error state.
16277         /// Reading from this pointer when `result_ok` is set is undefined.
16278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16279 }
16280 #[repr(C)]
16281 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16282 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16284 pub struct CResult_OnionMessageDecodeErrorZ {
16285         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16286         /// `err` or `result` depending on the state of `result_ok`.
16287         pub contents: CResult_OnionMessageDecodeErrorZPtr,
16288         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16289         pub result_ok: bool,
16290 }
16291 #[no_mangle]
16292 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16293 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16294         CResult_OnionMessageDecodeErrorZ {
16295                 contents: CResult_OnionMessageDecodeErrorZPtr {
16296                         result: Box::into_raw(Box::new(o)),
16297                 },
16298                 result_ok: true,
16299         }
16300 }
16301 #[no_mangle]
16302 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16303 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16304         CResult_OnionMessageDecodeErrorZ {
16305                 contents: CResult_OnionMessageDecodeErrorZPtr {
16306                         err: Box::into_raw(Box::new(e)),
16307                 },
16308                 result_ok: false,
16309         }
16310 }
16311 /// Checks if the given object is currently in the success state
16312 #[no_mangle]
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16314         o.result_ok
16315 }
16316 #[no_mangle]
16317 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16318 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16319 impl Drop for CResult_OnionMessageDecodeErrorZ {
16320         fn drop(&mut self) {
16321                 if self.result_ok {
16322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16324                         }
16325                 } else {
16326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16328                         }
16329                 }
16330         }
16331 }
16332 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16334                 let contents = if o.result_ok {
16335                         let result = unsafe { o.contents.result };
16336                         unsafe { o.contents.result = core::ptr::null_mut() };
16337                         CResult_OnionMessageDecodeErrorZPtr { result }
16338                 } else {
16339                         let err = unsafe { o.contents.err };
16340                         unsafe { o.contents.err = core::ptr::null_mut(); }
16341                         CResult_OnionMessageDecodeErrorZPtr { err }
16342                 };
16343                 Self {
16344                         contents,
16345                         result_ok: o.result_ok,
16346                 }
16347         }
16348 }
16349 impl Clone for CResult_OnionMessageDecodeErrorZ {
16350         fn clone(&self) -> Self {
16351                 if self.result_ok {
16352                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16353                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16354                         } }
16355                 } else {
16356                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16358                         } }
16359                 }
16360         }
16361 }
16362 #[no_mangle]
16363 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16364 /// but with all dynamically-allocated buffers duplicated in new buffers.
16365 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16366 #[repr(C)]
16367 /// The contents of CResult_PingDecodeErrorZ
16368 pub union CResult_PingDecodeErrorZPtr {
16369         /// A pointer to the contents in the success state.
16370         /// Reading from this pointer when `result_ok` is not set is undefined.
16371         pub result: *mut crate::lightning::ln::msgs::Ping,
16372         /// A pointer to the contents in the error state.
16373         /// Reading from this pointer when `result_ok` is set is undefined.
16374         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16375 }
16376 #[repr(C)]
16377 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16378 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16380 pub struct CResult_PingDecodeErrorZ {
16381         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16382         /// `err` or `result` depending on the state of `result_ok`.
16383         pub contents: CResult_PingDecodeErrorZPtr,
16384         /// Whether this CResult_PingDecodeErrorZ represents a success state.
16385         pub result_ok: bool,
16386 }
16387 #[no_mangle]
16388 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16389 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16390         CResult_PingDecodeErrorZ {
16391                 contents: CResult_PingDecodeErrorZPtr {
16392                         result: Box::into_raw(Box::new(o)),
16393                 },
16394                 result_ok: true,
16395         }
16396 }
16397 #[no_mangle]
16398 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16399 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16400         CResult_PingDecodeErrorZ {
16401                 contents: CResult_PingDecodeErrorZPtr {
16402                         err: Box::into_raw(Box::new(e)),
16403                 },
16404                 result_ok: false,
16405         }
16406 }
16407 /// Checks if the given object is currently in the success state
16408 #[no_mangle]
16409 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16410         o.result_ok
16411 }
16412 #[no_mangle]
16413 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16414 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16415 impl Drop for CResult_PingDecodeErrorZ {
16416         fn drop(&mut self) {
16417                 if self.result_ok {
16418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16420                         }
16421                 } else {
16422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16424                         }
16425                 }
16426         }
16427 }
16428 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16429         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16430                 let contents = if o.result_ok {
16431                         let result = unsafe { o.contents.result };
16432                         unsafe { o.contents.result = core::ptr::null_mut() };
16433                         CResult_PingDecodeErrorZPtr { result }
16434                 } else {
16435                         let err = unsafe { o.contents.err };
16436                         unsafe { o.contents.err = core::ptr::null_mut(); }
16437                         CResult_PingDecodeErrorZPtr { err }
16438                 };
16439                 Self {
16440                         contents,
16441                         result_ok: o.result_ok,
16442                 }
16443         }
16444 }
16445 impl Clone for CResult_PingDecodeErrorZ {
16446         fn clone(&self) -> Self {
16447                 if self.result_ok {
16448                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16449                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16450                         } }
16451                 } else {
16452                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16454                         } }
16455                 }
16456         }
16457 }
16458 #[no_mangle]
16459 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16460 /// but with all dynamically-allocated buffers duplicated in new buffers.
16461 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16462 #[repr(C)]
16463 /// The contents of CResult_PongDecodeErrorZ
16464 pub union CResult_PongDecodeErrorZPtr {
16465         /// A pointer to the contents in the success state.
16466         /// Reading from this pointer when `result_ok` is not set is undefined.
16467         pub result: *mut crate::lightning::ln::msgs::Pong,
16468         /// A pointer to the contents in the error state.
16469         /// Reading from this pointer when `result_ok` is set is undefined.
16470         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16471 }
16472 #[repr(C)]
16473 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16474 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16476 pub struct CResult_PongDecodeErrorZ {
16477         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16478         /// `err` or `result` depending on the state of `result_ok`.
16479         pub contents: CResult_PongDecodeErrorZPtr,
16480         /// Whether this CResult_PongDecodeErrorZ represents a success state.
16481         pub result_ok: bool,
16482 }
16483 #[no_mangle]
16484 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16485 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16486         CResult_PongDecodeErrorZ {
16487                 contents: CResult_PongDecodeErrorZPtr {
16488                         result: Box::into_raw(Box::new(o)),
16489                 },
16490                 result_ok: true,
16491         }
16492 }
16493 #[no_mangle]
16494 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16495 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16496         CResult_PongDecodeErrorZ {
16497                 contents: CResult_PongDecodeErrorZPtr {
16498                         err: Box::into_raw(Box::new(e)),
16499                 },
16500                 result_ok: false,
16501         }
16502 }
16503 /// Checks if the given object is currently in the success state
16504 #[no_mangle]
16505 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16506         o.result_ok
16507 }
16508 #[no_mangle]
16509 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16510 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16511 impl Drop for CResult_PongDecodeErrorZ {
16512         fn drop(&mut self) {
16513                 if self.result_ok {
16514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16516                         }
16517                 } else {
16518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16520                         }
16521                 }
16522         }
16523 }
16524 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16525         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16526                 let contents = if o.result_ok {
16527                         let result = unsafe { o.contents.result };
16528                         unsafe { o.contents.result = core::ptr::null_mut() };
16529                         CResult_PongDecodeErrorZPtr { result }
16530                 } else {
16531                         let err = unsafe { o.contents.err };
16532                         unsafe { o.contents.err = core::ptr::null_mut(); }
16533                         CResult_PongDecodeErrorZPtr { err }
16534                 };
16535                 Self {
16536                         contents,
16537                         result_ok: o.result_ok,
16538                 }
16539         }
16540 }
16541 impl Clone for CResult_PongDecodeErrorZ {
16542         fn clone(&self) -> Self {
16543                 if self.result_ok {
16544                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16545                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16546                         } }
16547                 } else {
16548                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16549                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16550                         } }
16551                 }
16552         }
16553 }
16554 #[no_mangle]
16555 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16556 /// but with all dynamically-allocated buffers duplicated in new buffers.
16557 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16558 #[repr(C)]
16559 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16560 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16561         /// A pointer to the contents in the success state.
16562         /// Reading from this pointer when `result_ok` is not set is undefined.
16563         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16564         /// A pointer to the contents in the error state.
16565         /// Reading from this pointer when `result_ok` is set is undefined.
16566         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16567 }
16568 #[repr(C)]
16569 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16570 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16572 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16573         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16574         /// `err` or `result` depending on the state of `result_ok`.
16575         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16576         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16577         pub result_ok: bool,
16578 }
16579 #[no_mangle]
16580 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16581 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16582         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16583                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16584                         result: Box::into_raw(Box::new(o)),
16585                 },
16586                 result_ok: true,
16587         }
16588 }
16589 #[no_mangle]
16590 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16591 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16592         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16593                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16594                         err: Box::into_raw(Box::new(e)),
16595                 },
16596                 result_ok: false,
16597         }
16598 }
16599 /// Checks if the given object is currently in the success state
16600 #[no_mangle]
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16602         o.result_ok
16603 }
16604 #[no_mangle]
16605 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16606 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16607 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16608         fn drop(&mut self) {
16609                 if self.result_ok {
16610                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16611                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16612                         }
16613                 } else {
16614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16616                         }
16617                 }
16618         }
16619 }
16620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16622                 let contents = if o.result_ok {
16623                         let result = unsafe { o.contents.result };
16624                         unsafe { o.contents.result = core::ptr::null_mut() };
16625                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16626                 } else {
16627                         let err = unsafe { o.contents.err };
16628                         unsafe { o.contents.err = core::ptr::null_mut(); }
16629                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16630                 };
16631                 Self {
16632                         contents,
16633                         result_ok: o.result_ok,
16634                 }
16635         }
16636 }
16637 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16638         fn clone(&self) -> Self {
16639                 if self.result_ok {
16640                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16641                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16642                         } }
16643                 } else {
16644                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16645                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16646                         } }
16647                 }
16648         }
16649 }
16650 #[no_mangle]
16651 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16652 /// but with all dynamically-allocated buffers duplicated in new buffers.
16653 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16654 #[repr(C)]
16655 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16656 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16657         /// A pointer to the contents in the success state.
16658         /// Reading from this pointer when `result_ok` is not set is undefined.
16659         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16660         /// A pointer to the contents in the error state.
16661         /// Reading from this pointer when `result_ok` is set is undefined.
16662         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16663 }
16664 #[repr(C)]
16665 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16666 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16668 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16669         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16670         /// `err` or `result` depending on the state of `result_ok`.
16671         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16672         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16673         pub result_ok: bool,
16674 }
16675 #[no_mangle]
16676 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16677 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16678         CResult_ChannelAnnouncementDecodeErrorZ {
16679                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16680                         result: Box::into_raw(Box::new(o)),
16681                 },
16682                 result_ok: true,
16683         }
16684 }
16685 #[no_mangle]
16686 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16687 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16688         CResult_ChannelAnnouncementDecodeErrorZ {
16689                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16690                         err: Box::into_raw(Box::new(e)),
16691                 },
16692                 result_ok: false,
16693         }
16694 }
16695 /// Checks if the given object is currently in the success state
16696 #[no_mangle]
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16698         o.result_ok
16699 }
16700 #[no_mangle]
16701 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16702 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16703 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16704         fn drop(&mut self) {
16705                 if self.result_ok {
16706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16708                         }
16709                 } else {
16710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16712                         }
16713                 }
16714         }
16715 }
16716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16717         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16718                 let contents = if o.result_ok {
16719                         let result = unsafe { o.contents.result };
16720                         unsafe { o.contents.result = core::ptr::null_mut() };
16721                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16722                 } else {
16723                         let err = unsafe { o.contents.err };
16724                         unsafe { o.contents.err = core::ptr::null_mut(); }
16725                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16726                 };
16727                 Self {
16728                         contents,
16729                         result_ok: o.result_ok,
16730                 }
16731         }
16732 }
16733 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16734         fn clone(&self) -> Self {
16735                 if self.result_ok {
16736                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16737                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16738                         } }
16739                 } else {
16740                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16741                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16742                         } }
16743                 }
16744         }
16745 }
16746 #[no_mangle]
16747 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16748 /// but with all dynamically-allocated buffers duplicated in new buffers.
16749 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16750 #[repr(C)]
16751 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16752 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16753         /// A pointer to the contents in the success state.
16754         /// Reading from this pointer when `result_ok` is not set is undefined.
16755         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16756         /// A pointer to the contents in the error state.
16757         /// Reading from this pointer when `result_ok` is set is undefined.
16758         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16759 }
16760 #[repr(C)]
16761 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16762 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16764 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16765         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16766         /// `err` or `result` depending on the state of `result_ok`.
16767         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16768         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16769         pub result_ok: bool,
16770 }
16771 #[no_mangle]
16772 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16773 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16774         CResult_UnsignedChannelUpdateDecodeErrorZ {
16775                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16776                         result: Box::into_raw(Box::new(o)),
16777                 },
16778                 result_ok: true,
16779         }
16780 }
16781 #[no_mangle]
16782 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16783 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16784         CResult_UnsignedChannelUpdateDecodeErrorZ {
16785                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16786                         err: Box::into_raw(Box::new(e)),
16787                 },
16788                 result_ok: false,
16789         }
16790 }
16791 /// Checks if the given object is currently in the success state
16792 #[no_mangle]
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16794         o.result_ok
16795 }
16796 #[no_mangle]
16797 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16798 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16799 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16800         fn drop(&mut self) {
16801                 if self.result_ok {
16802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16804                         }
16805                 } else {
16806                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16807                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16808                         }
16809                 }
16810         }
16811 }
16812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16813         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16814                 let contents = if o.result_ok {
16815                         let result = unsafe { o.contents.result };
16816                         unsafe { o.contents.result = core::ptr::null_mut() };
16817                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16818                 } else {
16819                         let err = unsafe { o.contents.err };
16820                         unsafe { o.contents.err = core::ptr::null_mut(); }
16821                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16822                 };
16823                 Self {
16824                         contents,
16825                         result_ok: o.result_ok,
16826                 }
16827         }
16828 }
16829 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16830         fn clone(&self) -> Self {
16831                 if self.result_ok {
16832                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16833                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16834                         } }
16835                 } else {
16836                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16837                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16838                         } }
16839                 }
16840         }
16841 }
16842 #[no_mangle]
16843 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16844 /// but with all dynamically-allocated buffers duplicated in new buffers.
16845 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16846 #[repr(C)]
16847 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16848 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16849         /// A pointer to the contents in the success state.
16850         /// Reading from this pointer when `result_ok` is not set is undefined.
16851         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16852         /// A pointer to the contents in the error state.
16853         /// Reading from this pointer when `result_ok` is set is undefined.
16854         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16855 }
16856 #[repr(C)]
16857 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16858 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16860 pub struct CResult_ChannelUpdateDecodeErrorZ {
16861         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16862         /// `err` or `result` depending on the state of `result_ok`.
16863         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16864         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16865         pub result_ok: bool,
16866 }
16867 #[no_mangle]
16868 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16869 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16870         CResult_ChannelUpdateDecodeErrorZ {
16871                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16872                         result: Box::into_raw(Box::new(o)),
16873                 },
16874                 result_ok: true,
16875         }
16876 }
16877 #[no_mangle]
16878 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16879 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16880         CResult_ChannelUpdateDecodeErrorZ {
16881                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16882                         err: Box::into_raw(Box::new(e)),
16883                 },
16884                 result_ok: false,
16885         }
16886 }
16887 /// Checks if the given object is currently in the success state
16888 #[no_mangle]
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16890         o.result_ok
16891 }
16892 #[no_mangle]
16893 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16894 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16895 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16896         fn drop(&mut self) {
16897                 if self.result_ok {
16898                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16899                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16900                         }
16901                 } else {
16902                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16903                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16904                         }
16905                 }
16906         }
16907 }
16908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16910                 let contents = if o.result_ok {
16911                         let result = unsafe { o.contents.result };
16912                         unsafe { o.contents.result = core::ptr::null_mut() };
16913                         CResult_ChannelUpdateDecodeErrorZPtr { result }
16914                 } else {
16915                         let err = unsafe { o.contents.err };
16916                         unsafe { o.contents.err = core::ptr::null_mut(); }
16917                         CResult_ChannelUpdateDecodeErrorZPtr { err }
16918                 };
16919                 Self {
16920                         contents,
16921                         result_ok: o.result_ok,
16922                 }
16923         }
16924 }
16925 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16926         fn clone(&self) -> Self {
16927                 if self.result_ok {
16928                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16930                         } }
16931                 } else {
16932                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16933                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16934                         } }
16935                 }
16936         }
16937 }
16938 #[no_mangle]
16939 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16940 /// but with all dynamically-allocated buffers duplicated in new buffers.
16941 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16942 #[repr(C)]
16943 /// The contents of CResult_ErrorMessageDecodeErrorZ
16944 pub union CResult_ErrorMessageDecodeErrorZPtr {
16945         /// A pointer to the contents in the success state.
16946         /// Reading from this pointer when `result_ok` is not set is undefined.
16947         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16948         /// A pointer to the contents in the error state.
16949         /// Reading from this pointer when `result_ok` is set is undefined.
16950         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16951 }
16952 #[repr(C)]
16953 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16954 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16956 pub struct CResult_ErrorMessageDecodeErrorZ {
16957         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16958         /// `err` or `result` depending on the state of `result_ok`.
16959         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16960         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16961         pub result_ok: bool,
16962 }
16963 #[no_mangle]
16964 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16965 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16966         CResult_ErrorMessageDecodeErrorZ {
16967                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16968                         result: Box::into_raw(Box::new(o)),
16969                 },
16970                 result_ok: true,
16971         }
16972 }
16973 #[no_mangle]
16974 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16975 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16976         CResult_ErrorMessageDecodeErrorZ {
16977                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16978                         err: Box::into_raw(Box::new(e)),
16979                 },
16980                 result_ok: false,
16981         }
16982 }
16983 /// Checks if the given object is currently in the success state
16984 #[no_mangle]
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16986         o.result_ok
16987 }
16988 #[no_mangle]
16989 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16990 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16991 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16992         fn drop(&mut self) {
16993                 if self.result_ok {
16994                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16995                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16996                         }
16997                 } else {
16998                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16999                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17000                         }
17001                 }
17002         }
17003 }
17004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17005         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17006                 let contents = if o.result_ok {
17007                         let result = unsafe { o.contents.result };
17008                         unsafe { o.contents.result = core::ptr::null_mut() };
17009                         CResult_ErrorMessageDecodeErrorZPtr { result }
17010                 } else {
17011                         let err = unsafe { o.contents.err };
17012                         unsafe { o.contents.err = core::ptr::null_mut(); }
17013                         CResult_ErrorMessageDecodeErrorZPtr { err }
17014                 };
17015                 Self {
17016                         contents,
17017                         result_ok: o.result_ok,
17018                 }
17019         }
17020 }
17021 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17022         fn clone(&self) -> Self {
17023                 if self.result_ok {
17024                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17025                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17026                         } }
17027                 } else {
17028                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17029                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17030                         } }
17031                 }
17032         }
17033 }
17034 #[no_mangle]
17035 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17036 /// but with all dynamically-allocated buffers duplicated in new buffers.
17037 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17038 #[repr(C)]
17039 /// The contents of CResult_WarningMessageDecodeErrorZ
17040 pub union CResult_WarningMessageDecodeErrorZPtr {
17041         /// A pointer to the contents in the success state.
17042         /// Reading from this pointer when `result_ok` is not set is undefined.
17043         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17044         /// A pointer to the contents in the error state.
17045         /// Reading from this pointer when `result_ok` is set is undefined.
17046         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17047 }
17048 #[repr(C)]
17049 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17050 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17052 pub struct CResult_WarningMessageDecodeErrorZ {
17053         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17054         /// `err` or `result` depending on the state of `result_ok`.
17055         pub contents: CResult_WarningMessageDecodeErrorZPtr,
17056         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17057         pub result_ok: bool,
17058 }
17059 #[no_mangle]
17060 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17061 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17062         CResult_WarningMessageDecodeErrorZ {
17063                 contents: CResult_WarningMessageDecodeErrorZPtr {
17064                         result: Box::into_raw(Box::new(o)),
17065                 },
17066                 result_ok: true,
17067         }
17068 }
17069 #[no_mangle]
17070 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17071 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17072         CResult_WarningMessageDecodeErrorZ {
17073                 contents: CResult_WarningMessageDecodeErrorZPtr {
17074                         err: Box::into_raw(Box::new(e)),
17075                 },
17076                 result_ok: false,
17077         }
17078 }
17079 /// Checks if the given object is currently in the success state
17080 #[no_mangle]
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17082         o.result_ok
17083 }
17084 #[no_mangle]
17085 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17086 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17087 impl Drop for CResult_WarningMessageDecodeErrorZ {
17088         fn drop(&mut self) {
17089                 if self.result_ok {
17090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17092                         }
17093                 } else {
17094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17096                         }
17097                 }
17098         }
17099 }
17100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17102                 let contents = if o.result_ok {
17103                         let result = unsafe { o.contents.result };
17104                         unsafe { o.contents.result = core::ptr::null_mut() };
17105                         CResult_WarningMessageDecodeErrorZPtr { result }
17106                 } else {
17107                         let err = unsafe { o.contents.err };
17108                         unsafe { o.contents.err = core::ptr::null_mut(); }
17109                         CResult_WarningMessageDecodeErrorZPtr { err }
17110                 };
17111                 Self {
17112                         contents,
17113                         result_ok: o.result_ok,
17114                 }
17115         }
17116 }
17117 impl Clone for CResult_WarningMessageDecodeErrorZ {
17118         fn clone(&self) -> Self {
17119                 if self.result_ok {
17120                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17121                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17122                         } }
17123                 } else {
17124                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17126                         } }
17127                 }
17128         }
17129 }
17130 #[no_mangle]
17131 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17132 /// but with all dynamically-allocated buffers duplicated in new buffers.
17133 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17134 #[repr(C)]
17135 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17136 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17137         /// A pointer to the contents in the success state.
17138         /// Reading from this pointer when `result_ok` is not set is undefined.
17139         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17140         /// A pointer to the contents in the error state.
17141         /// Reading from this pointer when `result_ok` is set is undefined.
17142         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17143 }
17144 #[repr(C)]
17145 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17146 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17148 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17149         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17150         /// `err` or `result` depending on the state of `result_ok`.
17151         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17152         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17153         pub result_ok: bool,
17154 }
17155 #[no_mangle]
17156 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17157 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17158         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17159                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17160                         result: Box::into_raw(Box::new(o)),
17161                 },
17162                 result_ok: true,
17163         }
17164 }
17165 #[no_mangle]
17166 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17167 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17168         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17169                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17170                         err: Box::into_raw(Box::new(e)),
17171                 },
17172                 result_ok: false,
17173         }
17174 }
17175 /// Checks if the given object is currently in the success state
17176 #[no_mangle]
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17178         o.result_ok
17179 }
17180 #[no_mangle]
17181 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17182 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17183 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17184         fn drop(&mut self) {
17185                 if self.result_ok {
17186                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17187                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17188                         }
17189                 } else {
17190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17192                         }
17193                 }
17194         }
17195 }
17196 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17197         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17198                 let contents = if o.result_ok {
17199                         let result = unsafe { o.contents.result };
17200                         unsafe { o.contents.result = core::ptr::null_mut() };
17201                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17202                 } else {
17203                         let err = unsafe { o.contents.err };
17204                         unsafe { o.contents.err = core::ptr::null_mut(); }
17205                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17206                 };
17207                 Self {
17208                         contents,
17209                         result_ok: o.result_ok,
17210                 }
17211         }
17212 }
17213 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17214         fn clone(&self) -> Self {
17215                 if self.result_ok {
17216                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17217                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17218                         } }
17219                 } else {
17220                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17221                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17222                         } }
17223                 }
17224         }
17225 }
17226 #[no_mangle]
17227 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17228 /// but with all dynamically-allocated buffers duplicated in new buffers.
17229 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17230 #[repr(C)]
17231 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17232 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17233         /// A pointer to the contents in the success state.
17234         /// Reading from this pointer when `result_ok` is not set is undefined.
17235         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17236         /// A pointer to the contents in the error state.
17237         /// Reading from this pointer when `result_ok` is set is undefined.
17238         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17239 }
17240 #[repr(C)]
17241 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17242 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17244 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17245         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17246         /// `err` or `result` depending on the state of `result_ok`.
17247         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17248         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17249         pub result_ok: bool,
17250 }
17251 #[no_mangle]
17252 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17253 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17254         CResult_NodeAnnouncementDecodeErrorZ {
17255                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17256                         result: Box::into_raw(Box::new(o)),
17257                 },
17258                 result_ok: true,
17259         }
17260 }
17261 #[no_mangle]
17262 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17263 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17264         CResult_NodeAnnouncementDecodeErrorZ {
17265                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17266                         err: Box::into_raw(Box::new(e)),
17267                 },
17268                 result_ok: false,
17269         }
17270 }
17271 /// Checks if the given object is currently in the success state
17272 #[no_mangle]
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17274         o.result_ok
17275 }
17276 #[no_mangle]
17277 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17278 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17279 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17280         fn drop(&mut self) {
17281                 if self.result_ok {
17282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17284                         }
17285                 } else {
17286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17288                         }
17289                 }
17290         }
17291 }
17292 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17294                 let contents = if o.result_ok {
17295                         let result = unsafe { o.contents.result };
17296                         unsafe { o.contents.result = core::ptr::null_mut() };
17297                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
17298                 } else {
17299                         let err = unsafe { o.contents.err };
17300                         unsafe { o.contents.err = core::ptr::null_mut(); }
17301                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
17302                 };
17303                 Self {
17304                         contents,
17305                         result_ok: o.result_ok,
17306                 }
17307         }
17308 }
17309 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17310         fn clone(&self) -> Self {
17311                 if self.result_ok {
17312                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17313                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17314                         } }
17315                 } else {
17316                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17317                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17318                         } }
17319                 }
17320         }
17321 }
17322 #[no_mangle]
17323 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17324 /// but with all dynamically-allocated buffers duplicated in new buffers.
17325 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17326 #[repr(C)]
17327 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17328 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17329         /// A pointer to the contents in the success state.
17330         /// Reading from this pointer when `result_ok` is not set is undefined.
17331         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17332         /// A pointer to the contents in the error state.
17333         /// Reading from this pointer when `result_ok` is set is undefined.
17334         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17335 }
17336 #[repr(C)]
17337 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17338 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17340 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17341         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17342         /// `err` or `result` depending on the state of `result_ok`.
17343         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17344         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17345         pub result_ok: bool,
17346 }
17347 #[no_mangle]
17348 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17349 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17350         CResult_QueryShortChannelIdsDecodeErrorZ {
17351                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17352                         result: Box::into_raw(Box::new(o)),
17353                 },
17354                 result_ok: true,
17355         }
17356 }
17357 #[no_mangle]
17358 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17359 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17360         CResult_QueryShortChannelIdsDecodeErrorZ {
17361                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17362                         err: Box::into_raw(Box::new(e)),
17363                 },
17364                 result_ok: false,
17365         }
17366 }
17367 /// Checks if the given object is currently in the success state
17368 #[no_mangle]
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17370         o.result_ok
17371 }
17372 #[no_mangle]
17373 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17374 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17375 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17376         fn drop(&mut self) {
17377                 if self.result_ok {
17378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17380                         }
17381                 } else {
17382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17384                         }
17385                 }
17386         }
17387 }
17388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17390                 let contents = if o.result_ok {
17391                         let result = unsafe { o.contents.result };
17392                         unsafe { o.contents.result = core::ptr::null_mut() };
17393                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17394                 } else {
17395                         let err = unsafe { o.contents.err };
17396                         unsafe { o.contents.err = core::ptr::null_mut(); }
17397                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17398                 };
17399                 Self {
17400                         contents,
17401                         result_ok: o.result_ok,
17402                 }
17403         }
17404 }
17405 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17406         fn clone(&self) -> Self {
17407                 if self.result_ok {
17408                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17410                         } }
17411                 } else {
17412                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17414                         } }
17415                 }
17416         }
17417 }
17418 #[no_mangle]
17419 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17420 /// but with all dynamically-allocated buffers duplicated in new buffers.
17421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17422 #[repr(C)]
17423 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17424 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17425         /// A pointer to the contents in the success state.
17426         /// Reading from this pointer when `result_ok` is not set is undefined.
17427         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17428         /// A pointer to the contents in the error state.
17429         /// Reading from this pointer when `result_ok` is set is undefined.
17430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17431 }
17432 #[repr(C)]
17433 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17434 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17436 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17437         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17438         /// `err` or `result` depending on the state of `result_ok`.
17439         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17440         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17441         pub result_ok: bool,
17442 }
17443 #[no_mangle]
17444 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17445 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17446         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17447                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17448                         result: Box::into_raw(Box::new(o)),
17449                 },
17450                 result_ok: true,
17451         }
17452 }
17453 #[no_mangle]
17454 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17455 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17456         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17457                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17458                         err: Box::into_raw(Box::new(e)),
17459                 },
17460                 result_ok: false,
17461         }
17462 }
17463 /// Checks if the given object is currently in the success state
17464 #[no_mangle]
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17466         o.result_ok
17467 }
17468 #[no_mangle]
17469 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17470 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17471 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17472         fn drop(&mut self) {
17473                 if self.result_ok {
17474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17476                         }
17477                 } else {
17478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17480                         }
17481                 }
17482         }
17483 }
17484 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17485         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17486                 let contents = if o.result_ok {
17487                         let result = unsafe { o.contents.result };
17488                         unsafe { o.contents.result = core::ptr::null_mut() };
17489                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17490                 } else {
17491                         let err = unsafe { o.contents.err };
17492                         unsafe { o.contents.err = core::ptr::null_mut(); }
17493                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17494                 };
17495                 Self {
17496                         contents,
17497                         result_ok: o.result_ok,
17498                 }
17499         }
17500 }
17501 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17502         fn clone(&self) -> Self {
17503                 if self.result_ok {
17504                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17505                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17506                         } }
17507                 } else {
17508                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17509                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17510                         } }
17511                 }
17512         }
17513 }
17514 #[no_mangle]
17515 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17516 /// but with all dynamically-allocated buffers duplicated in new buffers.
17517 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17518 #[repr(C)]
17519 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17520 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17521         /// A pointer to the contents in the success state.
17522         /// Reading from this pointer when `result_ok` is not set is undefined.
17523         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17524         /// A pointer to the contents in the error state.
17525         /// Reading from this pointer when `result_ok` is set is undefined.
17526         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17527 }
17528 #[repr(C)]
17529 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17530 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17532 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17533         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17534         /// `err` or `result` depending on the state of `result_ok`.
17535         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17536         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17537         pub result_ok: bool,
17538 }
17539 #[no_mangle]
17540 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17541 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17542         CResult_QueryChannelRangeDecodeErrorZ {
17543                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17544                         result: Box::into_raw(Box::new(o)),
17545                 },
17546                 result_ok: true,
17547         }
17548 }
17549 #[no_mangle]
17550 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17551 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17552         CResult_QueryChannelRangeDecodeErrorZ {
17553                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17554                         err: Box::into_raw(Box::new(e)),
17555                 },
17556                 result_ok: false,
17557         }
17558 }
17559 /// Checks if the given object is currently in the success state
17560 #[no_mangle]
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17562         o.result_ok
17563 }
17564 #[no_mangle]
17565 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17566 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17567 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17568         fn drop(&mut self) {
17569                 if self.result_ok {
17570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17572                         }
17573                 } else {
17574                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17575                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17576                         }
17577                 }
17578         }
17579 }
17580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17581         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17582                 let contents = if o.result_ok {
17583                         let result = unsafe { o.contents.result };
17584                         unsafe { o.contents.result = core::ptr::null_mut() };
17585                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
17586                 } else {
17587                         let err = unsafe { o.contents.err };
17588                         unsafe { o.contents.err = core::ptr::null_mut(); }
17589                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
17590                 };
17591                 Self {
17592                         contents,
17593                         result_ok: o.result_ok,
17594                 }
17595         }
17596 }
17597 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17598         fn clone(&self) -> Self {
17599                 if self.result_ok {
17600                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17601                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17602                         } }
17603                 } else {
17604                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17605                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17606                         } }
17607                 }
17608         }
17609 }
17610 #[no_mangle]
17611 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17612 /// but with all dynamically-allocated buffers duplicated in new buffers.
17613 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17614 #[repr(C)]
17615 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17616 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17617         /// A pointer to the contents in the success state.
17618         /// Reading from this pointer when `result_ok` is not set is undefined.
17619         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17620         /// A pointer to the contents in the error state.
17621         /// Reading from this pointer when `result_ok` is set is undefined.
17622         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17623 }
17624 #[repr(C)]
17625 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17626 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17628 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17629         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17630         /// `err` or `result` depending on the state of `result_ok`.
17631         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17632         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17633         pub result_ok: bool,
17634 }
17635 #[no_mangle]
17636 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17637 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17638         CResult_ReplyChannelRangeDecodeErrorZ {
17639                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17640                         result: Box::into_raw(Box::new(o)),
17641                 },
17642                 result_ok: true,
17643         }
17644 }
17645 #[no_mangle]
17646 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17647 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17648         CResult_ReplyChannelRangeDecodeErrorZ {
17649                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17650                         err: Box::into_raw(Box::new(e)),
17651                 },
17652                 result_ok: false,
17653         }
17654 }
17655 /// Checks if the given object is currently in the success state
17656 #[no_mangle]
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17658         o.result_ok
17659 }
17660 #[no_mangle]
17661 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17662 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17663 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17664         fn drop(&mut self) {
17665                 if self.result_ok {
17666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17668                         }
17669                 } else {
17670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17672                         }
17673                 }
17674         }
17675 }
17676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17677         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17678                 let contents = if o.result_ok {
17679                         let result = unsafe { o.contents.result };
17680                         unsafe { o.contents.result = core::ptr::null_mut() };
17681                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17682                 } else {
17683                         let err = unsafe { o.contents.err };
17684                         unsafe { o.contents.err = core::ptr::null_mut(); }
17685                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17686                 };
17687                 Self {
17688                         contents,
17689                         result_ok: o.result_ok,
17690                 }
17691         }
17692 }
17693 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17694         fn clone(&self) -> Self {
17695                 if self.result_ok {
17696                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17697                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17698                         } }
17699                 } else {
17700                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17701                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17702                         } }
17703                 }
17704         }
17705 }
17706 #[no_mangle]
17707 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17708 /// but with all dynamically-allocated buffers duplicated in new buffers.
17709 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17710 #[repr(C)]
17711 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17712 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17713         /// A pointer to the contents in the success state.
17714         /// Reading from this pointer when `result_ok` is not set is undefined.
17715         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17716         /// A pointer to the contents in the error state.
17717         /// Reading from this pointer when `result_ok` is set is undefined.
17718         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17719 }
17720 #[repr(C)]
17721 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17722 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17724 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17725         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17726         /// `err` or `result` depending on the state of `result_ok`.
17727         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17728         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17729         pub result_ok: bool,
17730 }
17731 #[no_mangle]
17732 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17733 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17734         CResult_GossipTimestampFilterDecodeErrorZ {
17735                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17736                         result: Box::into_raw(Box::new(o)),
17737                 },
17738                 result_ok: true,
17739         }
17740 }
17741 #[no_mangle]
17742 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17743 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17744         CResult_GossipTimestampFilterDecodeErrorZ {
17745                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17746                         err: Box::into_raw(Box::new(e)),
17747                 },
17748                 result_ok: false,
17749         }
17750 }
17751 /// Checks if the given object is currently in the success state
17752 #[no_mangle]
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17754         o.result_ok
17755 }
17756 #[no_mangle]
17757 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17758 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17759 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17760         fn drop(&mut self) {
17761                 if self.result_ok {
17762                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17763                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17764                         }
17765                 } else {
17766                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17767                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17768                         }
17769                 }
17770         }
17771 }
17772 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17773         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17774                 let contents = if o.result_ok {
17775                         let result = unsafe { o.contents.result };
17776                         unsafe { o.contents.result = core::ptr::null_mut() };
17777                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17778                 } else {
17779                         let err = unsafe { o.contents.err };
17780                         unsafe { o.contents.err = core::ptr::null_mut(); }
17781                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17782                 };
17783                 Self {
17784                         contents,
17785                         result_ok: o.result_ok,
17786                 }
17787         }
17788 }
17789 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17790         fn clone(&self) -> Self {
17791                 if self.result_ok {
17792                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17793                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17794                         } }
17795                 } else {
17796                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17797                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17798                         } }
17799                 }
17800         }
17801 }
17802 #[no_mangle]
17803 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17804 /// but with all dynamically-allocated buffers duplicated in new buffers.
17805 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17806 #[repr(C)]
17807 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17808 /// This corresponds to std::vector in C++
17809 pub struct CVec_PhantomRouteHintsZ {
17810         /// The elements in the array.
17811         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17812         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17813         /// The number of elements pointed to by `data`.
17814         pub datalen: usize
17815 }
17816 impl CVec_PhantomRouteHintsZ {
17817         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17818                 if self.datalen == 0 { return Vec::new(); }
17819                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17820                 self.data = core::ptr::null_mut();
17821                 self.datalen = 0;
17822                 ret
17823         }
17824         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17825                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17826         }
17827 }
17828 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17829         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17830                 let datalen = v.len();
17831                 let data = Box::into_raw(v.into_boxed_slice());
17832                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17833         }
17834 }
17835 #[no_mangle]
17836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17837 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17838 impl Drop for CVec_PhantomRouteHintsZ {
17839         fn drop(&mut self) {
17840                 if self.datalen == 0 { return; }
17841                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17842         }
17843 }
17844 impl Clone for CVec_PhantomRouteHintsZ {
17845         fn clone(&self) -> Self {
17846                 let mut res = Vec::new();
17847                 if self.datalen == 0 { return Self::from(res); }
17848                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17849                 Self::from(res)
17850         }
17851 }
17852 #[repr(C)]
17853 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17854 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17855         /// A pointer to the contents in the success state.
17856         /// Reading from this pointer when `result_ok` is not set is undefined.
17857         pub result: *mut crate::lightning_invoice::Invoice,
17858         /// A pointer to the contents in the error state.
17859         /// Reading from this pointer when `result_ok` is set is undefined.
17860         pub err: *mut crate::lightning_invoice::SignOrCreationError,
17861 }
17862 #[repr(C)]
17863 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17864 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17866 pub struct CResult_InvoiceSignOrCreationErrorZ {
17867         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17868         /// `err` or `result` depending on the state of `result_ok`.
17869         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17870         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17871         pub result_ok: bool,
17872 }
17873 #[no_mangle]
17874 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17875 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17876         CResult_InvoiceSignOrCreationErrorZ {
17877                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17878                         result: Box::into_raw(Box::new(o)),
17879                 },
17880                 result_ok: true,
17881         }
17882 }
17883 #[no_mangle]
17884 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17885 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17886         CResult_InvoiceSignOrCreationErrorZ {
17887                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17888                         err: Box::into_raw(Box::new(e)),
17889                 },
17890                 result_ok: false,
17891         }
17892 }
17893 /// Checks if the given object is currently in the success state
17894 #[no_mangle]
17895 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17896         o.result_ok
17897 }
17898 #[no_mangle]
17899 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17900 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17901 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17902         fn drop(&mut self) {
17903                 if self.result_ok {
17904                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17905                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17906                         }
17907                 } else {
17908                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17909                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17910                         }
17911                 }
17912         }
17913 }
17914 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17915         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17916                 let contents = if o.result_ok {
17917                         let result = unsafe { o.contents.result };
17918                         unsafe { o.contents.result = core::ptr::null_mut() };
17919                         CResult_InvoiceSignOrCreationErrorZPtr { result }
17920                 } else {
17921                         let err = unsafe { o.contents.err };
17922                         unsafe { o.contents.err = core::ptr::null_mut(); }
17923                         CResult_InvoiceSignOrCreationErrorZPtr { err }
17924                 };
17925                 Self {
17926                         contents,
17927                         result_ok: o.result_ok,
17928                 }
17929         }
17930 }
17931 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17932         fn clone(&self) -> Self {
17933                 if self.result_ok {
17934                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17935                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17936                         } }
17937                 } else {
17938                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17939                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17940                         } }
17941                 }
17942         }
17943 }
17944 #[no_mangle]
17945 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17946 /// but with all dynamically-allocated buffers duplicated in new buffers.
17947 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17948 #[repr(C)]
17949 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17950 /// This corresponds to std::vector in C++
17951 pub struct CVec_FutureZ {
17952         /// The elements in the array.
17953         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17954         pub data: *mut crate::lightning::util::wakers::Future,
17955         /// The number of elements pointed to by `data`.
17956         pub datalen: usize
17957 }
17958 impl CVec_FutureZ {
17959         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17960                 if self.datalen == 0 { return Vec::new(); }
17961                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17962                 self.data = core::ptr::null_mut();
17963                 self.datalen = 0;
17964                 ret
17965         }
17966         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17967                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17968         }
17969 }
17970 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17971         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17972                 let datalen = v.len();
17973                 let data = Box::into_raw(v.into_boxed_slice());
17974                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17975         }
17976 }
17977 #[no_mangle]
17978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17979 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17980 impl Drop for CVec_FutureZ {
17981         fn drop(&mut self) {
17982                 if self.datalen == 0 { return; }
17983                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17984         }
17985 }
17986 impl Clone for CVec_FutureZ {
17987         fn clone(&self) -> Self {
17988                 let mut res = Vec::new();
17989                 if self.datalen == 0 { return Self::from(res); }
17990                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17991                 Self::from(res)
17992         }
17993 }
17994 #[repr(C)]
17995 /// An enum which can either contain a crate::lightning::chain::Filter or not
17996 pub enum COption_FilterZ {
17997         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17998         Some(crate::lightning::chain::Filter),
17999         /// When we're in this state, this COption_FilterZ contains nothing
18000         None
18001 }
18002 impl COption_FilterZ {
18003         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18004                 if let Self::None = self { false } else { true }
18005         }
18006         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18007                 !self.is_some()
18008         }
18009         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
18010                 if let Self::Some(v) = self { v } else { unreachable!() }
18011         }
18012 }
18013 #[no_mangle]
18014 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18015 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
18016         COption_FilterZ::Some(o)
18017 }
18018 #[no_mangle]
18019 /// Constructs a new COption_FilterZ containing nothing
18020 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
18021         COption_FilterZ::None
18022 }
18023 #[no_mangle]
18024 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18025 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
18026 #[repr(C)]
18027 /// The contents of CResult_LockedChannelMonitorNoneZ
18028 pub union CResult_LockedChannelMonitorNoneZPtr {
18029         /// A pointer to the contents in the success state.
18030         /// Reading from this pointer when `result_ok` is not set is undefined.
18031         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
18032         /// Note that this value is always NULL, as there are no contents in the Err variant
18033         pub err: *mut core::ffi::c_void,
18034 }
18035 #[repr(C)]
18036 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
18037 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
18038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18039 pub struct CResult_LockedChannelMonitorNoneZ {
18040         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
18041         /// `err` or `result` depending on the state of `result_ok`.
18042         pub contents: CResult_LockedChannelMonitorNoneZPtr,
18043         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
18044         pub result_ok: bool,
18045 }
18046 #[no_mangle]
18047 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18048 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
18049         CResult_LockedChannelMonitorNoneZ {
18050                 contents: CResult_LockedChannelMonitorNoneZPtr {
18051                         result: Box::into_raw(Box::new(o)),
18052                 },
18053                 result_ok: true,
18054         }
18055 }
18056 #[no_mangle]
18057 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18058 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
18059         CResult_LockedChannelMonitorNoneZ {
18060                 contents: CResult_LockedChannelMonitorNoneZPtr {
18061                         err: core::ptr::null_mut(),
18062                 },
18063                 result_ok: false,
18064         }
18065 }
18066 /// Checks if the given object is currently in the success state
18067 #[no_mangle]
18068 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
18069         o.result_ok
18070 }
18071 #[no_mangle]
18072 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18073 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
18074 impl Drop for CResult_LockedChannelMonitorNoneZ {
18075         fn drop(&mut self) {
18076                 if self.result_ok {
18077                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18078                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18079                         }
18080                 } else {
18081                 }
18082         }
18083 }
18084 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
18085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
18086                 let contents = if o.result_ok {
18087                         let result = unsafe { o.contents.result };
18088                         unsafe { o.contents.result = core::ptr::null_mut() };
18089                         CResult_LockedChannelMonitorNoneZPtr { result }
18090                 } else {
18091                         let _ = unsafe { Box::from_raw(o.contents.err) };
18092                         o.contents.err = core::ptr::null_mut();
18093                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
18094                 };
18095                 Self {
18096                         contents,
18097                         result_ok: o.result_ok,
18098                 }
18099         }
18100 }
18101 #[repr(C)]
18102 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
18103 /// This corresponds to std::vector in C++
18104 pub struct CVec_OutPointZ {
18105         /// The elements in the array.
18106         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18107         pub data: *mut crate::lightning::chain::transaction::OutPoint,
18108         /// The number of elements pointed to by `data`.
18109         pub datalen: usize
18110 }
18111 impl CVec_OutPointZ {
18112         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
18113                 if self.datalen == 0 { return Vec::new(); }
18114                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18115                 self.data = core::ptr::null_mut();
18116                 self.datalen = 0;
18117                 ret
18118         }
18119         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
18120                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18121         }
18122 }
18123 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
18124         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
18125                 let datalen = v.len();
18126                 let data = Box::into_raw(v.into_boxed_slice());
18127                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18128         }
18129 }
18130 #[no_mangle]
18131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18132 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
18133 impl Drop for CVec_OutPointZ {
18134         fn drop(&mut self) {
18135                 if self.datalen == 0 { return; }
18136                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18137         }
18138 }
18139 impl Clone for CVec_OutPointZ {
18140         fn clone(&self) -> Self {
18141                 let mut res = Vec::new();
18142                 if self.datalen == 0 { return Self::from(res); }
18143                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18144                 Self::from(res)
18145         }
18146 }
18147 #[repr(C)]
18148 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
18149 /// This corresponds to std::vector in C++
18150 pub struct CVec_MonitorUpdateIdZ {
18151         /// The elements in the array.
18152         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18153         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
18154         /// The number of elements pointed to by `data`.
18155         pub datalen: usize
18156 }
18157 impl CVec_MonitorUpdateIdZ {
18158         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
18159                 if self.datalen == 0 { return Vec::new(); }
18160                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18161                 self.data = core::ptr::null_mut();
18162                 self.datalen = 0;
18163                 ret
18164         }
18165         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
18166                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18167         }
18168 }
18169 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
18170         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
18171                 let datalen = v.len();
18172                 let data = Box::into_raw(v.into_boxed_slice());
18173                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18174         }
18175 }
18176 #[no_mangle]
18177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18178 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
18179 impl Drop for CVec_MonitorUpdateIdZ {
18180         fn drop(&mut self) {
18181                 if self.datalen == 0 { return; }
18182                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18183         }
18184 }
18185 impl Clone for CVec_MonitorUpdateIdZ {
18186         fn clone(&self) -> Self {
18187                 let mut res = Vec::new();
18188                 if self.datalen == 0 { return Self::from(res); }
18189                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18190                 Self::from(res)
18191         }
18192 }
18193 #[repr(C)]
18194 /// A tuple of 2 elements. See the individual fields for the types contained.
18195 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18196         /// The element at position 0
18197         pub a: crate::lightning::chain::transaction::OutPoint,
18198         /// The element at position 1
18199         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
18200 }
18201 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18202         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
18203                 Self {
18204                         a: tup.0,
18205                         b: tup.1,
18206                 }
18207         }
18208 }
18209 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18210         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
18211                 (self.a, self.b)
18212         }
18213 }
18214 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18215         fn clone(&self) -> Self {
18216                 Self {
18217                         a: Clone::clone(&self.a),
18218                         b: Clone::clone(&self.b),
18219                 }
18220         }
18221 }
18222 #[no_mangle]
18223 /// Creates a new tuple which has the same data as `orig`
18224 /// but with all dynamically-allocated buffers duplicated in new buffers.
18225 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
18226 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
18227 #[no_mangle]
18228 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18229         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
18230 }
18231
18232 #[no_mangle]
18233 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
18234 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
18235 #[repr(C)]
18236 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
18237 /// This corresponds to std::vector in C++
18238 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18239         /// The elements in the array.
18240         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18241         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
18242         /// The number of elements pointed to by `data`.
18243         pub datalen: usize
18244 }
18245 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18246         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
18247                 if self.datalen == 0 { return Vec::new(); }
18248                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18249                 self.data = core::ptr::null_mut();
18250                 self.datalen = 0;
18251                 ret
18252         }
18253         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
18254                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18255         }
18256 }
18257 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18258         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
18259                 let datalen = v.len();
18260                 let data = Box::into_raw(v.into_boxed_slice());
18261                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18262         }
18263 }
18264 #[no_mangle]
18265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18266 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
18267 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18268         fn drop(&mut self) {
18269                 if self.datalen == 0 { return; }
18270                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18271         }
18272 }
18273 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18274         fn clone(&self) -> Self {
18275                 let mut res = Vec::new();
18276                 if self.datalen == 0 { return Self::from(res); }
18277                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18278                 Self::from(res)
18279         }
18280 }
18281 #[repr(C)]
18282 /// The contents of CResult_u32GraphSyncErrorZ
18283 pub union CResult_u32GraphSyncErrorZPtr {
18284         /// A pointer to the contents in the success state.
18285         /// Reading from this pointer when `result_ok` is not set is undefined.
18286         pub result: *mut u32,
18287         /// A pointer to the contents in the error state.
18288         /// Reading from this pointer when `result_ok` is set is undefined.
18289         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
18290 }
18291 #[repr(C)]
18292 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
18293 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
18294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18295 pub struct CResult_u32GraphSyncErrorZ {
18296         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
18297         /// `err` or `result` depending on the state of `result_ok`.
18298         pub contents: CResult_u32GraphSyncErrorZPtr,
18299         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
18300         pub result_ok: bool,
18301 }
18302 #[no_mangle]
18303 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
18304 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
18305         CResult_u32GraphSyncErrorZ {
18306                 contents: CResult_u32GraphSyncErrorZPtr {
18307                         result: Box::into_raw(Box::new(o)),
18308                 },
18309                 result_ok: true,
18310         }
18311 }
18312 #[no_mangle]
18313 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
18314 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
18315         CResult_u32GraphSyncErrorZ {
18316                 contents: CResult_u32GraphSyncErrorZPtr {
18317                         err: Box::into_raw(Box::new(e)),
18318                 },
18319                 result_ok: false,
18320         }
18321 }
18322 /// Checks if the given object is currently in the success state
18323 #[no_mangle]
18324 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
18325         o.result_ok
18326 }
18327 #[no_mangle]
18328 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
18329 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
18330 impl Drop for CResult_u32GraphSyncErrorZ {
18331         fn drop(&mut self) {
18332                 if self.result_ok {
18333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18335                         }
18336                 } else {
18337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18339                         }
18340                 }
18341         }
18342 }
18343 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
18344         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
18345                 let contents = if o.result_ok {
18346                         let result = unsafe { o.contents.result };
18347                         unsafe { o.contents.result = core::ptr::null_mut() };
18348                         CResult_u32GraphSyncErrorZPtr { result }
18349                 } else {
18350                         let err = unsafe { o.contents.err };
18351                         unsafe { o.contents.err = core::ptr::null_mut(); }
18352                         CResult_u32GraphSyncErrorZPtr { err }
18353                 };
18354                 Self {
18355                         contents,
18356                         result_ok: o.result_ok,
18357                 }
18358         }
18359 }