b98e1c3a861fd43ad54c27cf8d6f77ac9d3b8595
[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_RefundBolt12ParseErrorZ
132 pub union CResult_RefundBolt12ParseErrorZPtr {
133         /// A pointer to the contents in the success state.
134         /// Reading from this pointer when `result_ok` is not set is undefined.
135         pub result: *mut crate::lightning::offers::refund::Refund,
136         /// A pointer to the contents in the error state.
137         /// Reading from this pointer when `result_ok` is set is undefined.
138         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
139 }
140 #[repr(C)]
141 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
142 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
144 pub struct CResult_RefundBolt12ParseErrorZ {
145         /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
146         /// `err` or `result` depending on the state of `result_ok`.
147         pub contents: CResult_RefundBolt12ParseErrorZPtr,
148         /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
149         pub result_ok: bool,
150 }
151 #[no_mangle]
152 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
153 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
154         CResult_RefundBolt12ParseErrorZ {
155                 contents: CResult_RefundBolt12ParseErrorZPtr {
156                         result: Box::into_raw(Box::new(o)),
157                 },
158                 result_ok: true,
159         }
160 }
161 #[no_mangle]
162 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
163 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
164         CResult_RefundBolt12ParseErrorZ {
165                 contents: CResult_RefundBolt12ParseErrorZPtr {
166                         err: Box::into_raw(Box::new(e)),
167                 },
168                 result_ok: false,
169         }
170 }
171 /// Checks if the given object is currently in the success state
172 #[no_mangle]
173 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
174         o.result_ok
175 }
176 #[no_mangle]
177 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
178 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
179 impl Drop for CResult_RefundBolt12ParseErrorZ {
180         fn drop(&mut self) {
181                 if self.result_ok {
182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
184                         }
185                 } else {
186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
188                         }
189                 }
190         }
191 }
192 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
194                 let contents = if o.result_ok {
195                         let result = unsafe { o.contents.result };
196                         unsafe { o.contents.result = core::ptr::null_mut() };
197                         CResult_RefundBolt12ParseErrorZPtr { result }
198                 } else {
199                         let err = unsafe { o.contents.err };
200                         unsafe { o.contents.err = core::ptr::null_mut(); }
201                         CResult_RefundBolt12ParseErrorZPtr { err }
202                 };
203                 Self {
204                         contents,
205                         result_ok: o.result_ok,
206                 }
207         }
208 }
209 impl Clone for CResult_RefundBolt12ParseErrorZ {
210         fn clone(&self) -> Self {
211                 if self.result_ok {
212                         Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
213                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
214                         } }
215                 } else {
216                         Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
217                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
218                         } }
219                 }
220         }
221 }
222 #[no_mangle]
223 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
224 /// but with all dynamically-allocated buffers duplicated in new buffers.
225 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
226 #[repr(C)]
227 /// The contents of CResult_NoneAPIErrorZ
228 pub union CResult_NoneAPIErrorZPtr {
229         /// Note that this value is always NULL, as there are no contents in the OK variant
230         pub result: *mut core::ffi::c_void,
231         /// A pointer to the contents in the error state.
232         /// Reading from this pointer when `result_ok` is set is undefined.
233         pub err: *mut crate::lightning::util::errors::APIError,
234 }
235 #[repr(C)]
236 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
237 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
239 pub struct CResult_NoneAPIErrorZ {
240         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
241         /// `err` or `result` depending on the state of `result_ok`.
242         pub contents: CResult_NoneAPIErrorZPtr,
243         /// Whether this CResult_NoneAPIErrorZ represents a success state.
244         pub result_ok: bool,
245 }
246 #[no_mangle]
247 /// Creates a new CResult_NoneAPIErrorZ in the success state.
248 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
249         CResult_NoneAPIErrorZ {
250                 contents: CResult_NoneAPIErrorZPtr {
251                         result: core::ptr::null_mut(),
252                 },
253                 result_ok: true,
254         }
255 }
256 #[no_mangle]
257 /// Creates a new CResult_NoneAPIErrorZ in the error state.
258 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
259         CResult_NoneAPIErrorZ {
260                 contents: CResult_NoneAPIErrorZPtr {
261                         err: Box::into_raw(Box::new(e)),
262                 },
263                 result_ok: false,
264         }
265 }
266 /// Checks if the given object is currently in the success state
267 #[no_mangle]
268 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
269         o.result_ok
270 }
271 #[no_mangle]
272 /// Frees any resources used by the CResult_NoneAPIErrorZ.
273 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
274 impl Drop for CResult_NoneAPIErrorZ {
275         fn drop(&mut self) {
276                 if self.result_ok {
277                 } else {
278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
280                         }
281                 }
282         }
283 }
284 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
285         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
286                 let contents = if o.result_ok {
287                         let _ = unsafe { Box::from_raw(o.contents.result) };
288                         o.contents.result = core::ptr::null_mut();
289                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
290                 } else {
291                         let err = unsafe { o.contents.err };
292                         unsafe { o.contents.err = core::ptr::null_mut(); }
293                         CResult_NoneAPIErrorZPtr { err }
294                 };
295                 Self {
296                         contents,
297                         result_ok: o.result_ok,
298                 }
299         }
300 }
301 impl Clone for CResult_NoneAPIErrorZ {
302         fn clone(&self) -> Self {
303                 if self.result_ok {
304                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
305                                 result: core::ptr::null_mut()
306                         } }
307                 } else {
308                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
309                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
310                         } }
311                 }
312         }
313 }
314 #[no_mangle]
315 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
316 /// but with all dynamically-allocated buffers duplicated in new buffers.
317 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
318 #[repr(C)]
319 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
320 /// This corresponds to std::vector in C++
321 pub struct CVec_CResult_NoneAPIErrorZZ {
322         /// The elements in the array.
323         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
324         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
325         /// The number of elements pointed to by `data`.
326         pub datalen: usize
327 }
328 impl CVec_CResult_NoneAPIErrorZZ {
329         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
330                 if self.datalen == 0 { return Vec::new(); }
331                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
332                 self.data = core::ptr::null_mut();
333                 self.datalen = 0;
334                 ret
335         }
336         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
337                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
338         }
339 }
340 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
341         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
342                 let datalen = v.len();
343                 let data = Box::into_raw(v.into_boxed_slice());
344                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
345         }
346 }
347 #[no_mangle]
348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
349 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
350 impl Drop for CVec_CResult_NoneAPIErrorZZ {
351         fn drop(&mut self) {
352                 if self.datalen == 0 { return; }
353                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
354         }
355 }
356 impl Clone for CVec_CResult_NoneAPIErrorZZ {
357         fn clone(&self) -> Self {
358                 let mut res = Vec::new();
359                 if self.datalen == 0 { return Self::from(res); }
360                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
361                 Self::from(res)
362         }
363 }
364 #[repr(C)]
365 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
366 /// This corresponds to std::vector in C++
367 pub struct CVec_APIErrorZ {
368         /// The elements in the array.
369         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
370         pub data: *mut crate::lightning::util::errors::APIError,
371         /// The number of elements pointed to by `data`.
372         pub datalen: usize
373 }
374 impl CVec_APIErrorZ {
375         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
376                 if self.datalen == 0 { return Vec::new(); }
377                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
378                 self.data = core::ptr::null_mut();
379                 self.datalen = 0;
380                 ret
381         }
382         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
383                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
384         }
385 }
386 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
387         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
388                 let datalen = v.len();
389                 let data = Box::into_raw(v.into_boxed_slice());
390                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
391         }
392 }
393 #[no_mangle]
394 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
395 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
396 impl Drop for CVec_APIErrorZ {
397         fn drop(&mut self) {
398                 if self.datalen == 0 { return; }
399                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
400         }
401 }
402 impl Clone for CVec_APIErrorZ {
403         fn clone(&self) -> Self {
404                 let mut res = Vec::new();
405                 if self.datalen == 0 { return Self::from(res); }
406                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
407                 Self::from(res)
408         }
409 }
410 #[repr(C)]
411 #[derive(Clone)]
412 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
413 pub enum COption_PaymentSecretZ {
414         /// When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes
415         Some(crate::c_types::ThirtyTwoBytes),
416         /// When we're in this state, this COption_PaymentSecretZ contains nothing
417         None
418 }
419 impl COption_PaymentSecretZ {
420         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
421                 if let Self::None = self { false } else { true }
422         }
423         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
424                 !self.is_some()
425         }
426         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
427                 if let Self::Some(v) = self { v } else { unreachable!() }
428         }
429 }
430 #[no_mangle]
431 /// Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes
432 pub extern "C" fn COption_PaymentSecretZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentSecretZ {
433         COption_PaymentSecretZ::Some(o)
434 }
435 #[no_mangle]
436 /// Constructs a new COption_PaymentSecretZ containing nothing
437 pub extern "C" fn COption_PaymentSecretZ_none() -> COption_PaymentSecretZ {
438         COption_PaymentSecretZ::None
439 }
440 #[no_mangle]
441 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
442 pub extern "C" fn COption_PaymentSecretZ_free(_res: COption_PaymentSecretZ) { }
443 #[no_mangle]
444 /// Creates a new COption_PaymentSecretZ which has the same data as `orig`
445 /// but with all dynamically-allocated buffers duplicated in new buffers.
446 pub extern "C" fn COption_PaymentSecretZ_clone(orig: &COption_PaymentSecretZ) -> COption_PaymentSecretZ { Clone::clone(&orig) }
447 #[repr(C)]
448 /// A dynamically-allocated array of u8s of arbitrary size.
449 /// This corresponds to std::vector in C++
450 pub struct CVec_u8Z {
451         /// The elements in the array.
452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
453         pub data: *mut u8,
454         /// The number of elements pointed to by `data`.
455         pub datalen: usize
456 }
457 impl CVec_u8Z {
458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
459                 if self.datalen == 0 { return Vec::new(); }
460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
461                 self.data = core::ptr::null_mut();
462                 self.datalen = 0;
463                 ret
464         }
465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
467         }
468 }
469 impl From<Vec<u8>> for CVec_u8Z {
470         fn from(v: Vec<u8>) -> Self {
471                 let datalen = v.len();
472                 let data = Box::into_raw(v.into_boxed_slice());
473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
474         }
475 }
476 #[no_mangle]
477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
478 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
479 impl Drop for CVec_u8Z {
480         fn drop(&mut self) {
481                 if self.datalen == 0 { return; }
482                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
483         }
484 }
485 impl Clone for CVec_u8Z {
486         fn clone(&self) -> Self {
487                 let mut res = Vec::new();
488                 if self.datalen == 0 { return Self::from(res); }
489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
490                 Self::from(res)
491         }
492 }
493 #[repr(C)]
494 #[derive(Clone)]
495 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
496 pub enum COption_CVec_u8ZZ {
497         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
498         Some(crate::c_types::derived::CVec_u8Z),
499         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
500         None
501 }
502 impl COption_CVec_u8ZZ {
503         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
504                 if let Self::None = self { false } else { true }
505         }
506         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
507                 !self.is_some()
508         }
509         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
510                 if let Self::Some(v) = self { v } else { unreachable!() }
511         }
512 }
513 #[no_mangle]
514 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
515 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
516         COption_CVec_u8ZZ::Some(o)
517 }
518 #[no_mangle]
519 /// Constructs a new COption_CVec_u8ZZ containing nothing
520 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
521         COption_CVec_u8ZZ::None
522 }
523 #[no_mangle]
524 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
525 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
526 #[no_mangle]
527 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
528 /// but with all dynamically-allocated buffers duplicated in new buffers.
529 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
530 #[repr(C)]
531 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
532 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
533         /// A pointer to the contents in the success state.
534         /// Reading from this pointer when `result_ok` is not set is undefined.
535         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
536         /// A pointer to the contents in the error state.
537         /// Reading from this pointer when `result_ok` is set is undefined.
538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
539 }
540 #[repr(C)]
541 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
542 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
544 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
545         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
546         /// `err` or `result` depending on the state of `result_ok`.
547         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
548         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
549         pub result_ok: bool,
550 }
551 #[no_mangle]
552 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
553 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
554         CResult_RecipientOnionFieldsDecodeErrorZ {
555                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
556                         result: Box::into_raw(Box::new(o)),
557                 },
558                 result_ok: true,
559         }
560 }
561 #[no_mangle]
562 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
563 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
564         CResult_RecipientOnionFieldsDecodeErrorZ {
565                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
566                         err: Box::into_raw(Box::new(e)),
567                 },
568                 result_ok: false,
569         }
570 }
571 /// Checks if the given object is currently in the success state
572 #[no_mangle]
573 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
574         o.result_ok
575 }
576 #[no_mangle]
577 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
578 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
579 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
580         fn drop(&mut self) {
581                 if self.result_ok {
582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
584                         }
585                 } else {
586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
588                         }
589                 }
590         }
591 }
592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
594                 let contents = if o.result_ok {
595                         let result = unsafe { o.contents.result };
596                         unsafe { o.contents.result = core::ptr::null_mut() };
597                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
598                 } else {
599                         let err = unsafe { o.contents.err };
600                         unsafe { o.contents.err = core::ptr::null_mut(); }
601                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
602                 };
603                 Self {
604                         contents,
605                         result_ok: o.result_ok,
606                 }
607         }
608 }
609 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
610         fn clone(&self) -> Self {
611                 if self.result_ok {
612                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
613                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
614                         } }
615                 } else {
616                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
618                         } }
619                 }
620         }
621 }
622 #[no_mangle]
623 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
624 /// but with all dynamically-allocated buffers duplicated in new buffers.
625 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
626 #[repr(C)]
627 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
628 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
629         /// A pointer to the contents in the success state.
630         /// Reading from this pointer when `result_ok` is not set is undefined.
631         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
632         /// A pointer to the contents in the error state.
633         /// Reading from this pointer when `result_ok` is set is undefined.
634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
635 }
636 #[repr(C)]
637 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
638 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
640 pub struct CResult_BlindedPayInfoDecodeErrorZ {
641         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
642         /// `err` or `result` depending on the state of `result_ok`.
643         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
644         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
645         pub result_ok: bool,
646 }
647 #[no_mangle]
648 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
649 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
650         CResult_BlindedPayInfoDecodeErrorZ {
651                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
652                         result: Box::into_raw(Box::new(o)),
653                 },
654                 result_ok: true,
655         }
656 }
657 #[no_mangle]
658 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
659 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
660         CResult_BlindedPayInfoDecodeErrorZ {
661                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
662                         err: Box::into_raw(Box::new(e)),
663                 },
664                 result_ok: false,
665         }
666 }
667 /// Checks if the given object is currently in the success state
668 #[no_mangle]
669 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
670         o.result_ok
671 }
672 #[no_mangle]
673 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
674 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
675 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
676         fn drop(&mut self) {
677                 if self.result_ok {
678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
680                         }
681                 } else {
682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
684                         }
685                 }
686         }
687 }
688 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
690                 let contents = if o.result_ok {
691                         let result = unsafe { o.contents.result };
692                         unsafe { o.contents.result = core::ptr::null_mut() };
693                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
694                 } else {
695                         let err = unsafe { o.contents.err };
696                         unsafe { o.contents.err = core::ptr::null_mut(); }
697                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
698                 };
699                 Self {
700                         contents,
701                         result_ok: o.result_ok,
702                 }
703         }
704 }
705 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
706         fn clone(&self) -> Self {
707                 if self.result_ok {
708                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
709                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
710                         } }
711                 } else {
712                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
714                         } }
715                 }
716         }
717 }
718 #[no_mangle]
719 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
720 /// but with all dynamically-allocated buffers duplicated in new buffers.
721 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
722 #[repr(C)]
723 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
724 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
725         /// A pointer to the contents in the success state.
726         /// Reading from this pointer when `result_ok` is not set is undefined.
727         pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
728         /// A pointer to the contents in the error state.
729         /// Reading from this pointer when `result_ok` is set is undefined.
730         pub err: *mut crate::lightning::ln::msgs::DecodeError,
731 }
732 #[repr(C)]
733 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
734 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
736 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
737         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
738         /// `err` or `result` depending on the state of `result_ok`.
739         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
740         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
741         pub result_ok: bool,
742 }
743 #[no_mangle]
744 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
745 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
746         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
747                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
748                         result: Box::into_raw(Box::new(o)),
749                 },
750                 result_ok: true,
751         }
752 }
753 #[no_mangle]
754 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
755 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
756         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
757                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
758                         err: Box::into_raw(Box::new(e)),
759                 },
760                 result_ok: false,
761         }
762 }
763 /// Checks if the given object is currently in the success state
764 #[no_mangle]
765 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
766         o.result_ok
767 }
768 #[no_mangle]
769 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
770 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
771 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
772         fn drop(&mut self) {
773                 if self.result_ok {
774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
776                         }
777                 } else {
778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
780                         }
781                 }
782         }
783 }
784 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
785         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
786                 let contents = if o.result_ok {
787                         let result = unsafe { o.contents.result };
788                         unsafe { o.contents.result = core::ptr::null_mut() };
789                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
790                 } else {
791                         let err = unsafe { o.contents.err };
792                         unsafe { o.contents.err = core::ptr::null_mut(); }
793                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
794                 };
795                 Self {
796                         contents,
797                         result_ok: o.result_ok,
798                 }
799         }
800 }
801 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
802         fn clone(&self) -> Self {
803                 if self.result_ok {
804                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
805                                 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
806                         } }
807                 } else {
808                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
809                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
810                         } }
811                 }
812         }
813 }
814 #[no_mangle]
815 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
816 /// but with all dynamically-allocated buffers duplicated in new buffers.
817 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
818 #[repr(C)]
819 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
820 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
821         /// A pointer to the contents in the success state.
822         /// Reading from this pointer when `result_ok` is not set is undefined.
823         pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
824         /// A pointer to the contents in the error state.
825         /// Reading from this pointer when `result_ok` is set is undefined.
826         pub err: *mut crate::lightning::ln::msgs::DecodeError,
827 }
828 #[repr(C)]
829 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
830 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
832 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
833         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
834         /// `err` or `result` depending on the state of `result_ok`.
835         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
836         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
837         pub result_ok: bool,
838 }
839 #[no_mangle]
840 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
841 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
842         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
843                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
844                         result: Box::into_raw(Box::new(o)),
845                 },
846                 result_ok: true,
847         }
848 }
849 #[no_mangle]
850 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
851 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
852         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
853                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
854                         err: Box::into_raw(Box::new(e)),
855                 },
856                 result_ok: false,
857         }
858 }
859 /// Checks if the given object is currently in the success state
860 #[no_mangle]
861 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
862         o.result_ok
863 }
864 #[no_mangle]
865 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
866 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
867 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
868         fn drop(&mut self) {
869                 if self.result_ok {
870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
872                         }
873                 } else {
874                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
875                                 let _ = unsafe { Box::from_raw(self.contents.err) };
876                         }
877                 }
878         }
879 }
880 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
881         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
882                 let contents = if o.result_ok {
883                         let result = unsafe { o.contents.result };
884                         unsafe { o.contents.result = core::ptr::null_mut() };
885                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
886                 } else {
887                         let err = unsafe { o.contents.err };
888                         unsafe { o.contents.err = core::ptr::null_mut(); }
889                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
890                 };
891                 Self {
892                         contents,
893                         result_ok: o.result_ok,
894                 }
895         }
896 }
897 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
898         fn clone(&self) -> Self {
899                 if self.result_ok {
900                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
901                                 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
902                         } }
903                 } else {
904                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
905                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
906                         } }
907                 }
908         }
909 }
910 #[no_mangle]
911 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
912 /// but with all dynamically-allocated buffers duplicated in new buffers.
913 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
914 #[repr(C)]
915 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
916 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
917         /// A pointer to the contents in the success state.
918         /// Reading from this pointer when `result_ok` is not set is undefined.
919         pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
920         /// A pointer to the contents in the error state.
921         /// Reading from this pointer when `result_ok` is set is undefined.
922         pub err: *mut crate::lightning::ln::msgs::DecodeError,
923 }
924 #[repr(C)]
925 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
926 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
928 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
929         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
930         /// `err` or `result` depending on the state of `result_ok`.
931         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
932         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
933         pub result_ok: bool,
934 }
935 #[no_mangle]
936 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
937 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
938         CResult_SpendableOutputDescriptorDecodeErrorZ {
939                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
940                         result: Box::into_raw(Box::new(o)),
941                 },
942                 result_ok: true,
943         }
944 }
945 #[no_mangle]
946 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
947 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
948         CResult_SpendableOutputDescriptorDecodeErrorZ {
949                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
950                         err: Box::into_raw(Box::new(e)),
951                 },
952                 result_ok: false,
953         }
954 }
955 /// Checks if the given object is currently in the success state
956 #[no_mangle]
957 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
958         o.result_ok
959 }
960 #[no_mangle]
961 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
962 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
963 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
964         fn drop(&mut self) {
965                 if self.result_ok {
966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
968                         }
969                 } else {
970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
972                         }
973                 }
974         }
975 }
976 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
977         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
978                 let contents = if o.result_ok {
979                         let result = unsafe { o.contents.result };
980                         unsafe { o.contents.result = core::ptr::null_mut() };
981                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
982                 } else {
983                         let err = unsafe { o.contents.err };
984                         unsafe { o.contents.err = core::ptr::null_mut(); }
985                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
986                 };
987                 Self {
988                         contents,
989                         result_ok: o.result_ok,
990                 }
991         }
992 }
993 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
994         fn clone(&self) -> Self {
995                 if self.result_ok {
996                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
997                                 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
998                         } }
999                 } else {
1000                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1001                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1002                         } }
1003                 }
1004         }
1005 }
1006 #[no_mangle]
1007 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1008 /// but with all dynamically-allocated buffers duplicated in new buffers.
1009 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1010 #[repr(C)]
1011 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1012 /// This corresponds to std::vector in C++
1013 pub struct CVec_SpendableOutputDescriptorZ {
1014         /// The elements in the array.
1015         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1016         pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1017         /// The number of elements pointed to by `data`.
1018         pub datalen: usize
1019 }
1020 impl CVec_SpendableOutputDescriptorZ {
1021         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1022                 if self.datalen == 0 { return Vec::new(); }
1023                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1024                 self.data = core::ptr::null_mut();
1025                 self.datalen = 0;
1026                 ret
1027         }
1028         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1029                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1030         }
1031 }
1032 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1033         fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1034                 let datalen = v.len();
1035                 let data = Box::into_raw(v.into_boxed_slice());
1036                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1037         }
1038 }
1039 #[no_mangle]
1040 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1041 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1042 impl Drop for CVec_SpendableOutputDescriptorZ {
1043         fn drop(&mut self) {
1044                 if self.datalen == 0 { return; }
1045                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1046         }
1047 }
1048 impl Clone for CVec_SpendableOutputDescriptorZ {
1049         fn clone(&self) -> Self {
1050                 let mut res = Vec::new();
1051                 if self.datalen == 0 { return Self::from(res); }
1052                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1053                 Self::from(res)
1054         }
1055 }
1056 #[repr(C)]
1057 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1058 /// This corresponds to std::vector in C++
1059 pub struct CVec_TxOutZ {
1060         /// The elements in the array.
1061         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1062         pub data: *mut crate::c_types::TxOut,
1063         /// The number of elements pointed to by `data`.
1064         pub datalen: usize
1065 }
1066 impl CVec_TxOutZ {
1067         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1068                 if self.datalen == 0 { return Vec::new(); }
1069                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1070                 self.data = core::ptr::null_mut();
1071                 self.datalen = 0;
1072                 ret
1073         }
1074         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
1075                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1076         }
1077 }
1078 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
1079         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
1080                 let datalen = v.len();
1081                 let data = Box::into_raw(v.into_boxed_slice());
1082                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1083         }
1084 }
1085 #[no_mangle]
1086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1087 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
1088 impl Drop for CVec_TxOutZ {
1089         fn drop(&mut self) {
1090                 if self.datalen == 0 { return; }
1091                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1092         }
1093 }
1094 impl Clone for CVec_TxOutZ {
1095         fn clone(&self) -> Self {
1096                 let mut res = Vec::new();
1097                 if self.datalen == 0 { return Self::from(res); }
1098                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1099                 Self::from(res)
1100         }
1101 }
1102 #[repr(C)]
1103 #[derive(Clone)]
1104 /// An enum which can either contain a u32 or not
1105 pub enum COption_PackedLockTimeZ {
1106         /// When we're in this state, this COption_PackedLockTimeZ contains a u32
1107         Some(u32),
1108         /// When we're in this state, this COption_PackedLockTimeZ contains nothing
1109         None
1110 }
1111 impl COption_PackedLockTimeZ {
1112         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1113                 if let Self::None = self { false } else { true }
1114         }
1115         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1116                 !self.is_some()
1117         }
1118         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
1119                 if let Self::Some(v) = self { v } else { unreachable!() }
1120         }
1121 }
1122 #[no_mangle]
1123 /// Constructs a new COption_PackedLockTimeZ containing a u32
1124 pub extern "C" fn COption_PackedLockTimeZ_some(o: u32) -> COption_PackedLockTimeZ {
1125         COption_PackedLockTimeZ::Some(o)
1126 }
1127 #[no_mangle]
1128 /// Constructs a new COption_PackedLockTimeZ containing nothing
1129 pub extern "C" fn COption_PackedLockTimeZ_none() -> COption_PackedLockTimeZ {
1130         COption_PackedLockTimeZ::None
1131 }
1132 #[no_mangle]
1133 /// Frees any resources associated with the u32, if we are in the Some state
1134 pub extern "C" fn COption_PackedLockTimeZ_free(_res: COption_PackedLockTimeZ) { }
1135 #[no_mangle]
1136 /// Creates a new COption_PackedLockTimeZ which has the same data as `orig`
1137 /// but with all dynamically-allocated buffers duplicated in new buffers.
1138 pub extern "C" fn COption_PackedLockTimeZ_clone(orig: &COption_PackedLockTimeZ) -> COption_PackedLockTimeZ { Clone::clone(&orig) }
1139 #[repr(C)]
1140 /// A tuple of 2 elements. See the individual fields for the types contained.
1141 pub struct C2Tuple_PartiallySignedTransactionusizeZ {
1142         /// The element at position 0
1143         pub a: crate::c_types::derived::CVec_u8Z,
1144         /// The element at position 1
1145         pub b: usize,
1146 }
1147 impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_PartiallySignedTransactionusizeZ {
1148         fn from (tup: (crate::c_types::derived::CVec_u8Z, usize)) -> Self {
1149                 Self {
1150                         a: tup.0,
1151                         b: tup.1,
1152                 }
1153         }
1154 }
1155 impl C2Tuple_PartiallySignedTransactionusizeZ {
1156         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, usize) {
1157                 (self.a, self.b)
1158         }
1159 }
1160 impl Clone for C2Tuple_PartiallySignedTransactionusizeZ {
1161         fn clone(&self) -> Self {
1162                 Self {
1163                         a: Clone::clone(&self.a),
1164                         b: Clone::clone(&self.b),
1165                 }
1166         }
1167 }
1168 #[no_mangle]
1169 /// Creates a new tuple which has the same data as `orig`
1170 /// but with all dynamically-allocated buffers duplicated in new buffers.
1171 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_clone(orig: &C2Tuple_PartiallySignedTransactionusizeZ) -> C2Tuple_PartiallySignedTransactionusizeZ { Clone::clone(&orig) }
1172 /// Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements.
1173 #[no_mangle]
1174 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_PartiallySignedTransactionusizeZ {
1175         C2Tuple_PartiallySignedTransactionusizeZ { a, b, }
1176 }
1177
1178 #[no_mangle]
1179 /// Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ.
1180 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_free(_res: C2Tuple_PartiallySignedTransactionusizeZ) { }
1181 #[repr(C)]
1182 /// The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ
1183 pub union CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1184         /// A pointer to the contents in the success state.
1185         /// Reading from this pointer when `result_ok` is not set is undefined.
1186         pub result: *mut crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ,
1187         /// Note that this value is always NULL, as there are no contents in the Err variant
1188         pub err: *mut core::ffi::c_void,
1189 }
1190 #[repr(C)]
1191 /// A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation,
1192 /// containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure.
1193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1194 pub struct CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1195         /// The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either
1196         /// `err` or `result` depending on the state of `result_ok`.
1197         pub contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr,
1198         /// Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state.
1199         pub result_ok: bool,
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state.
1203 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1204         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1205                 contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1206                         result: Box::into_raw(Box::new(o)),
1207                 },
1208                 result_ok: true,
1209         }
1210 }
1211 #[no_mangle]
1212 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state.
1213 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1214         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1215                 contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1216                         err: core::ptr::null_mut(),
1217                 },
1218                 result_ok: false,
1219         }
1220 }
1221 /// Checks if the given object is currently in the success state
1222 #[no_mangle]
1223 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> bool {
1224         o.result_ok
1225 }
1226 #[no_mangle]
1227 /// Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ.
1228 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) { }
1229 impl Drop for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1230         fn drop(&mut self) {
1231                 if self.result_ok {
1232                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1233                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1234                         }
1235                 } else {
1236                 }
1237         }
1238 }
1239 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ, ()>> for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1240         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ, ()>) -> Self {
1241                 let contents = if o.result_ok {
1242                         let result = unsafe { o.contents.result };
1243                         unsafe { o.contents.result = core::ptr::null_mut() };
1244                         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { result }
1245                 } else {
1246                         let _ = unsafe { Box::from_raw(o.contents.err) };
1247                         o.contents.err = core::ptr::null_mut();
1248                         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { err: core::ptr::null_mut() }
1249                 };
1250                 Self {
1251                         contents,
1252                         result_ok: o.result_ok,
1253                 }
1254         }
1255 }
1256 impl Clone for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1257         fn clone(&self) -> Self {
1258                 if self.result_ok {
1259                         Self { result_ok: true, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1260                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ>::clone(unsafe { &*self.contents.result })))
1261                         } }
1262                 } else {
1263                         Self { result_ok: false, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1264                                 err: core::ptr::null_mut()
1265                         } }
1266                 }
1267         }
1268 }
1269 #[no_mangle]
1270 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig`
1271 /// but with all dynamically-allocated buffers duplicated in new buffers.
1272 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { Clone::clone(&orig) }
1273 #[repr(C)]
1274 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1275 /// This corresponds to std::vector in C++
1276 pub struct CVec_PaymentPreimageZ {
1277         /// The elements in the array.
1278         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1279         pub data: *mut crate::c_types::ThirtyTwoBytes,
1280         /// The number of elements pointed to by `data`.
1281         pub datalen: usize
1282 }
1283 impl CVec_PaymentPreimageZ {
1284         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1285                 if self.datalen == 0 { return Vec::new(); }
1286                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1287                 self.data = core::ptr::null_mut();
1288                 self.datalen = 0;
1289                 ret
1290         }
1291         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1292                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1293         }
1294 }
1295 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
1296         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1297                 let datalen = v.len();
1298                 let data = Box::into_raw(v.into_boxed_slice());
1299                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1300         }
1301 }
1302 #[no_mangle]
1303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1304 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
1305 impl Drop for CVec_PaymentPreimageZ {
1306         fn drop(&mut self) {
1307                 if self.datalen == 0 { return; }
1308                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1309         }
1310 }
1311 impl Clone for CVec_PaymentPreimageZ {
1312         fn clone(&self) -> Self {
1313                 let mut res = Vec::new();
1314                 if self.datalen == 0 { return Self::from(res); }
1315                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1316                 Self::from(res)
1317         }
1318 }
1319 #[repr(C)]
1320 /// The contents of CResult_NoneNoneZ
1321 pub union CResult_NoneNoneZPtr {
1322         /// Note that this value is always NULL, as there are no contents in the OK variant
1323         pub result: *mut core::ffi::c_void,
1324         /// Note that this value is always NULL, as there are no contents in the Err variant
1325         pub err: *mut core::ffi::c_void,
1326 }
1327 #[repr(C)]
1328 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1329 /// containing a () on success and a () on failure.
1330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1331 pub struct CResult_NoneNoneZ {
1332         /// The contents of this CResult_NoneNoneZ, accessible via either
1333         /// `err` or `result` depending on the state of `result_ok`.
1334         pub contents: CResult_NoneNoneZPtr,
1335         /// Whether this CResult_NoneNoneZ represents a success state.
1336         pub result_ok: bool,
1337 }
1338 #[no_mangle]
1339 /// Creates a new CResult_NoneNoneZ in the success state.
1340 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1341         CResult_NoneNoneZ {
1342                 contents: CResult_NoneNoneZPtr {
1343                         result: core::ptr::null_mut(),
1344                 },
1345                 result_ok: true,
1346         }
1347 }
1348 #[no_mangle]
1349 /// Creates a new CResult_NoneNoneZ in the error state.
1350 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1351         CResult_NoneNoneZ {
1352                 contents: CResult_NoneNoneZPtr {
1353                         err: core::ptr::null_mut(),
1354                 },
1355                 result_ok: false,
1356         }
1357 }
1358 /// Checks if the given object is currently in the success state
1359 #[no_mangle]
1360 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1361         o.result_ok
1362 }
1363 #[no_mangle]
1364 /// Frees any resources used by the CResult_NoneNoneZ.
1365 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1366 impl Drop for CResult_NoneNoneZ {
1367         fn drop(&mut self) {
1368                 if self.result_ok {
1369                 } else {
1370                 }
1371         }
1372 }
1373 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1374         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1375                 let contents = if o.result_ok {
1376                         let _ = unsafe { Box::from_raw(o.contents.result) };
1377                         o.contents.result = core::ptr::null_mut();
1378                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1379                 } else {
1380                         let _ = unsafe { Box::from_raw(o.contents.err) };
1381                         o.contents.err = core::ptr::null_mut();
1382                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1383                 };
1384                 Self {
1385                         contents,
1386                         result_ok: o.result_ok,
1387                 }
1388         }
1389 }
1390 impl Clone for CResult_NoneNoneZ {
1391         fn clone(&self) -> Self {
1392                 if self.result_ok {
1393                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1394                                 result: core::ptr::null_mut()
1395                         } }
1396                 } else {
1397                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1398                                 err: core::ptr::null_mut()
1399                         } }
1400                 }
1401         }
1402 }
1403 #[no_mangle]
1404 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1405 /// but with all dynamically-allocated buffers duplicated in new buffers.
1406 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1407 #[repr(C)]
1408 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1409 /// This corresponds to std::vector in C++
1410 pub struct CVec_SignatureZ {
1411         /// The elements in the array.
1412         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1413         pub data: *mut crate::c_types::Signature,
1414         /// The number of elements pointed to by `data`.
1415         pub datalen: usize
1416 }
1417 impl CVec_SignatureZ {
1418         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1419                 if self.datalen == 0 { return Vec::new(); }
1420                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1421                 self.data = core::ptr::null_mut();
1422                 self.datalen = 0;
1423                 ret
1424         }
1425         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1426                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1427         }
1428 }
1429 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1430         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1431                 let datalen = v.len();
1432                 let data = Box::into_raw(v.into_boxed_slice());
1433                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1434         }
1435 }
1436 #[no_mangle]
1437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1438 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1439 impl Drop for CVec_SignatureZ {
1440         fn drop(&mut self) {
1441                 if self.datalen == 0 { return; }
1442                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1443         }
1444 }
1445 impl Clone for CVec_SignatureZ {
1446         fn clone(&self) -> Self {
1447                 let mut res = Vec::new();
1448                 if self.datalen == 0 { return Self::from(res); }
1449                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1450                 Self::from(res)
1451         }
1452 }
1453 #[repr(C)]
1454 /// A tuple of 2 elements. See the individual fields for the types contained.
1455 pub struct C2Tuple_SignatureCVec_SignatureZZ {
1456         /// The element at position 0
1457         pub a: crate::c_types::Signature,
1458         /// The element at position 1
1459         pub b: crate::c_types::derived::CVec_SignatureZ,
1460 }
1461 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
1462         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
1463                 Self {
1464                         a: tup.0,
1465                         b: tup.1,
1466                 }
1467         }
1468 }
1469 impl C2Tuple_SignatureCVec_SignatureZZ {
1470         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
1471                 (self.a, self.b)
1472         }
1473 }
1474 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
1475         fn clone(&self) -> Self {
1476                 Self {
1477                         a: Clone::clone(&self.a),
1478                         b: Clone::clone(&self.b),
1479                 }
1480         }
1481 }
1482 #[no_mangle]
1483 /// Creates a new tuple which has the same data as `orig`
1484 /// but with all dynamically-allocated buffers duplicated in new buffers.
1485 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
1486 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
1487 #[no_mangle]
1488 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
1489         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
1490 }
1491
1492 #[no_mangle]
1493 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
1494 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
1495 #[repr(C)]
1496 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
1497 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1498         /// A pointer to the contents in the success state.
1499         /// Reading from this pointer when `result_ok` is not set is undefined.
1500         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
1501         /// Note that this value is always NULL, as there are no contents in the Err variant
1502         pub err: *mut core::ffi::c_void,
1503 }
1504 #[repr(C)]
1505 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
1506 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
1507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1508 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1509         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
1510         /// `err` or `result` depending on the state of `result_ok`.
1511         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
1512         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
1513         pub result_ok: bool,
1514 }
1515 #[no_mangle]
1516 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
1517 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1518         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1519                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1520                         result: Box::into_raw(Box::new(o)),
1521                 },
1522                 result_ok: true,
1523         }
1524 }
1525 #[no_mangle]
1526 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
1527 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1528         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1529                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1530                         err: core::ptr::null_mut(),
1531                 },
1532                 result_ok: false,
1533         }
1534 }
1535 /// Checks if the given object is currently in the success state
1536 #[no_mangle]
1537 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
1538         o.result_ok
1539 }
1540 #[no_mangle]
1541 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
1542 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
1543 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1544         fn drop(&mut self) {
1545                 if self.result_ok {
1546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1548                         }
1549                 } else {
1550                 }
1551         }
1552 }
1553 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1554         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
1555                 let contents = if o.result_ok {
1556                         let result = unsafe { o.contents.result };
1557                         unsafe { o.contents.result = core::ptr::null_mut() };
1558                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
1559                 } else {
1560                         let _ = unsafe { Box::from_raw(o.contents.err) };
1561                         o.contents.err = core::ptr::null_mut();
1562                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
1563                 };
1564                 Self {
1565                         contents,
1566                         result_ok: o.result_ok,
1567                 }
1568         }
1569 }
1570 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1571         fn clone(&self) -> Self {
1572                 if self.result_ok {
1573                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1574                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
1575                         } }
1576                 } else {
1577                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1578                                 err: core::ptr::null_mut()
1579                         } }
1580                 }
1581         }
1582 }
1583 #[no_mangle]
1584 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
1587 #[repr(C)]
1588 /// The contents of CResult_SignatureNoneZ
1589 pub union CResult_SignatureNoneZPtr {
1590         /// A pointer to the contents in the success state.
1591         /// Reading from this pointer when `result_ok` is not set is undefined.
1592         pub result: *mut crate::c_types::Signature,
1593         /// Note that this value is always NULL, as there are no contents in the Err variant
1594         pub err: *mut core::ffi::c_void,
1595 }
1596 #[repr(C)]
1597 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
1598 /// containing a crate::c_types::Signature on success and a () on failure.
1599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1600 pub struct CResult_SignatureNoneZ {
1601         /// The contents of this CResult_SignatureNoneZ, accessible via either
1602         /// `err` or `result` depending on the state of `result_ok`.
1603         pub contents: CResult_SignatureNoneZPtr,
1604         /// Whether this CResult_SignatureNoneZ represents a success state.
1605         pub result_ok: bool,
1606 }
1607 #[no_mangle]
1608 /// Creates a new CResult_SignatureNoneZ in the success state.
1609 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
1610         CResult_SignatureNoneZ {
1611                 contents: CResult_SignatureNoneZPtr {
1612                         result: Box::into_raw(Box::new(o)),
1613                 },
1614                 result_ok: true,
1615         }
1616 }
1617 #[no_mangle]
1618 /// Creates a new CResult_SignatureNoneZ in the error state.
1619 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
1620         CResult_SignatureNoneZ {
1621                 contents: CResult_SignatureNoneZPtr {
1622                         err: core::ptr::null_mut(),
1623                 },
1624                 result_ok: false,
1625         }
1626 }
1627 /// Checks if the given object is currently in the success state
1628 #[no_mangle]
1629 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
1630         o.result_ok
1631 }
1632 #[no_mangle]
1633 /// Frees any resources used by the CResult_SignatureNoneZ.
1634 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
1635 impl Drop for CResult_SignatureNoneZ {
1636         fn drop(&mut self) {
1637                 if self.result_ok {
1638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1640                         }
1641                 } else {
1642                 }
1643         }
1644 }
1645 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
1646         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
1647                 let contents = if o.result_ok {
1648                         let result = unsafe { o.contents.result };
1649                         unsafe { o.contents.result = core::ptr::null_mut() };
1650                         CResult_SignatureNoneZPtr { result }
1651                 } else {
1652                         let _ = unsafe { Box::from_raw(o.contents.err) };
1653                         o.contents.err = core::ptr::null_mut();
1654                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
1655                 };
1656                 Self {
1657                         contents,
1658                         result_ok: o.result_ok,
1659                 }
1660         }
1661 }
1662 impl Clone for CResult_SignatureNoneZ {
1663         fn clone(&self) -> Self {
1664                 if self.result_ok {
1665                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
1666                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
1667                         } }
1668                 } else {
1669                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
1670                                 err: core::ptr::null_mut()
1671                         } }
1672                 }
1673         }
1674 }
1675 #[no_mangle]
1676 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
1677 /// but with all dynamically-allocated buffers duplicated in new buffers.
1678 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
1679 #[repr(C)]
1680 /// The contents of CResult_PublicKeyNoneZ
1681 pub union CResult_PublicKeyNoneZPtr {
1682         /// A pointer to the contents in the success state.
1683         /// Reading from this pointer when `result_ok` is not set is undefined.
1684         pub result: *mut crate::c_types::PublicKey,
1685         /// Note that this value is always NULL, as there are no contents in the Err variant
1686         pub err: *mut core::ffi::c_void,
1687 }
1688 #[repr(C)]
1689 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
1690 /// containing a crate::c_types::PublicKey on success and a () on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_PublicKeyNoneZ {
1693         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
1694         /// `err` or `result` depending on the state of `result_ok`.
1695         pub contents: CResult_PublicKeyNoneZPtr,
1696         /// Whether this CResult_PublicKeyNoneZ represents a success state.
1697         pub result_ok: bool,
1698 }
1699 #[no_mangle]
1700 /// Creates a new CResult_PublicKeyNoneZ in the success state.
1701 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
1702         CResult_PublicKeyNoneZ {
1703                 contents: CResult_PublicKeyNoneZPtr {
1704                         result: Box::into_raw(Box::new(o)),
1705                 },
1706                 result_ok: true,
1707         }
1708 }
1709 #[no_mangle]
1710 /// Creates a new CResult_PublicKeyNoneZ in the error state.
1711 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
1712         CResult_PublicKeyNoneZ {
1713                 contents: CResult_PublicKeyNoneZPtr {
1714                         err: core::ptr::null_mut(),
1715                 },
1716                 result_ok: false,
1717         }
1718 }
1719 /// Checks if the given object is currently in the success state
1720 #[no_mangle]
1721 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
1722         o.result_ok
1723 }
1724 #[no_mangle]
1725 /// Frees any resources used by the CResult_PublicKeyNoneZ.
1726 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
1727 impl Drop for CResult_PublicKeyNoneZ {
1728         fn drop(&mut self) {
1729                 if self.result_ok {
1730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1732                         }
1733                 } else {
1734                 }
1735         }
1736 }
1737 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
1738         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
1739                 let contents = if o.result_ok {
1740                         let result = unsafe { o.contents.result };
1741                         unsafe { o.contents.result = core::ptr::null_mut() };
1742                         CResult_PublicKeyNoneZPtr { result }
1743                 } else {
1744                         let _ = unsafe { Box::from_raw(o.contents.err) };
1745                         o.contents.err = core::ptr::null_mut();
1746                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
1747                 };
1748                 Self {
1749                         contents,
1750                         result_ok: o.result_ok,
1751                 }
1752         }
1753 }
1754 impl Clone for CResult_PublicKeyNoneZ {
1755         fn clone(&self) -> Self {
1756                 if self.result_ok {
1757                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
1758                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
1759                         } }
1760                 } else {
1761                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
1762                                 err: core::ptr::null_mut()
1763                         } }
1764                 }
1765         }
1766 }
1767 #[no_mangle]
1768 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
1769 /// but with all dynamically-allocated buffers duplicated in new buffers.
1770 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
1771 #[repr(C)]
1772 #[derive(Clone)]
1773 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
1774 pub enum COption_ScalarZ {
1775         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
1776         Some(crate::c_types::BigEndianScalar),
1777         /// When we're in this state, this COption_ScalarZ contains nothing
1778         None
1779 }
1780 impl COption_ScalarZ {
1781         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1782                 if let Self::None = self { false } else { true }
1783         }
1784         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1785                 !self.is_some()
1786         }
1787         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
1788                 if let Self::Some(v) = self { v } else { unreachable!() }
1789         }
1790 }
1791 #[no_mangle]
1792 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
1793 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
1794         COption_ScalarZ::Some(o)
1795 }
1796 #[no_mangle]
1797 /// Constructs a new COption_ScalarZ containing nothing
1798 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
1799         COption_ScalarZ::None
1800 }
1801 #[no_mangle]
1802 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
1803 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
1804 #[no_mangle]
1805 /// Creates a new COption_ScalarZ which has the same data as `orig`
1806 /// but with all dynamically-allocated buffers duplicated in new buffers.
1807 pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) }
1808 #[repr(C)]
1809 /// The contents of CResult_SharedSecretNoneZ
1810 pub union CResult_SharedSecretNoneZPtr {
1811         /// A pointer to the contents in the success state.
1812         /// Reading from this pointer when `result_ok` is not set is undefined.
1813         pub result: *mut crate::c_types::ThirtyTwoBytes,
1814         /// Note that this value is always NULL, as there are no contents in the Err variant
1815         pub err: *mut core::ffi::c_void,
1816 }
1817 #[repr(C)]
1818 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
1819 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1820 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1821 pub struct CResult_SharedSecretNoneZ {
1822         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
1823         /// `err` or `result` depending on the state of `result_ok`.
1824         pub contents: CResult_SharedSecretNoneZPtr,
1825         /// Whether this CResult_SharedSecretNoneZ represents a success state.
1826         pub result_ok: bool,
1827 }
1828 #[no_mangle]
1829 /// Creates a new CResult_SharedSecretNoneZ in the success state.
1830 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
1831         CResult_SharedSecretNoneZ {
1832                 contents: CResult_SharedSecretNoneZPtr {
1833                         result: Box::into_raw(Box::new(o)),
1834                 },
1835                 result_ok: true,
1836         }
1837 }
1838 #[no_mangle]
1839 /// Creates a new CResult_SharedSecretNoneZ in the error state.
1840 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
1841         CResult_SharedSecretNoneZ {
1842                 contents: CResult_SharedSecretNoneZPtr {
1843                         err: core::ptr::null_mut(),
1844                 },
1845                 result_ok: false,
1846         }
1847 }
1848 /// Checks if the given object is currently in the success state
1849 #[no_mangle]
1850 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
1851         o.result_ok
1852 }
1853 #[no_mangle]
1854 /// Frees any resources used by the CResult_SharedSecretNoneZ.
1855 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
1856 impl Drop for CResult_SharedSecretNoneZ {
1857         fn drop(&mut self) {
1858                 if self.result_ok {
1859                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1860                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1861                         }
1862                 } else {
1863                 }
1864         }
1865 }
1866 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
1867         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1868                 let contents = if o.result_ok {
1869                         let result = unsafe { o.contents.result };
1870                         unsafe { o.contents.result = core::ptr::null_mut() };
1871                         CResult_SharedSecretNoneZPtr { result }
1872                 } else {
1873                         let _ = unsafe { Box::from_raw(o.contents.err) };
1874                         o.contents.err = core::ptr::null_mut();
1875                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
1876                 };
1877                 Self {
1878                         contents,
1879                         result_ok: o.result_ok,
1880                 }
1881         }
1882 }
1883 impl Clone for CResult_SharedSecretNoneZ {
1884         fn clone(&self) -> Self {
1885                 if self.result_ok {
1886                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
1887                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1888                         } }
1889                 } else {
1890                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
1891                                 err: core::ptr::null_mut()
1892                         } }
1893                 }
1894         }
1895 }
1896 #[no_mangle]
1897 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
1898 /// but with all dynamically-allocated buffers duplicated in new buffers.
1899 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
1900 #[repr(C)]
1901 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
1902 /// This corresponds to std::vector in C++
1903 pub struct CVec_U5Z {
1904         /// The elements in the array.
1905         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1906         pub data: *mut crate::c_types::U5,
1907         /// The number of elements pointed to by `data`.
1908         pub datalen: usize
1909 }
1910 impl CVec_U5Z {
1911         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
1912                 if self.datalen == 0 { return Vec::new(); }
1913                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1914                 self.data = core::ptr::null_mut();
1915                 self.datalen = 0;
1916                 ret
1917         }
1918         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
1919                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1920         }
1921 }
1922 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
1923         fn from(v: Vec<crate::c_types::U5>) -> Self {
1924                 let datalen = v.len();
1925                 let data = Box::into_raw(v.into_boxed_slice());
1926                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1927         }
1928 }
1929 #[no_mangle]
1930 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1931 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
1932 impl Drop for CVec_U5Z {
1933         fn drop(&mut self) {
1934                 if self.datalen == 0 { return; }
1935                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1936         }
1937 }
1938 impl Clone for CVec_U5Z {
1939         fn clone(&self) -> Self {
1940                 let mut res = Vec::new();
1941                 if self.datalen == 0 { return Self::from(res); }
1942                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1943                 Self::from(res)
1944         }
1945 }
1946 #[repr(C)]
1947 /// The contents of CResult_RecoverableSignatureNoneZ
1948 pub union CResult_RecoverableSignatureNoneZPtr {
1949         /// A pointer to the contents in the success state.
1950         /// Reading from this pointer when `result_ok` is not set is undefined.
1951         pub result: *mut crate::c_types::RecoverableSignature,
1952         /// Note that this value is always NULL, as there are no contents in the Err variant
1953         pub err: *mut core::ffi::c_void,
1954 }
1955 #[repr(C)]
1956 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
1957 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
1958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1959 pub struct CResult_RecoverableSignatureNoneZ {
1960         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
1961         /// `err` or `result` depending on the state of `result_ok`.
1962         pub contents: CResult_RecoverableSignatureNoneZPtr,
1963         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
1964         pub result_ok: bool,
1965 }
1966 #[no_mangle]
1967 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
1968 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
1969         CResult_RecoverableSignatureNoneZ {
1970                 contents: CResult_RecoverableSignatureNoneZPtr {
1971                         result: Box::into_raw(Box::new(o)),
1972                 },
1973                 result_ok: true,
1974         }
1975 }
1976 #[no_mangle]
1977 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
1978 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
1979         CResult_RecoverableSignatureNoneZ {
1980                 contents: CResult_RecoverableSignatureNoneZPtr {
1981                         err: core::ptr::null_mut(),
1982                 },
1983                 result_ok: false,
1984         }
1985 }
1986 /// Checks if the given object is currently in the success state
1987 #[no_mangle]
1988 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
1989         o.result_ok
1990 }
1991 #[no_mangle]
1992 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
1993 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
1994 impl Drop for CResult_RecoverableSignatureNoneZ {
1995         fn drop(&mut self) {
1996                 if self.result_ok {
1997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1999                         }
2000                 } else {
2001                 }
2002         }
2003 }
2004 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2005         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2006                 let contents = if o.result_ok {
2007                         let result = unsafe { o.contents.result };
2008                         unsafe { o.contents.result = core::ptr::null_mut() };
2009                         CResult_RecoverableSignatureNoneZPtr { result }
2010                 } else {
2011                         let _ = unsafe { Box::from_raw(o.contents.err) };
2012                         o.contents.err = core::ptr::null_mut();
2013                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2014                 };
2015                 Self {
2016                         contents,
2017                         result_ok: o.result_ok,
2018                 }
2019         }
2020 }
2021 impl Clone for CResult_RecoverableSignatureNoneZ {
2022         fn clone(&self) -> Self {
2023                 if self.result_ok {
2024                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2025                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2026                         } }
2027                 } else {
2028                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2029                                 err: core::ptr::null_mut()
2030                         } }
2031                 }
2032         }
2033 }
2034 #[no_mangle]
2035 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2036 /// but with all dynamically-allocated buffers duplicated in new buffers.
2037 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2038 #[repr(C)]
2039 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2040 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2041         /// A pointer to the contents in the success state.
2042         /// Reading from this pointer when `result_ok` is not set is undefined.
2043         pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2044         /// A pointer to the contents in the error state.
2045         /// Reading from this pointer when `result_ok` is set is undefined.
2046         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2047 }
2048 #[repr(C)]
2049 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2050 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2052 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2053         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2054         /// `err` or `result` depending on the state of `result_ok`.
2055         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2056         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2057         pub result_ok: bool,
2058 }
2059 #[no_mangle]
2060 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2061 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2062         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2063                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2064                         result: Box::into_raw(Box::new(o)),
2065                 },
2066                 result_ok: true,
2067         }
2068 }
2069 #[no_mangle]
2070 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2071 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2072         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2073                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2074                         err: Box::into_raw(Box::new(e)),
2075                 },
2076                 result_ok: false,
2077         }
2078 }
2079 /// Checks if the given object is currently in the success state
2080 #[no_mangle]
2081 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2082         o.result_ok
2083 }
2084 #[no_mangle]
2085 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2086 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2087 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2088         fn drop(&mut self) {
2089                 if self.result_ok {
2090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2092                         }
2093                 } else {
2094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2096                         }
2097                 }
2098         }
2099 }
2100 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2102                 let contents = if o.result_ok {
2103                         let result = unsafe { o.contents.result };
2104                         unsafe { o.contents.result = core::ptr::null_mut() };
2105                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2106                 } else {
2107                         let err = unsafe { o.contents.err };
2108                         unsafe { o.contents.err = core::ptr::null_mut(); }
2109                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2110                 };
2111                 Self {
2112                         contents,
2113                         result_ok: o.result_ok,
2114                 }
2115         }
2116 }
2117 #[repr(C)]
2118 /// The contents of CResult_ScriptNoneZ
2119 pub union CResult_ScriptNoneZPtr {
2120         /// A pointer to the contents in the success state.
2121         /// Reading from this pointer when `result_ok` is not set is undefined.
2122         pub result: *mut crate::c_types::derived::CVec_u8Z,
2123         /// Note that this value is always NULL, as there are no contents in the Err variant
2124         pub err: *mut core::ffi::c_void,
2125 }
2126 #[repr(C)]
2127 /// A CResult_ScriptNoneZ represents the result of a fallible operation,
2128 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2129 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2130 pub struct CResult_ScriptNoneZ {
2131         /// The contents of this CResult_ScriptNoneZ, accessible via either
2132         /// `err` or `result` depending on the state of `result_ok`.
2133         pub contents: CResult_ScriptNoneZPtr,
2134         /// Whether this CResult_ScriptNoneZ represents a success state.
2135         pub result_ok: bool,
2136 }
2137 #[no_mangle]
2138 /// Creates a new CResult_ScriptNoneZ in the success state.
2139 pub extern "C" fn CResult_ScriptNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_ScriptNoneZ {
2140         CResult_ScriptNoneZ {
2141                 contents: CResult_ScriptNoneZPtr {
2142                         result: Box::into_raw(Box::new(o)),
2143                 },
2144                 result_ok: true,
2145         }
2146 }
2147 #[no_mangle]
2148 /// Creates a new CResult_ScriptNoneZ in the error state.
2149 pub extern "C" fn CResult_ScriptNoneZ_err() -> CResult_ScriptNoneZ {
2150         CResult_ScriptNoneZ {
2151                 contents: CResult_ScriptNoneZPtr {
2152                         err: core::ptr::null_mut(),
2153                 },
2154                 result_ok: false,
2155         }
2156 }
2157 /// Checks if the given object is currently in the success state
2158 #[no_mangle]
2159 pub extern "C" fn CResult_ScriptNoneZ_is_ok(o: &CResult_ScriptNoneZ) -> bool {
2160         o.result_ok
2161 }
2162 #[no_mangle]
2163 /// Frees any resources used by the CResult_ScriptNoneZ.
2164 pub extern "C" fn CResult_ScriptNoneZ_free(_res: CResult_ScriptNoneZ) { }
2165 impl Drop for CResult_ScriptNoneZ {
2166         fn drop(&mut self) {
2167                 if self.result_ok {
2168                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2169                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2170                         }
2171                 } else {
2172                 }
2173         }
2174 }
2175 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_ScriptNoneZ {
2176         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2177                 let contents = if o.result_ok {
2178                         let result = unsafe { o.contents.result };
2179                         unsafe { o.contents.result = core::ptr::null_mut() };
2180                         CResult_ScriptNoneZPtr { result }
2181                 } else {
2182                         let _ = unsafe { Box::from_raw(o.contents.err) };
2183                         o.contents.err = core::ptr::null_mut();
2184                         CResult_ScriptNoneZPtr { err: core::ptr::null_mut() }
2185                 };
2186                 Self {
2187                         contents,
2188                         result_ok: o.result_ok,
2189                 }
2190         }
2191 }
2192 impl Clone for CResult_ScriptNoneZ {
2193         fn clone(&self) -> Self {
2194                 if self.result_ok {
2195                         Self { result_ok: true, contents: CResult_ScriptNoneZPtr {
2196                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2197                         } }
2198                 } else {
2199                         Self { result_ok: false, contents: CResult_ScriptNoneZPtr {
2200                                 err: core::ptr::null_mut()
2201                         } }
2202                 }
2203         }
2204 }
2205 #[no_mangle]
2206 /// Creates a new CResult_ScriptNoneZ which has the same data as `orig`
2207 /// but with all dynamically-allocated buffers duplicated in new buffers.
2208 pub extern "C" fn CResult_ScriptNoneZ_clone(orig: &CResult_ScriptNoneZ) -> CResult_ScriptNoneZ { Clone::clone(&orig) }
2209 #[repr(C)]
2210 /// The contents of CResult_ShutdownScriptNoneZ
2211 pub union CResult_ShutdownScriptNoneZPtr {
2212         /// A pointer to the contents in the success state.
2213         /// Reading from this pointer when `result_ok` is not set is undefined.
2214         pub result: *mut crate::lightning::ln::script::ShutdownScript,
2215         /// Note that this value is always NULL, as there are no contents in the Err variant
2216         pub err: *mut core::ffi::c_void,
2217 }
2218 #[repr(C)]
2219 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2220 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2222 pub struct CResult_ShutdownScriptNoneZ {
2223         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2224         /// `err` or `result` depending on the state of `result_ok`.
2225         pub contents: CResult_ShutdownScriptNoneZPtr,
2226         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2227         pub result_ok: bool,
2228 }
2229 #[no_mangle]
2230 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2231 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2232         CResult_ShutdownScriptNoneZ {
2233                 contents: CResult_ShutdownScriptNoneZPtr {
2234                         result: Box::into_raw(Box::new(o)),
2235                 },
2236                 result_ok: true,
2237         }
2238 }
2239 #[no_mangle]
2240 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2241 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2242         CResult_ShutdownScriptNoneZ {
2243                 contents: CResult_ShutdownScriptNoneZPtr {
2244                         err: core::ptr::null_mut(),
2245                 },
2246                 result_ok: false,
2247         }
2248 }
2249 /// Checks if the given object is currently in the success state
2250 #[no_mangle]
2251 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2252         o.result_ok
2253 }
2254 #[no_mangle]
2255 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2256 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2257 impl Drop for CResult_ShutdownScriptNoneZ {
2258         fn drop(&mut self) {
2259                 if self.result_ok {
2260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2262                         }
2263                 } else {
2264                 }
2265         }
2266 }
2267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2268         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2269                 let contents = if o.result_ok {
2270                         let result = unsafe { o.contents.result };
2271                         unsafe { o.contents.result = core::ptr::null_mut() };
2272                         CResult_ShutdownScriptNoneZPtr { result }
2273                 } else {
2274                         let _ = unsafe { Box::from_raw(o.contents.err) };
2275                         o.contents.err = core::ptr::null_mut();
2276                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2277                 };
2278                 Self {
2279                         contents,
2280                         result_ok: o.result_ok,
2281                 }
2282         }
2283 }
2284 impl Clone for CResult_ShutdownScriptNoneZ {
2285         fn clone(&self) -> Self {
2286                 if self.result_ok {
2287                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2288                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2289                         } }
2290                 } else {
2291                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2292                                 err: core::ptr::null_mut()
2293                         } }
2294                 }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2299 /// but with all dynamically-allocated buffers duplicated in new buffers.
2300 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2301 #[repr(C)]
2302 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2303 /// This corresponds to std::vector in C++
2304 pub struct CVec_CVec_u8ZZ {
2305         /// The elements in the array.
2306         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2307         pub data: *mut crate::c_types::derived::CVec_u8Z,
2308         /// The number of elements pointed to by `data`.
2309         pub datalen: usize
2310 }
2311 impl CVec_CVec_u8ZZ {
2312         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2313                 if self.datalen == 0 { return Vec::new(); }
2314                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2315                 self.data = core::ptr::null_mut();
2316                 self.datalen = 0;
2317                 ret
2318         }
2319         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2320                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2321         }
2322 }
2323 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2324         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2325                 let datalen = v.len();
2326                 let data = Box::into_raw(v.into_boxed_slice());
2327                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2328         }
2329 }
2330 #[no_mangle]
2331 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2332 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2333 impl Drop for CVec_CVec_u8ZZ {
2334         fn drop(&mut self) {
2335                 if self.datalen == 0 { return; }
2336                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2337         }
2338 }
2339 impl Clone for CVec_CVec_u8ZZ {
2340         fn clone(&self) -> Self {
2341                 let mut res = Vec::new();
2342                 if self.datalen == 0 { return Self::from(res); }
2343                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2344                 Self::from(res)
2345         }
2346 }
2347 #[repr(C)]
2348 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
2349 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
2350         /// A pointer to the contents in the success state.
2351         /// Reading from this pointer when `result_ok` is not set is undefined.
2352         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
2353         /// Note that this value is always NULL, as there are no contents in the Err variant
2354         pub err: *mut core::ffi::c_void,
2355 }
2356 #[repr(C)]
2357 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
2358 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
2359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2360 pub struct CResult_CVec_CVec_u8ZZNoneZ {
2361         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
2362         /// `err` or `result` depending on the state of `result_ok`.
2363         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
2364         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
2365         pub result_ok: bool,
2366 }
2367 #[no_mangle]
2368 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
2369 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
2370         CResult_CVec_CVec_u8ZZNoneZ {
2371                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2372                         result: Box::into_raw(Box::new(o)),
2373                 },
2374                 result_ok: true,
2375         }
2376 }
2377 #[no_mangle]
2378 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
2379 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
2380         CResult_CVec_CVec_u8ZZNoneZ {
2381                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2382                         err: core::ptr::null_mut(),
2383                 },
2384                 result_ok: false,
2385         }
2386 }
2387 /// Checks if the given object is currently in the success state
2388 #[no_mangle]
2389 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
2390         o.result_ok
2391 }
2392 #[no_mangle]
2393 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
2394 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
2395 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
2396         fn drop(&mut self) {
2397                 if self.result_ok {
2398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2400                         }
2401                 } else {
2402                 }
2403         }
2404 }
2405 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
2406         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
2407                 let contents = if o.result_ok {
2408                         let result = unsafe { o.contents.result };
2409                         unsafe { o.contents.result = core::ptr::null_mut() };
2410                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
2411                 } else {
2412                         let _ = unsafe { Box::from_raw(o.contents.err) };
2413                         o.contents.err = core::ptr::null_mut();
2414                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
2415                 };
2416                 Self {
2417                         contents,
2418                         result_ok: o.result_ok,
2419                 }
2420         }
2421 }
2422 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
2423         fn clone(&self) -> Self {
2424                 if self.result_ok {
2425                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2426                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
2427                         } }
2428                 } else {
2429                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2430                                 err: core::ptr::null_mut()
2431                         } }
2432                 }
2433         }
2434 }
2435 #[no_mangle]
2436 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
2437 /// but with all dynamically-allocated buffers duplicated in new buffers.
2438 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
2439 #[repr(C)]
2440 /// The contents of CResult_InMemorySignerDecodeErrorZ
2441 pub union CResult_InMemorySignerDecodeErrorZPtr {
2442         /// A pointer to the contents in the success state.
2443         /// Reading from this pointer when `result_ok` is not set is undefined.
2444         pub result: *mut crate::lightning::sign::InMemorySigner,
2445         /// A pointer to the contents in the error state.
2446         /// Reading from this pointer when `result_ok` is set is undefined.
2447         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2448 }
2449 #[repr(C)]
2450 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
2451 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2453 pub struct CResult_InMemorySignerDecodeErrorZ {
2454         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
2455         /// `err` or `result` depending on the state of `result_ok`.
2456         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
2457         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
2458         pub result_ok: bool,
2459 }
2460 #[no_mangle]
2461 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
2462 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
2463         CResult_InMemorySignerDecodeErrorZ {
2464                 contents: CResult_InMemorySignerDecodeErrorZPtr {
2465                         result: Box::into_raw(Box::new(o)),
2466                 },
2467                 result_ok: true,
2468         }
2469 }
2470 #[no_mangle]
2471 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
2472 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
2473         CResult_InMemorySignerDecodeErrorZ {
2474                 contents: CResult_InMemorySignerDecodeErrorZPtr {
2475                         err: Box::into_raw(Box::new(e)),
2476                 },
2477                 result_ok: false,
2478         }
2479 }
2480 /// Checks if the given object is currently in the success state
2481 #[no_mangle]
2482 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
2483         o.result_ok
2484 }
2485 #[no_mangle]
2486 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
2487 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
2488 impl Drop for CResult_InMemorySignerDecodeErrorZ {
2489         fn drop(&mut self) {
2490                 if self.result_ok {
2491                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2492                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2493                         }
2494                 } else {
2495                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2496                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2497                         }
2498                 }
2499         }
2500 }
2501 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
2502         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2503                 let contents = if o.result_ok {
2504                         let result = unsafe { o.contents.result };
2505                         unsafe { o.contents.result = core::ptr::null_mut() };
2506                         CResult_InMemorySignerDecodeErrorZPtr { result }
2507                 } else {
2508                         let err = unsafe { o.contents.err };
2509                         unsafe { o.contents.err = core::ptr::null_mut(); }
2510                         CResult_InMemorySignerDecodeErrorZPtr { err }
2511                 };
2512                 Self {
2513                         contents,
2514                         result_ok: o.result_ok,
2515                 }
2516         }
2517 }
2518 impl Clone for CResult_InMemorySignerDecodeErrorZ {
2519         fn clone(&self) -> Self {
2520                 if self.result_ok {
2521                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
2522                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
2523                         } }
2524                 } else {
2525                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
2526                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2527                         } }
2528                 }
2529         }
2530 }
2531 #[no_mangle]
2532 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
2533 /// but with all dynamically-allocated buffers duplicated in new buffers.
2534 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
2535 #[repr(C)]
2536 /// The contents of CResult_PartiallySignedTransactionNoneZ
2537 pub union CResult_PartiallySignedTransactionNoneZPtr {
2538         /// A pointer to the contents in the success state.
2539         /// Reading from this pointer when `result_ok` is not set is undefined.
2540         pub result: *mut crate::c_types::derived::CVec_u8Z,
2541         /// Note that this value is always NULL, as there are no contents in the Err variant
2542         pub err: *mut core::ffi::c_void,
2543 }
2544 #[repr(C)]
2545 /// A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation,
2546 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2548 pub struct CResult_PartiallySignedTransactionNoneZ {
2549         /// The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either
2550         /// `err` or `result` depending on the state of `result_ok`.
2551         pub contents: CResult_PartiallySignedTransactionNoneZPtr,
2552         /// Whether this CResult_PartiallySignedTransactionNoneZ represents a success state.
2553         pub result_ok: bool,
2554 }
2555 #[no_mangle]
2556 /// Creates a new CResult_PartiallySignedTransactionNoneZ in the success state.
2557 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_PartiallySignedTransactionNoneZ {
2558         CResult_PartiallySignedTransactionNoneZ {
2559                 contents: CResult_PartiallySignedTransactionNoneZPtr {
2560                         result: Box::into_raw(Box::new(o)),
2561                 },
2562                 result_ok: true,
2563         }
2564 }
2565 #[no_mangle]
2566 /// Creates a new CResult_PartiallySignedTransactionNoneZ in the error state.
2567 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_err() -> CResult_PartiallySignedTransactionNoneZ {
2568         CResult_PartiallySignedTransactionNoneZ {
2569                 contents: CResult_PartiallySignedTransactionNoneZPtr {
2570                         err: core::ptr::null_mut(),
2571                 },
2572                 result_ok: false,
2573         }
2574 }
2575 /// Checks if the given object is currently in the success state
2576 #[no_mangle]
2577 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_is_ok(o: &CResult_PartiallySignedTransactionNoneZ) -> bool {
2578         o.result_ok
2579 }
2580 #[no_mangle]
2581 /// Frees any resources used by the CResult_PartiallySignedTransactionNoneZ.
2582 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_free(_res: CResult_PartiallySignedTransactionNoneZ) { }
2583 impl Drop for CResult_PartiallySignedTransactionNoneZ {
2584         fn drop(&mut self) {
2585                 if self.result_ok {
2586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2588                         }
2589                 } else {
2590                 }
2591         }
2592 }
2593 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_PartiallySignedTransactionNoneZ {
2594         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2595                 let contents = if o.result_ok {
2596                         let result = unsafe { o.contents.result };
2597                         unsafe { o.contents.result = core::ptr::null_mut() };
2598                         CResult_PartiallySignedTransactionNoneZPtr { result }
2599                 } else {
2600                         let _ = unsafe { Box::from_raw(o.contents.err) };
2601                         o.contents.err = core::ptr::null_mut();
2602                         CResult_PartiallySignedTransactionNoneZPtr { err: core::ptr::null_mut() }
2603                 };
2604                 Self {
2605                         contents,
2606                         result_ok: o.result_ok,
2607                 }
2608         }
2609 }
2610 impl Clone for CResult_PartiallySignedTransactionNoneZ {
2611         fn clone(&self) -> Self {
2612                 if self.result_ok {
2613                         Self { result_ok: true, contents: CResult_PartiallySignedTransactionNoneZPtr {
2614                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2615                         } }
2616                 } else {
2617                         Self { result_ok: false, contents: CResult_PartiallySignedTransactionNoneZPtr {
2618                                 err: core::ptr::null_mut()
2619                         } }
2620                 }
2621         }
2622 }
2623 #[no_mangle]
2624 /// Creates a new CResult_PartiallySignedTransactionNoneZ which has the same data as `orig`
2625 /// but with all dynamically-allocated buffers duplicated in new buffers.
2626 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_clone(orig: &CResult_PartiallySignedTransactionNoneZ) -> CResult_PartiallySignedTransactionNoneZ { Clone::clone(&orig) }
2627 #[repr(C)]
2628 /// The contents of CResult_TransactionNoneZ
2629 pub union CResult_TransactionNoneZPtr {
2630         /// A pointer to the contents in the success state.
2631         /// Reading from this pointer when `result_ok` is not set is undefined.
2632         pub result: *mut crate::c_types::Transaction,
2633         /// Note that this value is always NULL, as there are no contents in the Err variant
2634         pub err: *mut core::ffi::c_void,
2635 }
2636 #[repr(C)]
2637 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2638 /// containing a crate::c_types::Transaction on success and a () on failure.
2639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2640 pub struct CResult_TransactionNoneZ {
2641         /// The contents of this CResult_TransactionNoneZ, accessible via either
2642         /// `err` or `result` depending on the state of `result_ok`.
2643         pub contents: CResult_TransactionNoneZPtr,
2644         /// Whether this CResult_TransactionNoneZ represents a success state.
2645         pub result_ok: bool,
2646 }
2647 #[no_mangle]
2648 /// Creates a new CResult_TransactionNoneZ in the success state.
2649 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2650         CResult_TransactionNoneZ {
2651                 contents: CResult_TransactionNoneZPtr {
2652                         result: Box::into_raw(Box::new(o)),
2653                 },
2654                 result_ok: true,
2655         }
2656 }
2657 #[no_mangle]
2658 /// Creates a new CResult_TransactionNoneZ in the error state.
2659 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2660         CResult_TransactionNoneZ {
2661                 contents: CResult_TransactionNoneZPtr {
2662                         err: core::ptr::null_mut(),
2663                 },
2664                 result_ok: false,
2665         }
2666 }
2667 /// Checks if the given object is currently in the success state
2668 #[no_mangle]
2669 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2670         o.result_ok
2671 }
2672 #[no_mangle]
2673 /// Frees any resources used by the CResult_TransactionNoneZ.
2674 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2675 impl Drop for CResult_TransactionNoneZ {
2676         fn drop(&mut self) {
2677                 if self.result_ok {
2678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2680                         }
2681                 } else {
2682                 }
2683         }
2684 }
2685 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2686         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> 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_TransactionNoneZPtr { result }
2691                 } else {
2692                         let _ = unsafe { Box::from_raw(o.contents.err) };
2693                         o.contents.err = core::ptr::null_mut();
2694                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2695                 };
2696                 Self {
2697                         contents,
2698                         result_ok: o.result_ok,
2699                 }
2700         }
2701 }
2702 impl Clone for CResult_TransactionNoneZ {
2703         fn clone(&self) -> Self {
2704                 if self.result_ok {
2705                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2706                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2707                         } }
2708                 } else {
2709                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2710                                 err: core::ptr::null_mut()
2711                         } }
2712                 }
2713         }
2714 }
2715 #[no_mangle]
2716 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2717 /// but with all dynamically-allocated buffers duplicated in new buffers.
2718 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2719 #[repr(C)]
2720 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2721 pub enum COption_WriteableScoreZ {
2722         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2723         Some(crate::lightning::routing::scoring::WriteableScore),
2724         /// When we're in this state, this COption_WriteableScoreZ contains nothing
2725         None
2726 }
2727 impl COption_WriteableScoreZ {
2728         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2729                 if let Self::None = self { false } else { true }
2730         }
2731         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2732                 !self.is_some()
2733         }
2734         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2735                 if let Self::Some(v) = self { v } else { unreachable!() }
2736         }
2737 }
2738 #[no_mangle]
2739 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2740 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2741         COption_WriteableScoreZ::Some(o)
2742 }
2743 #[no_mangle]
2744 /// Constructs a new COption_WriteableScoreZ containing nothing
2745 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2746         COption_WriteableScoreZ::None
2747 }
2748 #[no_mangle]
2749 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2750 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2751 #[repr(C)]
2752 /// The contents of CResult_NoneErrorZ
2753 pub union CResult_NoneErrorZPtr {
2754         /// Note that this value is always NULL, as there are no contents in the OK variant
2755         pub result: *mut core::ffi::c_void,
2756         /// A pointer to the contents in the error state.
2757         /// Reading from this pointer when `result_ok` is set is undefined.
2758         pub err: *mut crate::c_types::IOError,
2759 }
2760 #[repr(C)]
2761 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2762 /// containing a () on success and a crate::c_types::IOError on failure.
2763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2764 pub struct CResult_NoneErrorZ {
2765         /// The contents of this CResult_NoneErrorZ, accessible via either
2766         /// `err` or `result` depending on the state of `result_ok`.
2767         pub contents: CResult_NoneErrorZPtr,
2768         /// Whether this CResult_NoneErrorZ represents a success state.
2769         pub result_ok: bool,
2770 }
2771 #[no_mangle]
2772 /// Creates a new CResult_NoneErrorZ in the success state.
2773 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2774         CResult_NoneErrorZ {
2775                 contents: CResult_NoneErrorZPtr {
2776                         result: core::ptr::null_mut(),
2777                 },
2778                 result_ok: true,
2779         }
2780 }
2781 #[no_mangle]
2782 /// Creates a new CResult_NoneErrorZ in the error state.
2783 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2784         CResult_NoneErrorZ {
2785                 contents: CResult_NoneErrorZPtr {
2786                         err: Box::into_raw(Box::new(e)),
2787                 },
2788                 result_ok: false,
2789         }
2790 }
2791 /// Checks if the given object is currently in the success state
2792 #[no_mangle]
2793 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2794         o.result_ok
2795 }
2796 #[no_mangle]
2797 /// Frees any resources used by the CResult_NoneErrorZ.
2798 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2799 impl Drop for CResult_NoneErrorZ {
2800         fn drop(&mut self) {
2801                 if self.result_ok {
2802                 } else {
2803                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2804                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2805                         }
2806                 }
2807         }
2808 }
2809 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2810         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2811                 let contents = if o.result_ok {
2812                         let _ = unsafe { Box::from_raw(o.contents.result) };
2813                         o.contents.result = core::ptr::null_mut();
2814                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2815                 } else {
2816                         let err = unsafe { o.contents.err };
2817                         unsafe { o.contents.err = core::ptr::null_mut(); }
2818                         CResult_NoneErrorZPtr { err }
2819                 };
2820                 Self {
2821                         contents,
2822                         result_ok: o.result_ok,
2823                 }
2824         }
2825 }
2826 impl Clone for CResult_NoneErrorZ {
2827         fn clone(&self) -> Self {
2828                 if self.result_ok {
2829                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2830                                 result: core::ptr::null_mut()
2831                         } }
2832                 } else {
2833                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2834                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2835                         } }
2836                 }
2837         }
2838 }
2839 #[no_mangle]
2840 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2841 /// but with all dynamically-allocated buffers duplicated in new buffers.
2842 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2843 #[repr(C)]
2844 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2845 /// This corresponds to std::vector in C++
2846 pub struct CVec_ChannelDetailsZ {
2847         /// The elements in the array.
2848         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2849         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2850         /// The number of elements pointed to by `data`.
2851         pub datalen: usize
2852 }
2853 impl CVec_ChannelDetailsZ {
2854         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2855                 if self.datalen == 0 { return Vec::new(); }
2856                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2857                 self.data = core::ptr::null_mut();
2858                 self.datalen = 0;
2859                 ret
2860         }
2861         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2862                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2863         }
2864 }
2865 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2866         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2867                 let datalen = v.len();
2868                 let data = Box::into_raw(v.into_boxed_slice());
2869                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2870         }
2871 }
2872 #[no_mangle]
2873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2874 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2875 impl Drop for CVec_ChannelDetailsZ {
2876         fn drop(&mut self) {
2877                 if self.datalen == 0 { return; }
2878                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2879         }
2880 }
2881 impl Clone for CVec_ChannelDetailsZ {
2882         fn clone(&self) -> Self {
2883                 let mut res = Vec::new();
2884                 if self.datalen == 0 { return Self::from(res); }
2885                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2886                 Self::from(res)
2887         }
2888 }
2889 #[repr(C)]
2890 /// The contents of CResult_RouteLightningErrorZ
2891 pub union CResult_RouteLightningErrorZPtr {
2892         /// A pointer to the contents in the success state.
2893         /// Reading from this pointer when `result_ok` is not set is undefined.
2894         pub result: *mut crate::lightning::routing::router::Route,
2895         /// A pointer to the contents in the error state.
2896         /// Reading from this pointer when `result_ok` is set is undefined.
2897         pub err: *mut crate::lightning::ln::msgs::LightningError,
2898 }
2899 #[repr(C)]
2900 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2901 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2903 pub struct CResult_RouteLightningErrorZ {
2904         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2905         /// `err` or `result` depending on the state of `result_ok`.
2906         pub contents: CResult_RouteLightningErrorZPtr,
2907         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2908         pub result_ok: bool,
2909 }
2910 #[no_mangle]
2911 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2912 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2913         CResult_RouteLightningErrorZ {
2914                 contents: CResult_RouteLightningErrorZPtr {
2915                         result: Box::into_raw(Box::new(o)),
2916                 },
2917                 result_ok: true,
2918         }
2919 }
2920 #[no_mangle]
2921 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2922 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2923         CResult_RouteLightningErrorZ {
2924                 contents: CResult_RouteLightningErrorZPtr {
2925                         err: Box::into_raw(Box::new(e)),
2926                 },
2927                 result_ok: false,
2928         }
2929 }
2930 /// Checks if the given object is currently in the success state
2931 #[no_mangle]
2932 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2933         o.result_ok
2934 }
2935 #[no_mangle]
2936 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2937 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2938 impl Drop for CResult_RouteLightningErrorZ {
2939         fn drop(&mut self) {
2940                 if self.result_ok {
2941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2943                         }
2944                 } else {
2945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2947                         }
2948                 }
2949         }
2950 }
2951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2953                 let contents = if o.result_ok {
2954                         let result = unsafe { o.contents.result };
2955                         unsafe { o.contents.result = core::ptr::null_mut() };
2956                         CResult_RouteLightningErrorZPtr { result }
2957                 } else {
2958                         let err = unsafe { o.contents.err };
2959                         unsafe { o.contents.err = core::ptr::null_mut(); }
2960                         CResult_RouteLightningErrorZPtr { err }
2961                 };
2962                 Self {
2963                         contents,
2964                         result_ok: o.result_ok,
2965                 }
2966         }
2967 }
2968 impl Clone for CResult_RouteLightningErrorZ {
2969         fn clone(&self) -> Self {
2970                 if self.result_ok {
2971                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2972                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2973                         } }
2974                 } else {
2975                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2977                         } }
2978                 }
2979         }
2980 }
2981 #[no_mangle]
2982 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2983 /// but with all dynamically-allocated buffers duplicated in new buffers.
2984 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2985 #[repr(C)]
2986 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2987 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2988         /// A pointer to the contents in the success state.
2989         /// Reading from this pointer when `result_ok` is not set is undefined.
2990         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2991         /// A pointer to the contents in the error state.
2992         /// Reading from this pointer when `result_ok` is set is undefined.
2993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2994 }
2995 #[repr(C)]
2996 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2997 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2999 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3000         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3001         /// `err` or `result` depending on the state of `result_ok`.
3002         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3003         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3004         pub result_ok: bool,
3005 }
3006 #[no_mangle]
3007 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3008 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3009         CResult_InFlightHtlcsDecodeErrorZ {
3010                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3011                         result: Box::into_raw(Box::new(o)),
3012                 },
3013                 result_ok: true,
3014         }
3015 }
3016 #[no_mangle]
3017 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3018 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3019         CResult_InFlightHtlcsDecodeErrorZ {
3020                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3021                         err: Box::into_raw(Box::new(e)),
3022                 },
3023                 result_ok: false,
3024         }
3025 }
3026 /// Checks if the given object is currently in the success state
3027 #[no_mangle]
3028 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3029         o.result_ok
3030 }
3031 #[no_mangle]
3032 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3033 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3034 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3035         fn drop(&mut self) {
3036                 if self.result_ok {
3037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3039                         }
3040                 } else {
3041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3043                         }
3044                 }
3045         }
3046 }
3047 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3049                 let contents = if o.result_ok {
3050                         let result = unsafe { o.contents.result };
3051                         unsafe { o.contents.result = core::ptr::null_mut() };
3052                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
3053                 } else {
3054                         let err = unsafe { o.contents.err };
3055                         unsafe { o.contents.err = core::ptr::null_mut(); }
3056                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
3057                 };
3058                 Self {
3059                         contents,
3060                         result_ok: o.result_ok,
3061                 }
3062         }
3063 }
3064 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3065         fn clone(&self) -> Self {
3066                 if self.result_ok {
3067                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3068                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3069                         } }
3070                 } else {
3071                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3073                         } }
3074                 }
3075         }
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3079 /// but with all dynamically-allocated buffers duplicated in new buffers.
3080 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3081 #[repr(C)]
3082 /// The contents of CResult_RouteHopDecodeErrorZ
3083 pub union CResult_RouteHopDecodeErrorZPtr {
3084         /// A pointer to the contents in the success state.
3085         /// Reading from this pointer when `result_ok` is not set is undefined.
3086         pub result: *mut crate::lightning::routing::router::RouteHop,
3087         /// A pointer to the contents in the error state.
3088         /// Reading from this pointer when `result_ok` is set is undefined.
3089         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3090 }
3091 #[repr(C)]
3092 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3093 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3095 pub struct CResult_RouteHopDecodeErrorZ {
3096         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3097         /// `err` or `result` depending on the state of `result_ok`.
3098         pub contents: CResult_RouteHopDecodeErrorZPtr,
3099         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3100         pub result_ok: bool,
3101 }
3102 #[no_mangle]
3103 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3104 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3105         CResult_RouteHopDecodeErrorZ {
3106                 contents: CResult_RouteHopDecodeErrorZPtr {
3107                         result: Box::into_raw(Box::new(o)),
3108                 },
3109                 result_ok: true,
3110         }
3111 }
3112 #[no_mangle]
3113 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3114 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3115         CResult_RouteHopDecodeErrorZ {
3116                 contents: CResult_RouteHopDecodeErrorZPtr {
3117                         err: Box::into_raw(Box::new(e)),
3118                 },
3119                 result_ok: false,
3120         }
3121 }
3122 /// Checks if the given object is currently in the success state
3123 #[no_mangle]
3124 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3125         o.result_ok
3126 }
3127 #[no_mangle]
3128 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3129 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3130 impl Drop for CResult_RouteHopDecodeErrorZ {
3131         fn drop(&mut self) {
3132                 if self.result_ok {
3133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3135                         }
3136                 } else {
3137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3139                         }
3140                 }
3141         }
3142 }
3143 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3144         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3145                 let contents = if o.result_ok {
3146                         let result = unsafe { o.contents.result };
3147                         unsafe { o.contents.result = core::ptr::null_mut() };
3148                         CResult_RouteHopDecodeErrorZPtr { result }
3149                 } else {
3150                         let err = unsafe { o.contents.err };
3151                         unsafe { o.contents.err = core::ptr::null_mut(); }
3152                         CResult_RouteHopDecodeErrorZPtr { err }
3153                 };
3154                 Self {
3155                         contents,
3156                         result_ok: o.result_ok,
3157                 }
3158         }
3159 }
3160 impl Clone for CResult_RouteHopDecodeErrorZ {
3161         fn clone(&self) -> Self {
3162                 if self.result_ok {
3163                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3164                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3165                         } }
3166                 } else {
3167                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3168                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3169                         } }
3170                 }
3171         }
3172 }
3173 #[no_mangle]
3174 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3175 /// but with all dynamically-allocated buffers duplicated in new buffers.
3176 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3177 #[repr(C)]
3178 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3179 /// This corresponds to std::vector in C++
3180 pub struct CVec_BlindedHopZ {
3181         /// The elements in the array.
3182         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3183         pub data: *mut crate::lightning::blinded_path::BlindedHop,
3184         /// The number of elements pointed to by `data`.
3185         pub datalen: usize
3186 }
3187 impl CVec_BlindedHopZ {
3188         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3189                 if self.datalen == 0 { return Vec::new(); }
3190                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3191                 self.data = core::ptr::null_mut();
3192                 self.datalen = 0;
3193                 ret
3194         }
3195         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3196                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3197         }
3198 }
3199 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3200         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3201                 let datalen = v.len();
3202                 let data = Box::into_raw(v.into_boxed_slice());
3203                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3204         }
3205 }
3206 #[no_mangle]
3207 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3208 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3209 impl Drop for CVec_BlindedHopZ {
3210         fn drop(&mut self) {
3211                 if self.datalen == 0 { return; }
3212                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3213         }
3214 }
3215 impl Clone for CVec_BlindedHopZ {
3216         fn clone(&self) -> Self {
3217                 let mut res = Vec::new();
3218                 if self.datalen == 0 { return Self::from(res); }
3219                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3220                 Self::from(res)
3221         }
3222 }
3223 #[repr(C)]
3224 /// The contents of CResult_BlindedTailDecodeErrorZ
3225 pub union CResult_BlindedTailDecodeErrorZPtr {
3226         /// A pointer to the contents in the success state.
3227         /// Reading from this pointer when `result_ok` is not set is undefined.
3228         pub result: *mut crate::lightning::routing::router::BlindedTail,
3229         /// A pointer to the contents in the error state.
3230         /// Reading from this pointer when `result_ok` is set is undefined.
3231         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3232 }
3233 #[repr(C)]
3234 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3235 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3237 pub struct CResult_BlindedTailDecodeErrorZ {
3238         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3239         /// `err` or `result` depending on the state of `result_ok`.
3240         pub contents: CResult_BlindedTailDecodeErrorZPtr,
3241         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3242         pub result_ok: bool,
3243 }
3244 #[no_mangle]
3245 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3246 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3247         CResult_BlindedTailDecodeErrorZ {
3248                 contents: CResult_BlindedTailDecodeErrorZPtr {
3249                         result: Box::into_raw(Box::new(o)),
3250                 },
3251                 result_ok: true,
3252         }
3253 }
3254 #[no_mangle]
3255 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3256 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3257         CResult_BlindedTailDecodeErrorZ {
3258                 contents: CResult_BlindedTailDecodeErrorZPtr {
3259                         err: Box::into_raw(Box::new(e)),
3260                 },
3261                 result_ok: false,
3262         }
3263 }
3264 /// Checks if the given object is currently in the success state
3265 #[no_mangle]
3266 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3267         o.result_ok
3268 }
3269 #[no_mangle]
3270 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3271 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3272 impl Drop for CResult_BlindedTailDecodeErrorZ {
3273         fn drop(&mut self) {
3274                 if self.result_ok {
3275                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3276                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3277                         }
3278                 } else {
3279                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3280                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3281                         }
3282                 }
3283         }
3284 }
3285 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3286         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3287                 let contents = if o.result_ok {
3288                         let result = unsafe { o.contents.result };
3289                         unsafe { o.contents.result = core::ptr::null_mut() };
3290                         CResult_BlindedTailDecodeErrorZPtr { result }
3291                 } else {
3292                         let err = unsafe { o.contents.err };
3293                         unsafe { o.contents.err = core::ptr::null_mut(); }
3294                         CResult_BlindedTailDecodeErrorZPtr { err }
3295                 };
3296                 Self {
3297                         contents,
3298                         result_ok: o.result_ok,
3299                 }
3300         }
3301 }
3302 impl Clone for CResult_BlindedTailDecodeErrorZ {
3303         fn clone(&self) -> Self {
3304                 if self.result_ok {
3305                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3306                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3307                         } }
3308                 } else {
3309                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3310                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3311                         } }
3312                 }
3313         }
3314 }
3315 #[no_mangle]
3316 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3317 /// but with all dynamically-allocated buffers duplicated in new buffers.
3318 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3319 #[repr(C)]
3320 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3321 /// This corresponds to std::vector in C++
3322 pub struct CVec_RouteHopZ {
3323         /// The elements in the array.
3324         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3325         pub data: *mut crate::lightning::routing::router::RouteHop,
3326         /// The number of elements pointed to by `data`.
3327         pub datalen: usize
3328 }
3329 impl CVec_RouteHopZ {
3330         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3331                 if self.datalen == 0 { return Vec::new(); }
3332                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3333                 self.data = core::ptr::null_mut();
3334                 self.datalen = 0;
3335                 ret
3336         }
3337         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3338                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3339         }
3340 }
3341 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3342         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3343                 let datalen = v.len();
3344                 let data = Box::into_raw(v.into_boxed_slice());
3345                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3346         }
3347 }
3348 #[no_mangle]
3349 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3350 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3351 impl Drop for CVec_RouteHopZ {
3352         fn drop(&mut self) {
3353                 if self.datalen == 0 { return; }
3354                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3355         }
3356 }
3357 impl Clone for CVec_RouteHopZ {
3358         fn clone(&self) -> Self {
3359                 let mut res = Vec::new();
3360                 if self.datalen == 0 { return Self::from(res); }
3361                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3362                 Self::from(res)
3363         }
3364 }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a u32 or not
3368 pub enum COption_u32Z {
3369         /// When we're in this state, this COption_u32Z contains a u32
3370         Some(u32),
3371         /// When we're in this state, this COption_u32Z contains nothing
3372         None
3373 }
3374 impl COption_u32Z {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_u32Z containing a u32
3387 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
3388         COption_u32Z::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_u32Z containing nothing
3392 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
3393         COption_u32Z::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the u32, if we are in the Some state
3397 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
3398 #[no_mangle]
3399 /// Creates a new COption_u32Z which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_PathZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::routing::router::Path,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_PathZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3425         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3434 impl Drop for CVec_PathZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_PathZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 /// The contents of CResult_RouteDecodeErrorZ
3450 pub union CResult_RouteDecodeErrorZPtr {
3451         /// A pointer to the contents in the success state.
3452         /// Reading from this pointer when `result_ok` is not set is undefined.
3453         pub result: *mut crate::lightning::routing::router::Route,
3454         /// A pointer to the contents in the error state.
3455         /// Reading from this pointer when `result_ok` is set is undefined.
3456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3457 }
3458 #[repr(C)]
3459 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3460 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3462 pub struct CResult_RouteDecodeErrorZ {
3463         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3464         /// `err` or `result` depending on the state of `result_ok`.
3465         pub contents: CResult_RouteDecodeErrorZPtr,
3466         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3467         pub result_ok: bool,
3468 }
3469 #[no_mangle]
3470 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3471 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3472         CResult_RouteDecodeErrorZ {
3473                 contents: CResult_RouteDecodeErrorZPtr {
3474                         result: Box::into_raw(Box::new(o)),
3475                 },
3476                 result_ok: true,
3477         }
3478 }
3479 #[no_mangle]
3480 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3481 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3482         CResult_RouteDecodeErrorZ {
3483                 contents: CResult_RouteDecodeErrorZPtr {
3484                         err: Box::into_raw(Box::new(e)),
3485                 },
3486                 result_ok: false,
3487         }
3488 }
3489 /// Checks if the given object is currently in the success state
3490 #[no_mangle]
3491 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
3492         o.result_ok
3493 }
3494 #[no_mangle]
3495 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3496 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3497 impl Drop for CResult_RouteDecodeErrorZ {
3498         fn drop(&mut self) {
3499                 if self.result_ok {
3500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3502                         }
3503                 } else {
3504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3506                         }
3507                 }
3508         }
3509 }
3510 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3512                 let contents = if o.result_ok {
3513                         let result = unsafe { o.contents.result };
3514                         unsafe { o.contents.result = core::ptr::null_mut() };
3515                         CResult_RouteDecodeErrorZPtr { result }
3516                 } else {
3517                         let err = unsafe { o.contents.err };
3518                         unsafe { o.contents.err = core::ptr::null_mut(); }
3519                         CResult_RouteDecodeErrorZPtr { err }
3520                 };
3521                 Self {
3522                         contents,
3523                         result_ok: o.result_ok,
3524                 }
3525         }
3526 }
3527 impl Clone for CResult_RouteDecodeErrorZ {
3528         fn clone(&self) -> Self {
3529                 if self.result_ok {
3530                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3531                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3532                         } }
3533                 } else {
3534                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3536                         } }
3537                 }
3538         }
3539 }
3540 #[no_mangle]
3541 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3542 /// but with all dynamically-allocated buffers duplicated in new buffers.
3543 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
3544 #[repr(C)]
3545 /// The contents of CResult_RouteParametersDecodeErrorZ
3546 pub union CResult_RouteParametersDecodeErrorZPtr {
3547         /// A pointer to the contents in the success state.
3548         /// Reading from this pointer when `result_ok` is not set is undefined.
3549         pub result: *mut crate::lightning::routing::router::RouteParameters,
3550         /// A pointer to the contents in the error state.
3551         /// Reading from this pointer when `result_ok` is set is undefined.
3552         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3553 }
3554 #[repr(C)]
3555 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
3556 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3558 pub struct CResult_RouteParametersDecodeErrorZ {
3559         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
3560         /// `err` or `result` depending on the state of `result_ok`.
3561         pub contents: CResult_RouteParametersDecodeErrorZPtr,
3562         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
3563         pub result_ok: bool,
3564 }
3565 #[no_mangle]
3566 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
3567 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
3568         CResult_RouteParametersDecodeErrorZ {
3569                 contents: CResult_RouteParametersDecodeErrorZPtr {
3570                         result: Box::into_raw(Box::new(o)),
3571                 },
3572                 result_ok: true,
3573         }
3574 }
3575 #[no_mangle]
3576 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
3577 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
3578         CResult_RouteParametersDecodeErrorZ {
3579                 contents: CResult_RouteParametersDecodeErrorZPtr {
3580                         err: Box::into_raw(Box::new(e)),
3581                 },
3582                 result_ok: false,
3583         }
3584 }
3585 /// Checks if the given object is currently in the success state
3586 #[no_mangle]
3587 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
3588         o.result_ok
3589 }
3590 #[no_mangle]
3591 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
3592 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
3593 impl Drop for CResult_RouteParametersDecodeErrorZ {
3594         fn drop(&mut self) {
3595                 if self.result_ok {
3596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3598                         }
3599                 } else {
3600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3602                         }
3603                 }
3604         }
3605 }
3606 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
3607         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3608                 let contents = if o.result_ok {
3609                         let result = unsafe { o.contents.result };
3610                         unsafe { o.contents.result = core::ptr::null_mut() };
3611                         CResult_RouteParametersDecodeErrorZPtr { result }
3612                 } else {
3613                         let err = unsafe { o.contents.err };
3614                         unsafe { o.contents.err = core::ptr::null_mut(); }
3615                         CResult_RouteParametersDecodeErrorZPtr { err }
3616                 };
3617                 Self {
3618                         contents,
3619                         result_ok: o.result_ok,
3620                 }
3621         }
3622 }
3623 impl Clone for CResult_RouteParametersDecodeErrorZ {
3624         fn clone(&self) -> Self {
3625                 if self.result_ok {
3626                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
3627                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
3628                         } }
3629                 } else {
3630                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
3631                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3632                         } }
3633                 }
3634         }
3635 }
3636 #[no_mangle]
3637 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3638 /// but with all dynamically-allocated buffers duplicated in new buffers.
3639 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3640 #[repr(C)]
3641 /// A dynamically-allocated array of u64s of arbitrary size.
3642 /// This corresponds to std::vector in C++
3643 pub struct CVec_u64Z {
3644         /// The elements in the array.
3645         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3646         pub data: *mut u64,
3647         /// The number of elements pointed to by `data`.
3648         pub datalen: usize
3649 }
3650 impl CVec_u64Z {
3651         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3652                 if self.datalen == 0 { return Vec::new(); }
3653                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3654                 self.data = core::ptr::null_mut();
3655                 self.datalen = 0;
3656                 ret
3657         }
3658         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3659                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3660         }
3661 }
3662 impl From<Vec<u64>> for CVec_u64Z {
3663         fn from(v: Vec<u64>) -> Self {
3664                 let datalen = v.len();
3665                 let data = Box::into_raw(v.into_boxed_slice());
3666                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3667         }
3668 }
3669 #[no_mangle]
3670 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3671 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
3672 impl Drop for CVec_u64Z {
3673         fn drop(&mut self) {
3674                 if self.datalen == 0 { return; }
3675                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3676         }
3677 }
3678 impl Clone for CVec_u64Z {
3679         fn clone(&self) -> Self {
3680                 let mut res = Vec::new();
3681                 if self.datalen == 0 { return Self::from(res); }
3682                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3683                 Self::from(res)
3684         }
3685 }
3686 #[repr(C)]
3687 /// The contents of CResult_PaymentParametersDecodeErrorZ
3688 pub union CResult_PaymentParametersDecodeErrorZPtr {
3689         /// A pointer to the contents in the success state.
3690         /// Reading from this pointer when `result_ok` is not set is undefined.
3691         pub result: *mut crate::lightning::routing::router::PaymentParameters,
3692         /// A pointer to the contents in the error state.
3693         /// Reading from this pointer when `result_ok` is set is undefined.
3694         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3695 }
3696 #[repr(C)]
3697 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3698 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3699 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3700 pub struct CResult_PaymentParametersDecodeErrorZ {
3701         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3702         /// `err` or `result` depending on the state of `result_ok`.
3703         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
3704         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3705         pub result_ok: bool,
3706 }
3707 #[no_mangle]
3708 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
3709 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
3710         CResult_PaymentParametersDecodeErrorZ {
3711                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3712                         result: Box::into_raw(Box::new(o)),
3713                 },
3714                 result_ok: true,
3715         }
3716 }
3717 #[no_mangle]
3718 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
3719 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
3720         CResult_PaymentParametersDecodeErrorZ {
3721                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3722                         err: Box::into_raw(Box::new(e)),
3723                 },
3724                 result_ok: false,
3725         }
3726 }
3727 /// Checks if the given object is currently in the success state
3728 #[no_mangle]
3729 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
3730         o.result_ok
3731 }
3732 #[no_mangle]
3733 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
3734 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
3735 impl Drop for CResult_PaymentParametersDecodeErrorZ {
3736         fn drop(&mut self) {
3737                 if self.result_ok {
3738                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3739                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3740                         }
3741                 } else {
3742                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3743                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3744                         }
3745                 }
3746         }
3747 }
3748 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
3749         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3750                 let contents = if o.result_ok {
3751                         let result = unsafe { o.contents.result };
3752                         unsafe { o.contents.result = core::ptr::null_mut() };
3753                         CResult_PaymentParametersDecodeErrorZPtr { result }
3754                 } else {
3755                         let err = unsafe { o.contents.err };
3756                         unsafe { o.contents.err = core::ptr::null_mut(); }
3757                         CResult_PaymentParametersDecodeErrorZPtr { err }
3758                 };
3759                 Self {
3760                         contents,
3761                         result_ok: o.result_ok,
3762                 }
3763         }
3764 }
3765 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3766         fn clone(&self) -> Self {
3767                 if self.result_ok {
3768                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3769                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3770                         } }
3771                 } else {
3772                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3773                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3774                         } }
3775                 }
3776         }
3777 }
3778 #[no_mangle]
3779 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3780 /// but with all dynamically-allocated buffers duplicated in new buffers.
3781 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3782 #[repr(C)]
3783 /// A tuple of 2 elements. See the individual fields for the types contained.
3784 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3785         /// The element at position 0
3786         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3787         /// The element at position 1
3788         pub b: crate::lightning::blinded_path::BlindedPath,
3789 }
3790 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3791         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3792                 Self {
3793                         a: tup.0,
3794                         b: tup.1,
3795                 }
3796         }
3797 }
3798 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3799         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3800                 (self.a, self.b)
3801         }
3802 }
3803 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3804         fn clone(&self) -> Self {
3805                 Self {
3806                         a: Clone::clone(&self.a),
3807                         b: Clone::clone(&self.b),
3808                 }
3809         }
3810 }
3811 #[no_mangle]
3812 /// Creates a new tuple which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3815 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3816 #[no_mangle]
3817 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3818         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3819 }
3820
3821 #[no_mangle]
3822 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3823 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3824 #[repr(C)]
3825 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3826 /// This corresponds to std::vector in C++
3827 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3828         /// The elements in the array.
3829         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3830         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3831         /// The number of elements pointed to by `data`.
3832         pub datalen: usize
3833 }
3834 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3835         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3836                 if self.datalen == 0 { return Vec::new(); }
3837                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3838                 self.data = core::ptr::null_mut();
3839                 self.datalen = 0;
3840                 ret
3841         }
3842         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3843                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3844         }
3845 }
3846 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3847         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3848                 let datalen = v.len();
3849                 let data = Box::into_raw(v.into_boxed_slice());
3850                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3851         }
3852 }
3853 #[no_mangle]
3854 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3855 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3856 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3857         fn drop(&mut self) {
3858                 if self.datalen == 0 { return; }
3859                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3860         }
3861 }
3862 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3863         fn clone(&self) -> Self {
3864                 let mut res = Vec::new();
3865                 if self.datalen == 0 { return Self::from(res); }
3866                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3867                 Self::from(res)
3868         }
3869 }
3870 #[repr(C)]
3871 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3872 /// This corresponds to std::vector in C++
3873 pub struct CVec_RouteHintZ {
3874         /// The elements in the array.
3875         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3876         pub data: *mut crate::lightning::routing::router::RouteHint,
3877         /// The number of elements pointed to by `data`.
3878         pub datalen: usize
3879 }
3880 impl CVec_RouteHintZ {
3881         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
3882                 if self.datalen == 0 { return Vec::new(); }
3883                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3884                 self.data = core::ptr::null_mut();
3885                 self.datalen = 0;
3886                 ret
3887         }
3888         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
3889                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3890         }
3891 }
3892 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
3893         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
3894                 let datalen = v.len();
3895                 let data = Box::into_raw(v.into_boxed_slice());
3896                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3897         }
3898 }
3899 #[no_mangle]
3900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3901 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3902 impl Drop for CVec_RouteHintZ {
3903         fn drop(&mut self) {
3904                 if self.datalen == 0 { return; }
3905                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3906         }
3907 }
3908 impl Clone for CVec_RouteHintZ {
3909         fn clone(&self) -> Self {
3910                 let mut res = Vec::new();
3911                 if self.datalen == 0 { return Self::from(res); }
3912                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3913                 Self::from(res)
3914         }
3915 }
3916 #[repr(C)]
3917 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3918 /// This corresponds to std::vector in C++
3919 pub struct CVec_RouteHintHopZ {
3920         /// The elements in the array.
3921         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3922         pub data: *mut crate::lightning::routing::router::RouteHintHop,
3923         /// The number of elements pointed to by `data`.
3924         pub datalen: usize
3925 }
3926 impl CVec_RouteHintHopZ {
3927         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3928                 if self.datalen == 0 { return Vec::new(); }
3929                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3930                 self.data = core::ptr::null_mut();
3931                 self.datalen = 0;
3932                 ret
3933         }
3934         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3935                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3936         }
3937 }
3938 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3939         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3940                 let datalen = v.len();
3941                 let data = Box::into_raw(v.into_boxed_slice());
3942                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3943         }
3944 }
3945 #[no_mangle]
3946 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3947 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3948 impl Drop for CVec_RouteHintHopZ {
3949         fn drop(&mut self) {
3950                 if self.datalen == 0 { return; }
3951                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3952         }
3953 }
3954 impl Clone for CVec_RouteHintHopZ {
3955         fn clone(&self) -> Self {
3956                 let mut res = Vec::new();
3957                 if self.datalen == 0 { return Self::from(res); }
3958                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3959                 Self::from(res)
3960         }
3961 }
3962 #[repr(C)]
3963 /// The contents of CResult_RouteHintDecodeErrorZ
3964 pub union CResult_RouteHintDecodeErrorZPtr {
3965         /// A pointer to the contents in the success state.
3966         /// Reading from this pointer when `result_ok` is not set is undefined.
3967         pub result: *mut crate::lightning::routing::router::RouteHint,
3968         /// A pointer to the contents in the error state.
3969         /// Reading from this pointer when `result_ok` is set is undefined.
3970         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3971 }
3972 #[repr(C)]
3973 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3974 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3976 pub struct CResult_RouteHintDecodeErrorZ {
3977         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3978         /// `err` or `result` depending on the state of `result_ok`.
3979         pub contents: CResult_RouteHintDecodeErrorZPtr,
3980         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3981         pub result_ok: bool,
3982 }
3983 #[no_mangle]
3984 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3985 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3986         CResult_RouteHintDecodeErrorZ {
3987                 contents: CResult_RouteHintDecodeErrorZPtr {
3988                         result: Box::into_raw(Box::new(o)),
3989                 },
3990                 result_ok: true,
3991         }
3992 }
3993 #[no_mangle]
3994 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3995 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3996         CResult_RouteHintDecodeErrorZ {
3997                 contents: CResult_RouteHintDecodeErrorZPtr {
3998                         err: Box::into_raw(Box::new(e)),
3999                 },
4000                 result_ok: false,
4001         }
4002 }
4003 /// Checks if the given object is currently in the success state
4004 #[no_mangle]
4005 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4006         o.result_ok
4007 }
4008 #[no_mangle]
4009 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4010 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4011 impl Drop for CResult_RouteHintDecodeErrorZ {
4012         fn drop(&mut self) {
4013                 if self.result_ok {
4014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4016                         }
4017                 } else {
4018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4020                         }
4021                 }
4022         }
4023 }
4024 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4026                 let contents = if o.result_ok {
4027                         let result = unsafe { o.contents.result };
4028                         unsafe { o.contents.result = core::ptr::null_mut() };
4029                         CResult_RouteHintDecodeErrorZPtr { result }
4030                 } else {
4031                         let err = unsafe { o.contents.err };
4032                         unsafe { o.contents.err = core::ptr::null_mut(); }
4033                         CResult_RouteHintDecodeErrorZPtr { err }
4034                 };
4035                 Self {
4036                         contents,
4037                         result_ok: o.result_ok,
4038                 }
4039         }
4040 }
4041 impl Clone for CResult_RouteHintDecodeErrorZ {
4042         fn clone(&self) -> Self {
4043                 if self.result_ok {
4044                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4045                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4046                         } }
4047                 } else {
4048                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4050                         } }
4051                 }
4052         }
4053 }
4054 #[no_mangle]
4055 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4056 /// but with all dynamically-allocated buffers duplicated in new buffers.
4057 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4058 #[repr(C)]
4059 /// The contents of CResult_RouteHintHopDecodeErrorZ
4060 pub union CResult_RouteHintHopDecodeErrorZPtr {
4061         /// A pointer to the contents in the success state.
4062         /// Reading from this pointer when `result_ok` is not set is undefined.
4063         pub result: *mut crate::lightning::routing::router::RouteHintHop,
4064         /// A pointer to the contents in the error state.
4065         /// Reading from this pointer when `result_ok` is set is undefined.
4066         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4067 }
4068 #[repr(C)]
4069 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4070 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4072 pub struct CResult_RouteHintHopDecodeErrorZ {
4073         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4074         /// `err` or `result` depending on the state of `result_ok`.
4075         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4076         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4077         pub result_ok: bool,
4078 }
4079 #[no_mangle]
4080 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4081 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4082         CResult_RouteHintHopDecodeErrorZ {
4083                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4084                         result: Box::into_raw(Box::new(o)),
4085                 },
4086                 result_ok: true,
4087         }
4088 }
4089 #[no_mangle]
4090 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4091 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4092         CResult_RouteHintHopDecodeErrorZ {
4093                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4094                         err: Box::into_raw(Box::new(e)),
4095                 },
4096                 result_ok: false,
4097         }
4098 }
4099 /// Checks if the given object is currently in the success state
4100 #[no_mangle]
4101 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4102         o.result_ok
4103 }
4104 #[no_mangle]
4105 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4106 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4107 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4108         fn drop(&mut self) {
4109                 if self.result_ok {
4110                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4111                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4112                         }
4113                 } else {
4114                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4115                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4116                         }
4117                 }
4118         }
4119 }
4120 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4121         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4122                 let contents = if o.result_ok {
4123                         let result = unsafe { o.contents.result };
4124                         unsafe { o.contents.result = core::ptr::null_mut() };
4125                         CResult_RouteHintHopDecodeErrorZPtr { result }
4126                 } else {
4127                         let err = unsafe { o.contents.err };
4128                         unsafe { o.contents.err = core::ptr::null_mut(); }
4129                         CResult_RouteHintHopDecodeErrorZPtr { err }
4130                 };
4131                 Self {
4132                         contents,
4133                         result_ok: o.result_ok,
4134                 }
4135         }
4136 }
4137 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4138         fn clone(&self) -> Self {
4139                 if self.result_ok {
4140                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4141                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4142                         } }
4143                 } else {
4144                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4145                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4146                         } }
4147                 }
4148         }
4149 }
4150 #[no_mangle]
4151 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4152 /// but with all dynamically-allocated buffers duplicated in new buffers.
4153 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4154 #[repr(C)]
4155 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4156 /// This corresponds to std::vector in C++
4157 pub struct CVec_PublicKeyZ {
4158         /// The elements in the array.
4159         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4160         pub data: *mut crate::c_types::PublicKey,
4161         /// The number of elements pointed to by `data`.
4162         pub datalen: usize
4163 }
4164 impl CVec_PublicKeyZ {
4165         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4166                 if self.datalen == 0 { return Vec::new(); }
4167                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4168                 self.data = core::ptr::null_mut();
4169                 self.datalen = 0;
4170                 ret
4171         }
4172         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4173                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4174         }
4175 }
4176 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4177         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4178                 let datalen = v.len();
4179                 let data = Box::into_raw(v.into_boxed_slice());
4180                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4181         }
4182 }
4183 #[no_mangle]
4184 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4185 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4186 impl Drop for CVec_PublicKeyZ {
4187         fn drop(&mut self) {
4188                 if self.datalen == 0 { return; }
4189                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4190         }
4191 }
4192 impl Clone for CVec_PublicKeyZ {
4193         fn clone(&self) -> Self {
4194                 let mut res = Vec::new();
4195                 if self.datalen == 0 { return Self::from(res); }
4196                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4197                 Self::from(res)
4198         }
4199 }
4200 #[repr(C)]
4201 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4202 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4203         /// A pointer to the contents in the success state.
4204         /// Reading from this pointer when `result_ok` is not set is undefined.
4205         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4206         /// A pointer to the contents in the error state.
4207         /// Reading from this pointer when `result_ok` is set is undefined.
4208         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4209 }
4210 #[repr(C)]
4211 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4212 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4214 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4215         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4216         /// `err` or `result` depending on the state of `result_ok`.
4217         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4218         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4219         pub result_ok: bool,
4220 }
4221 #[no_mangle]
4222 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4223 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4224         CResult_FixedPenaltyScorerDecodeErrorZ {
4225                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4226                         result: Box::into_raw(Box::new(o)),
4227                 },
4228                 result_ok: true,
4229         }
4230 }
4231 #[no_mangle]
4232 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4233 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4234         CResult_FixedPenaltyScorerDecodeErrorZ {
4235                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4236                         err: Box::into_raw(Box::new(e)),
4237                 },
4238                 result_ok: false,
4239         }
4240 }
4241 /// Checks if the given object is currently in the success state
4242 #[no_mangle]
4243 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4244         o.result_ok
4245 }
4246 #[no_mangle]
4247 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4248 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4249 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4250         fn drop(&mut self) {
4251                 if self.result_ok {
4252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4254                         }
4255                 } else {
4256                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4257                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4258                         }
4259                 }
4260         }
4261 }
4262 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4263         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4264                 let contents = if o.result_ok {
4265                         let result = unsafe { o.contents.result };
4266                         unsafe { o.contents.result = core::ptr::null_mut() };
4267                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4268                 } else {
4269                         let err = unsafe { o.contents.err };
4270                         unsafe { o.contents.err = core::ptr::null_mut(); }
4271                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4272                 };
4273                 Self {
4274                         contents,
4275                         result_ok: o.result_ok,
4276                 }
4277         }
4278 }
4279 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4280         fn clone(&self) -> Self {
4281                 if self.result_ok {
4282                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4283                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4284                         } }
4285                 } else {
4286                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4287                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4288                         } }
4289                 }
4290         }
4291 }
4292 #[no_mangle]
4293 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4294 /// but with all dynamically-allocated buffers duplicated in new buffers.
4295 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4296 #[repr(C)]
4297 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4298 /// This corresponds to std::vector in C++
4299 pub struct CVec_NodeIdZ {
4300         /// The elements in the array.
4301         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4302         pub data: *mut crate::lightning::routing::gossip::NodeId,
4303         /// The number of elements pointed to by `data`.
4304         pub datalen: usize
4305 }
4306 impl CVec_NodeIdZ {
4307         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4308                 if self.datalen == 0 { return Vec::new(); }
4309                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4310                 self.data = core::ptr::null_mut();
4311                 self.datalen = 0;
4312                 ret
4313         }
4314         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4315                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4316         }
4317 }
4318 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4319         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4320                 let datalen = v.len();
4321                 let data = Box::into_raw(v.into_boxed_slice());
4322                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4323         }
4324 }
4325 #[no_mangle]
4326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4327 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4328 impl Drop for CVec_NodeIdZ {
4329         fn drop(&mut self) {
4330                 if self.datalen == 0 { return; }
4331                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4332         }
4333 }
4334 impl Clone for CVec_NodeIdZ {
4335         fn clone(&self) -> Self {
4336                 let mut res = Vec::new();
4337                 if self.datalen == 0 { return Self::from(res); }
4338                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4339                 Self::from(res)
4340         }
4341 }
4342 #[repr(C)]
4343 /// A tuple of 2 elements. See the individual fields for the types contained.
4344 pub struct C2Tuple_u64u64Z {
4345         /// The element at position 0
4346         pub a: u64,
4347         /// The element at position 1
4348         pub b: u64,
4349 }
4350 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4351         fn from (tup: (u64, u64)) -> Self {
4352                 Self {
4353                         a: tup.0,
4354                         b: tup.1,
4355                 }
4356         }
4357 }
4358 impl C2Tuple_u64u64Z {
4359         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4360                 (self.a, self.b)
4361         }
4362 }
4363 impl Clone for C2Tuple_u64u64Z {
4364         fn clone(&self) -> Self {
4365                 Self {
4366                         a: Clone::clone(&self.a),
4367                         b: Clone::clone(&self.b),
4368                 }
4369         }
4370 }
4371 #[no_mangle]
4372 /// Creates a new tuple which has the same data as `orig`
4373 /// but with all dynamically-allocated buffers duplicated in new buffers.
4374 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4375 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4376 #[no_mangle]
4377 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4378         C2Tuple_u64u64Z { a, b, }
4379 }
4380
4381 #[no_mangle]
4382 /// Frees any resources used by the C2Tuple_u64u64Z.
4383 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4384 #[repr(C)]
4385 #[derive(Clone)]
4386 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4387 pub enum COption_C2Tuple_u64u64ZZ {
4388         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4389         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4390         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4391         None
4392 }
4393 impl COption_C2Tuple_u64u64ZZ {
4394         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4395                 if let Self::None = self { false } else { true }
4396         }
4397         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4398                 !self.is_some()
4399         }
4400         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4401                 if let Self::Some(v) = self { v } else { unreachable!() }
4402         }
4403 }
4404 #[no_mangle]
4405 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4406 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4407         COption_C2Tuple_u64u64ZZ::Some(o)
4408 }
4409 #[no_mangle]
4410 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4411 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4412         COption_C2Tuple_u64u64ZZ::None
4413 }
4414 #[no_mangle]
4415 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4416 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4417 #[no_mangle]
4418 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4419 /// but with all dynamically-allocated buffers duplicated in new buffers.
4420 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4421 #[repr(C)]
4422 /// A tuple of 2 elements. See the individual fields for the types contained.
4423 pub struct C2Tuple_Z {
4424         /// The element at position 0
4425         pub a: crate::c_types::EightU16s,
4426         /// The element at position 1
4427         pub b: crate::c_types::EightU16s,
4428 }
4429 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4430         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4431                 Self {
4432                         a: tup.0,
4433                         b: tup.1,
4434                 }
4435         }
4436 }
4437 impl C2Tuple_Z {
4438         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4439                 (self.a, self.b)
4440         }
4441 }
4442 impl Clone for C2Tuple_Z {
4443         fn clone(&self) -> Self {
4444                 Self {
4445                         a: Clone::clone(&self.a),
4446                         b: Clone::clone(&self.b),
4447                 }
4448         }
4449 }
4450 #[no_mangle]
4451 /// Creates a new tuple which has the same data as `orig`
4452 /// but with all dynamically-allocated buffers duplicated in new buffers.
4453 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4454 /// Creates a new C2Tuple_Z from the contained elements.
4455 #[no_mangle]
4456 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4457         C2Tuple_Z { a, b, }
4458 }
4459
4460 #[no_mangle]
4461 /// Frees any resources used by the C2Tuple_Z.
4462 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4463 #[repr(C)]
4464 /// A tuple of 2 elements. See the individual fields for the types contained.
4465 pub struct C2Tuple__u168_u168Z {
4466         /// The element at position 0
4467         pub a: crate::c_types::EightU16s,
4468         /// The element at position 1
4469         pub b: crate::c_types::EightU16s,
4470 }
4471 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4472         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4473                 Self {
4474                         a: tup.0,
4475                         b: tup.1,
4476                 }
4477         }
4478 }
4479 impl C2Tuple__u168_u168Z {
4480         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4481                 (self.a, self.b)
4482         }
4483 }
4484 impl Clone for C2Tuple__u168_u168Z {
4485         fn clone(&self) -> Self {
4486                 Self {
4487                         a: Clone::clone(&self.a),
4488                         b: Clone::clone(&self.b),
4489                 }
4490         }
4491 }
4492 #[no_mangle]
4493 /// Creates a new tuple which has the same data as `orig`
4494 /// but with all dynamically-allocated buffers duplicated in new buffers.
4495 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4496 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4497 #[no_mangle]
4498 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4499         C2Tuple__u168_u168Z { a, b, }
4500 }
4501
4502 #[no_mangle]
4503 /// Frees any resources used by the C2Tuple__u168_u168Z.
4504 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4505 #[repr(C)]
4506 #[derive(Clone)]
4507 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4508 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4509         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4510         Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4511         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4512         None
4513 }
4514 impl COption_C2Tuple_EightU16sEightU16sZZ {
4515         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4516                 if let Self::None = self { false } else { true }
4517         }
4518         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4519                 !self.is_some()
4520         }
4521         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4522                 if let Self::Some(v) = self { v } else { unreachable!() }
4523         }
4524 }
4525 #[no_mangle]
4526 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4527 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4528         COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4529 }
4530 #[no_mangle]
4531 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4532 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4533         COption_C2Tuple_EightU16sEightU16sZZ::None
4534 }
4535 #[no_mangle]
4536 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4537 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4538 #[no_mangle]
4539 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4542 #[repr(C)]
4543 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4544 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4545         /// A pointer to the contents in the success state.
4546         /// Reading from this pointer when `result_ok` is not set is undefined.
4547         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4548         /// A pointer to the contents in the error state.
4549         /// Reading from this pointer when `result_ok` is set is undefined.
4550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4551 }
4552 #[repr(C)]
4553 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4554 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4556 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4557         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4558         /// `err` or `result` depending on the state of `result_ok`.
4559         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4560         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4561         pub result_ok: bool,
4562 }
4563 #[no_mangle]
4564 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4565 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4566         CResult_ProbabilisticScorerDecodeErrorZ {
4567                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4568                         result: Box::into_raw(Box::new(o)),
4569                 },
4570                 result_ok: true,
4571         }
4572 }
4573 #[no_mangle]
4574 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4575 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4576         CResult_ProbabilisticScorerDecodeErrorZ {
4577                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4578                         err: Box::into_raw(Box::new(e)),
4579                 },
4580                 result_ok: false,
4581         }
4582 }
4583 /// Checks if the given object is currently in the success state
4584 #[no_mangle]
4585 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4586         o.result_ok
4587 }
4588 #[no_mangle]
4589 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4590 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4591 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4592         fn drop(&mut self) {
4593                 if self.result_ok {
4594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4596                         }
4597                 } else {
4598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4600                         }
4601                 }
4602         }
4603 }
4604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4606                 let contents = if o.result_ok {
4607                         let result = unsafe { o.contents.result };
4608                         unsafe { o.contents.result = core::ptr::null_mut() };
4609                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4610                 } else {
4611                         let err = unsafe { o.contents.err };
4612                         unsafe { o.contents.err = core::ptr::null_mut(); }
4613                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4614                 };
4615                 Self {
4616                         contents,
4617                         result_ok: o.result_ok,
4618                 }
4619         }
4620 }
4621 #[repr(C)]
4622 /// A tuple of 2 elements. See the individual fields for the types contained.
4623 pub struct C2Tuple_usizeTransactionZ {
4624         /// The element at position 0
4625         pub a: usize,
4626         /// The element at position 1
4627         pub b: crate::c_types::Transaction,
4628 }
4629 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4630         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4631                 Self {
4632                         a: tup.0,
4633                         b: tup.1,
4634                 }
4635         }
4636 }
4637 impl C2Tuple_usizeTransactionZ {
4638         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4639                 (self.a, self.b)
4640         }
4641 }
4642 impl Clone for C2Tuple_usizeTransactionZ {
4643         fn clone(&self) -> Self {
4644                 Self {
4645                         a: Clone::clone(&self.a),
4646                         b: Clone::clone(&self.b),
4647                 }
4648         }
4649 }
4650 #[no_mangle]
4651 /// Creates a new tuple which has the same data as `orig`
4652 /// but with all dynamically-allocated buffers duplicated in new buffers.
4653 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4654 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4655 #[no_mangle]
4656 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4657         C2Tuple_usizeTransactionZ { a, b, }
4658 }
4659
4660 #[no_mangle]
4661 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
4662 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
4663 #[repr(C)]
4664 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4665 /// This corresponds to std::vector in C++
4666 pub struct CVec_C2Tuple_usizeTransactionZZ {
4667         /// The elements in the array.
4668         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4669         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
4670         /// The number of elements pointed to by `data`.
4671         pub datalen: usize
4672 }
4673 impl CVec_C2Tuple_usizeTransactionZZ {
4674         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
4675                 if self.datalen == 0 { return Vec::new(); }
4676                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4677                 self.data = core::ptr::null_mut();
4678                 self.datalen = 0;
4679                 ret
4680         }
4681         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
4682                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4683         }
4684 }
4685 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
4686         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
4687                 let datalen = v.len();
4688                 let data = Box::into_raw(v.into_boxed_slice());
4689                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4690         }
4691 }
4692 #[no_mangle]
4693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4694 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
4695 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
4696         fn drop(&mut self) {
4697                 if self.datalen == 0 { return; }
4698                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4699         }
4700 }
4701 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
4702         fn clone(&self) -> Self {
4703                 let mut res = Vec::new();
4704                 if self.datalen == 0 { return Self::from(res); }
4705                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4706                 Self::from(res)
4707         }
4708 }
4709 #[repr(C)]
4710 #[derive(Clone)]
4711 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
4712 pub enum COption_BlockHashZ {
4713         /// When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes
4714         Some(crate::c_types::ThirtyTwoBytes),
4715         /// When we're in this state, this COption_BlockHashZ contains nothing
4716         None
4717 }
4718 impl COption_BlockHashZ {
4719         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4720                 if let Self::None = self { false } else { true }
4721         }
4722         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4723                 !self.is_some()
4724         }
4725         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
4726                 if let Self::Some(v) = self { v } else { unreachable!() }
4727         }
4728 }
4729 #[no_mangle]
4730 /// Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes
4731 pub extern "C" fn COption_BlockHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_BlockHashZ {
4732         COption_BlockHashZ::Some(o)
4733 }
4734 #[no_mangle]
4735 /// Constructs a new COption_BlockHashZ containing nothing
4736 pub extern "C" fn COption_BlockHashZ_none() -> COption_BlockHashZ {
4737         COption_BlockHashZ::None
4738 }
4739 #[no_mangle]
4740 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
4741 pub extern "C" fn COption_BlockHashZ_free(_res: COption_BlockHashZ) { }
4742 #[no_mangle]
4743 /// Creates a new COption_BlockHashZ which has the same data as `orig`
4744 /// but with all dynamically-allocated buffers duplicated in new buffers.
4745 pub extern "C" fn COption_BlockHashZ_clone(orig: &COption_BlockHashZ) -> COption_BlockHashZ { Clone::clone(&orig) }
4746 #[repr(C)]
4747 /// A tuple of 2 elements. See the individual fields for the types contained.
4748 pub struct C2Tuple_TxidCOption_BlockHashZZ {
4749         /// The element at position 0
4750         pub a: crate::c_types::ThirtyTwoBytes,
4751         /// The element at position 1
4752         pub b: crate::c_types::derived::COption_BlockHashZ,
4753 }
4754 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)> for C2Tuple_TxidCOption_BlockHashZZ {
4755         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)) -> Self {
4756                 Self {
4757                         a: tup.0,
4758                         b: tup.1,
4759                 }
4760         }
4761 }
4762 impl C2Tuple_TxidCOption_BlockHashZZ {
4763         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ) {
4764                 (self.a, self.b)
4765         }
4766 }
4767 impl Clone for C2Tuple_TxidCOption_BlockHashZZ {
4768         fn clone(&self) -> Self {
4769                 Self {
4770                         a: Clone::clone(&self.a),
4771                         b: Clone::clone(&self.b),
4772                 }
4773         }
4774 }
4775 #[no_mangle]
4776 /// Creates a new tuple which has the same data as `orig`
4777 /// but with all dynamically-allocated buffers duplicated in new buffers.
4778 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_clone(orig: &C2Tuple_TxidCOption_BlockHashZZ) -> C2Tuple_TxidCOption_BlockHashZZ { Clone::clone(&orig) }
4779 /// Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements.
4780 #[no_mangle]
4781 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_BlockHashZ) -> C2Tuple_TxidCOption_BlockHashZZ {
4782         C2Tuple_TxidCOption_BlockHashZZ { a, b, }
4783 }
4784
4785 #[no_mangle]
4786 /// Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ.
4787 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_free(_res: C2Tuple_TxidCOption_BlockHashZZ) { }
4788 #[repr(C)]
4789 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size.
4790 /// This corresponds to std::vector in C++
4791 pub struct CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4792         /// The elements in the array.
4793         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4794         pub data: *mut crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ,
4795         /// The number of elements pointed to by `data`.
4796         pub datalen: usize
4797 }
4798 impl CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4799         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ> {
4800                 if self.datalen == 0 { return Vec::new(); }
4801                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4802                 self.data = core::ptr::null_mut();
4803                 self.datalen = 0;
4804                 ret
4805         }
4806         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ] {
4807                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4808         }
4809 }
4810 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ>> for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4811         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ>) -> Self {
4812                 let datalen = v.len();
4813                 let data = Box::into_raw(v.into_boxed_slice());
4814                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4815         }
4816 }
4817 #[no_mangle]
4818 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4819 pub extern "C" fn CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res: CVec_C2Tuple_TxidCOption_BlockHashZZZ) { }
4820 impl Drop for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4821         fn drop(&mut self) {
4822                 if self.datalen == 0 { return; }
4823                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4824         }
4825 }
4826 impl Clone for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4827         fn clone(&self) -> Self {
4828                 let mut res = Vec::new();
4829                 if self.datalen == 0 { return Self::from(res); }
4830                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4831                 Self::from(res)
4832         }
4833 }
4834 #[repr(C)]
4835 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4836 /// This corresponds to std::vector in C++
4837 pub struct CVec_MonitorEventZ {
4838         /// The elements in the array.
4839         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4840         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4841         /// The number of elements pointed to by `data`.
4842         pub datalen: usize
4843 }
4844 impl CVec_MonitorEventZ {
4845         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4846                 if self.datalen == 0 { return Vec::new(); }
4847                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4848                 self.data = core::ptr::null_mut();
4849                 self.datalen = 0;
4850                 ret
4851         }
4852         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4853                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4854         }
4855 }
4856 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4857         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4858                 let datalen = v.len();
4859                 let data = Box::into_raw(v.into_boxed_slice());
4860                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4861         }
4862 }
4863 #[no_mangle]
4864 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4865 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4866 impl Drop for CVec_MonitorEventZ {
4867         fn drop(&mut self) {
4868                 if self.datalen == 0 { return; }
4869                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4870         }
4871 }
4872 impl Clone for CVec_MonitorEventZ {
4873         fn clone(&self) -> Self {
4874                 let mut res = Vec::new();
4875                 if self.datalen == 0 { return Self::from(res); }
4876                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4877                 Self::from(res)
4878         }
4879 }
4880 #[repr(C)]
4881 /// A tuple of 3 elements. See the individual fields for the types contained.
4882 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4883         /// The element at position 0
4884         pub a: crate::lightning::chain::transaction::OutPoint,
4885         /// The element at position 1
4886         pub b: crate::c_types::derived::CVec_MonitorEventZ,
4887         /// The element at position 2
4888         pub c: crate::c_types::PublicKey,
4889 }
4890 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4891         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4892                 Self {
4893                         a: tup.0,
4894                         b: tup.1,
4895                         c: tup.2,
4896                 }
4897         }
4898 }
4899 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4900         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4901                 (self.a, self.b, self.c)
4902         }
4903 }
4904 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4905         fn clone(&self) -> Self {
4906                 Self {
4907                         a: Clone::clone(&self.a),
4908                         b: Clone::clone(&self.b),
4909                         c: Clone::clone(&self.c),
4910                 }
4911         }
4912 }
4913 #[no_mangle]
4914 /// Creates a new tuple which has the same data as `orig`
4915 /// but with all dynamically-allocated buffers duplicated in new buffers.
4916 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4917 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4918 #[no_mangle]
4919 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 {
4920         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4921 }
4922
4923 #[no_mangle]
4924 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4925 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4926 #[repr(C)]
4927 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4928 /// This corresponds to std::vector in C++
4929 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4930         /// The elements in the array.
4931         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4932         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4933         /// The number of elements pointed to by `data`.
4934         pub datalen: usize
4935 }
4936 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4937         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4938                 if self.datalen == 0 { return Vec::new(); }
4939                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4940                 self.data = core::ptr::null_mut();
4941                 self.datalen = 0;
4942                 ret
4943         }
4944         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4945                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4946         }
4947 }
4948 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4949         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4950                 let datalen = v.len();
4951                 let data = Box::into_raw(v.into_boxed_slice());
4952                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4953         }
4954 }
4955 #[no_mangle]
4956 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4957 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4958 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4959         fn drop(&mut self) {
4960                 if self.datalen == 0 { return; }
4961                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4962         }
4963 }
4964 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4965         fn clone(&self) -> Self {
4966                 let mut res = Vec::new();
4967                 if self.datalen == 0 { return Self::from(res); }
4968                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4969                 Self::from(res)
4970         }
4971 }
4972 #[repr(C)]
4973 /// The contents of CResult_InitFeaturesDecodeErrorZ
4974 pub union CResult_InitFeaturesDecodeErrorZPtr {
4975         /// A pointer to the contents in the success state.
4976         /// Reading from this pointer when `result_ok` is not set is undefined.
4977         pub result: *mut crate::lightning::ln::features::InitFeatures,
4978         /// A pointer to the contents in the error state.
4979         /// Reading from this pointer when `result_ok` is set is undefined.
4980         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4981 }
4982 #[repr(C)]
4983 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4984 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4986 pub struct CResult_InitFeaturesDecodeErrorZ {
4987         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4988         /// `err` or `result` depending on the state of `result_ok`.
4989         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4990         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4991         pub result_ok: bool,
4992 }
4993 #[no_mangle]
4994 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4995 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4996         CResult_InitFeaturesDecodeErrorZ {
4997                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4998                         result: Box::into_raw(Box::new(o)),
4999                 },
5000                 result_ok: true,
5001         }
5002 }
5003 #[no_mangle]
5004 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5005 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5006         CResult_InitFeaturesDecodeErrorZ {
5007                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5008                         err: Box::into_raw(Box::new(e)),
5009                 },
5010                 result_ok: false,
5011         }
5012 }
5013 /// Checks if the given object is currently in the success state
5014 #[no_mangle]
5015 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5016         o.result_ok
5017 }
5018 #[no_mangle]
5019 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5021 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5022         fn drop(&mut self) {
5023                 if self.result_ok {
5024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5026                         }
5027                 } else {
5028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5030                         }
5031                 }
5032         }
5033 }
5034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5035         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5036                 let contents = if o.result_ok {
5037                         let result = unsafe { o.contents.result };
5038                         unsafe { o.contents.result = core::ptr::null_mut() };
5039                         CResult_InitFeaturesDecodeErrorZPtr { result }
5040                 } else {
5041                         let err = unsafe { o.contents.err };
5042                         unsafe { o.contents.err = core::ptr::null_mut(); }
5043                         CResult_InitFeaturesDecodeErrorZPtr { err }
5044                 };
5045                 Self {
5046                         contents,
5047                         result_ok: o.result_ok,
5048                 }
5049         }
5050 }
5051 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5052         fn clone(&self) -> Self {
5053                 if self.result_ok {
5054                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5055                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5056                         } }
5057                 } else {
5058                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5059                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5060                         } }
5061                 }
5062         }
5063 }
5064 #[no_mangle]
5065 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5066 /// but with all dynamically-allocated buffers duplicated in new buffers.
5067 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5068 #[repr(C)]
5069 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5070 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5071         /// A pointer to the contents in the success state.
5072         /// Reading from this pointer when `result_ok` is not set is undefined.
5073         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5074         /// A pointer to the contents in the error state.
5075         /// Reading from this pointer when `result_ok` is set is undefined.
5076         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5077 }
5078 #[repr(C)]
5079 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5080 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5082 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5083         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5084         /// `err` or `result` depending on the state of `result_ok`.
5085         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5086         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5087         pub result_ok: bool,
5088 }
5089 #[no_mangle]
5090 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5091 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5092         CResult_ChannelFeaturesDecodeErrorZ {
5093                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5094                         result: Box::into_raw(Box::new(o)),
5095                 },
5096                 result_ok: true,
5097         }
5098 }
5099 #[no_mangle]
5100 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5101 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5102         CResult_ChannelFeaturesDecodeErrorZ {
5103                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5104                         err: Box::into_raw(Box::new(e)),
5105                 },
5106                 result_ok: false,
5107         }
5108 }
5109 /// Checks if the given object is currently in the success state
5110 #[no_mangle]
5111 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5112         o.result_ok
5113 }
5114 #[no_mangle]
5115 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5116 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5117 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5118         fn drop(&mut self) {
5119                 if self.result_ok {
5120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5122                         }
5123                 } else {
5124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5126                         }
5127                 }
5128         }
5129 }
5130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5131         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5132                 let contents = if o.result_ok {
5133                         let result = unsafe { o.contents.result };
5134                         unsafe { o.contents.result = core::ptr::null_mut() };
5135                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5136                 } else {
5137                         let err = unsafe { o.contents.err };
5138                         unsafe { o.contents.err = core::ptr::null_mut(); }
5139                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5140                 };
5141                 Self {
5142                         contents,
5143                         result_ok: o.result_ok,
5144                 }
5145         }
5146 }
5147 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5148         fn clone(&self) -> Self {
5149                 if self.result_ok {
5150                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5151                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5152                         } }
5153                 } else {
5154                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5156                         } }
5157                 }
5158         }
5159 }
5160 #[no_mangle]
5161 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5162 /// but with all dynamically-allocated buffers duplicated in new buffers.
5163 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5164 #[repr(C)]
5165 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5166 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5167         /// A pointer to the contents in the success state.
5168         /// Reading from this pointer when `result_ok` is not set is undefined.
5169         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5170         /// A pointer to the contents in the error state.
5171         /// Reading from this pointer when `result_ok` is set is undefined.
5172         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5173 }
5174 #[repr(C)]
5175 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5176 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5178 pub struct CResult_NodeFeaturesDecodeErrorZ {
5179         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5180         /// `err` or `result` depending on the state of `result_ok`.
5181         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5182         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5183         pub result_ok: bool,
5184 }
5185 #[no_mangle]
5186 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5187 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5188         CResult_NodeFeaturesDecodeErrorZ {
5189                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5190                         result: Box::into_raw(Box::new(o)),
5191                 },
5192                 result_ok: true,
5193         }
5194 }
5195 #[no_mangle]
5196 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5197 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5198         CResult_NodeFeaturesDecodeErrorZ {
5199                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5200                         err: Box::into_raw(Box::new(e)),
5201                 },
5202                 result_ok: false,
5203         }
5204 }
5205 /// Checks if the given object is currently in the success state
5206 #[no_mangle]
5207 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5208         o.result_ok
5209 }
5210 #[no_mangle]
5211 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5212 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5213 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5214         fn drop(&mut self) {
5215                 if self.result_ok {
5216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5218                         }
5219                 } else {
5220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5222                         }
5223                 }
5224         }
5225 }
5226 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5227         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5228                 let contents = if o.result_ok {
5229                         let result = unsafe { o.contents.result };
5230                         unsafe { o.contents.result = core::ptr::null_mut() };
5231                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5232                 } else {
5233                         let err = unsafe { o.contents.err };
5234                         unsafe { o.contents.err = core::ptr::null_mut(); }
5235                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5236                 };
5237                 Self {
5238                         contents,
5239                         result_ok: o.result_ok,
5240                 }
5241         }
5242 }
5243 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5244         fn clone(&self) -> Self {
5245                 if self.result_ok {
5246                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5247                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5248                         } }
5249                 } else {
5250                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5251                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5252                         } }
5253                 }
5254         }
5255 }
5256 #[no_mangle]
5257 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5258 /// but with all dynamically-allocated buffers duplicated in new buffers.
5259 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5260 #[repr(C)]
5261 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5262 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5263         /// A pointer to the contents in the success state.
5264         /// Reading from this pointer when `result_ok` is not set is undefined.
5265         pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
5266         /// A pointer to the contents in the error state.
5267         /// Reading from this pointer when `result_ok` is set is undefined.
5268         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5269 }
5270 #[repr(C)]
5271 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5272 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5274 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5275         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5276         /// `err` or `result` depending on the state of `result_ok`.
5277         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5278         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5279         pub result_ok: bool,
5280 }
5281 #[no_mangle]
5282 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5283 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5284         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5285                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5286                         result: Box::into_raw(Box::new(o)),
5287                 },
5288                 result_ok: true,
5289         }
5290 }
5291 #[no_mangle]
5292 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5293 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5294         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5295                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5296                         err: Box::into_raw(Box::new(e)),
5297                 },
5298                 result_ok: false,
5299         }
5300 }
5301 /// Checks if the given object is currently in the success state
5302 #[no_mangle]
5303 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5304         o.result_ok
5305 }
5306 #[no_mangle]
5307 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5308 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5309 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5310         fn drop(&mut self) {
5311                 if self.result_ok {
5312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5314                         }
5315                 } else {
5316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5318                         }
5319                 }
5320         }
5321 }
5322 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5323         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5324                 let contents = if o.result_ok {
5325                         let result = unsafe { o.contents.result };
5326                         unsafe { o.contents.result = core::ptr::null_mut() };
5327                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5328                 } else {
5329                         let err = unsafe { o.contents.err };
5330                         unsafe { o.contents.err = core::ptr::null_mut(); }
5331                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5332                 };
5333                 Self {
5334                         contents,
5335                         result_ok: o.result_ok,
5336                 }
5337         }
5338 }
5339 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5340         fn clone(&self) -> Self {
5341                 if self.result_ok {
5342                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5343                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5344                         } }
5345                 } else {
5346                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5347                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5348                         } }
5349                 }
5350         }
5351 }
5352 #[no_mangle]
5353 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5354 /// but with all dynamically-allocated buffers duplicated in new buffers.
5355 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5356 #[repr(C)]
5357 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5358 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5359         /// A pointer to the contents in the success state.
5360         /// Reading from this pointer when `result_ok` is not set is undefined.
5361         pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
5362         /// A pointer to the contents in the error state.
5363         /// Reading from this pointer when `result_ok` is set is undefined.
5364         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5365 }
5366 #[repr(C)]
5367 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5368 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5370 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5371         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5372         /// `err` or `result` depending on the state of `result_ok`.
5373         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5374         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5375         pub result_ok: bool,
5376 }
5377 #[no_mangle]
5378 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5379 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5380         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5381                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5382                         result: Box::into_raw(Box::new(o)),
5383                 },
5384                 result_ok: true,
5385         }
5386 }
5387 #[no_mangle]
5388 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5389 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5390         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5391                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5392                         err: Box::into_raw(Box::new(e)),
5393                 },
5394                 result_ok: false,
5395         }
5396 }
5397 /// Checks if the given object is currently in the success state
5398 #[no_mangle]
5399 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5400         o.result_ok
5401 }
5402 #[no_mangle]
5403 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5404 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5405 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5406         fn drop(&mut self) {
5407                 if self.result_ok {
5408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5410                         }
5411                 } else {
5412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5414                         }
5415                 }
5416         }
5417 }
5418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5420                 let contents = if o.result_ok {
5421                         let result = unsafe { o.contents.result };
5422                         unsafe { o.contents.result = core::ptr::null_mut() };
5423                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
5424                 } else {
5425                         let err = unsafe { o.contents.err };
5426                         unsafe { o.contents.err = core::ptr::null_mut(); }
5427                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
5428                 };
5429                 Self {
5430                         contents,
5431                         result_ok: o.result_ok,
5432                 }
5433         }
5434 }
5435 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5436         fn clone(&self) -> Self {
5437                 if self.result_ok {
5438                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5439                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5440                         } }
5441                 } else {
5442                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5443                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5444                         } }
5445                 }
5446         }
5447 }
5448 #[no_mangle]
5449 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5450 /// but with all dynamically-allocated buffers duplicated in new buffers.
5451 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5452 #[repr(C)]
5453 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5454 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5455         /// A pointer to the contents in the success state.
5456         /// Reading from this pointer when `result_ok` is not set is undefined.
5457         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5458         /// A pointer to the contents in the error state.
5459         /// Reading from this pointer when `result_ok` is set is undefined.
5460         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5461 }
5462 #[repr(C)]
5463 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5464 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5466 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5467         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5468         /// `err` or `result` depending on the state of `result_ok`.
5469         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5470         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5471         pub result_ok: bool,
5472 }
5473 #[no_mangle]
5474 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5475 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5476         CResult_BlindedHopFeaturesDecodeErrorZ {
5477                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5478                         result: Box::into_raw(Box::new(o)),
5479                 },
5480                 result_ok: true,
5481         }
5482 }
5483 #[no_mangle]
5484 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5485 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5486         CResult_BlindedHopFeaturesDecodeErrorZ {
5487                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5488                         err: Box::into_raw(Box::new(e)),
5489                 },
5490                 result_ok: false,
5491         }
5492 }
5493 /// Checks if the given object is currently in the success state
5494 #[no_mangle]
5495 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5496         o.result_ok
5497 }
5498 #[no_mangle]
5499 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5500 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5501 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5502         fn drop(&mut self) {
5503                 if self.result_ok {
5504                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5505                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5506                         }
5507                 } else {
5508                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5509                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5510                         }
5511                 }
5512         }
5513 }
5514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5515         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5516                 let contents = if o.result_ok {
5517                         let result = unsafe { o.contents.result };
5518                         unsafe { o.contents.result = core::ptr::null_mut() };
5519                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5520                 } else {
5521                         let err = unsafe { o.contents.err };
5522                         unsafe { o.contents.err = core::ptr::null_mut(); }
5523                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5524                 };
5525                 Self {
5526                         contents,
5527                         result_ok: o.result_ok,
5528                 }
5529         }
5530 }
5531 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5532         fn clone(&self) -> Self {
5533                 if self.result_ok {
5534                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5535                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5536                         } }
5537                 } else {
5538                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5539                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5540                         } }
5541                 }
5542         }
5543 }
5544 #[no_mangle]
5545 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5546 /// but with all dynamically-allocated buffers duplicated in new buffers.
5547 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5548 #[repr(C)]
5549 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5550 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5551         /// A pointer to the contents in the success state.
5552         /// Reading from this pointer when `result_ok` is not set is undefined.
5553         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5554         /// A pointer to the contents in the error state.
5555         /// Reading from this pointer when `result_ok` is set is undefined.
5556         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5557 }
5558 #[repr(C)]
5559 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5560 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5562 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5563         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5564         /// `err` or `result` depending on the state of `result_ok`.
5565         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5566         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5567         pub result_ok: bool,
5568 }
5569 #[no_mangle]
5570 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5571 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5572         CResult_ChannelTypeFeaturesDecodeErrorZ {
5573                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5574                         result: Box::into_raw(Box::new(o)),
5575                 },
5576                 result_ok: true,
5577         }
5578 }
5579 #[no_mangle]
5580 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5581 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5582         CResult_ChannelTypeFeaturesDecodeErrorZ {
5583                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5584                         err: Box::into_raw(Box::new(e)),
5585                 },
5586                 result_ok: false,
5587         }
5588 }
5589 /// Checks if the given object is currently in the success state
5590 #[no_mangle]
5591 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5592         o.result_ok
5593 }
5594 #[no_mangle]
5595 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5596 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5597 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5598         fn drop(&mut self) {
5599                 if self.result_ok {
5600                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5601                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5602                         }
5603                 } else {
5604                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5605                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5606                         }
5607                 }
5608         }
5609 }
5610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5611         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5612                 let contents = if o.result_ok {
5613                         let result = unsafe { o.contents.result };
5614                         unsafe { o.contents.result = core::ptr::null_mut() };
5615                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5616                 } else {
5617                         let err = unsafe { o.contents.err };
5618                         unsafe { o.contents.err = core::ptr::null_mut(); }
5619                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5620                 };
5621                 Self {
5622                         contents,
5623                         result_ok: o.result_ok,
5624                 }
5625         }
5626 }
5627 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5628         fn clone(&self) -> Self {
5629                 if self.result_ok {
5630                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5631                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5632                         } }
5633                 } else {
5634                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5635                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5636                         } }
5637                 }
5638         }
5639 }
5640 #[no_mangle]
5641 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5642 /// but with all dynamically-allocated buffers duplicated in new buffers.
5643 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5644 #[repr(C)]
5645 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5646 /// This corresponds to std::vector in C++
5647 pub struct CVec_ChainHashZ {
5648         /// The elements in the array.
5649         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5650         pub data: *mut crate::c_types::ThirtyTwoBytes,
5651         /// The number of elements pointed to by `data`.
5652         pub datalen: usize
5653 }
5654 impl CVec_ChainHashZ {
5655         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
5656                 if self.datalen == 0 { return Vec::new(); }
5657                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5658                 self.data = core::ptr::null_mut();
5659                 self.datalen = 0;
5660                 ret
5661         }
5662         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
5663                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5664         }
5665 }
5666 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ChainHashZ {
5667         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
5668                 let datalen = v.len();
5669                 let data = Box::into_raw(v.into_boxed_slice());
5670                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5671         }
5672 }
5673 #[no_mangle]
5674 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5675 pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { }
5676 impl Drop for CVec_ChainHashZ {
5677         fn drop(&mut self) {
5678                 if self.datalen == 0 { return; }
5679                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5680         }
5681 }
5682 impl Clone for CVec_ChainHashZ {
5683         fn clone(&self) -> Self {
5684                 let mut res = Vec::new();
5685                 if self.datalen == 0 { return Self::from(res); }
5686                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5687                 Self::from(res)
5688         }
5689 }
5690 #[repr(C)]
5691 /// The contents of CResult_OfferBolt12ParseErrorZ
5692 pub union CResult_OfferBolt12ParseErrorZPtr {
5693         /// A pointer to the contents in the success state.
5694         /// Reading from this pointer when `result_ok` is not set is undefined.
5695         pub result: *mut crate::lightning::offers::offer::Offer,
5696         /// A pointer to the contents in the error state.
5697         /// Reading from this pointer when `result_ok` is set is undefined.
5698         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
5699 }
5700 #[repr(C)]
5701 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
5702 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
5703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5704 pub struct CResult_OfferBolt12ParseErrorZ {
5705         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
5706         /// `err` or `result` depending on the state of `result_ok`.
5707         pub contents: CResult_OfferBolt12ParseErrorZPtr,
5708         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
5709         pub result_ok: bool,
5710 }
5711 #[no_mangle]
5712 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
5713 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
5714         CResult_OfferBolt12ParseErrorZ {
5715                 contents: CResult_OfferBolt12ParseErrorZPtr {
5716                         result: Box::into_raw(Box::new(o)),
5717                 },
5718                 result_ok: true,
5719         }
5720 }
5721 #[no_mangle]
5722 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
5723 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
5724         CResult_OfferBolt12ParseErrorZ {
5725                 contents: CResult_OfferBolt12ParseErrorZPtr {
5726                         err: Box::into_raw(Box::new(e)),
5727                 },
5728                 result_ok: false,
5729         }
5730 }
5731 /// Checks if the given object is currently in the success state
5732 #[no_mangle]
5733 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
5734         o.result_ok
5735 }
5736 #[no_mangle]
5737 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
5738 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
5739 impl Drop for CResult_OfferBolt12ParseErrorZ {
5740         fn drop(&mut self) {
5741                 if self.result_ok {
5742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5744                         }
5745                 } else {
5746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5748                         }
5749                 }
5750         }
5751 }
5752 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
5753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
5754                 let contents = if o.result_ok {
5755                         let result = unsafe { o.contents.result };
5756                         unsafe { o.contents.result = core::ptr::null_mut() };
5757                         CResult_OfferBolt12ParseErrorZPtr { result }
5758                 } else {
5759                         let err = unsafe { o.contents.err };
5760                         unsafe { o.contents.err = core::ptr::null_mut(); }
5761                         CResult_OfferBolt12ParseErrorZPtr { err }
5762                 };
5763                 Self {
5764                         contents,
5765                         result_ok: o.result_ok,
5766                 }
5767         }
5768 }
5769 impl Clone for CResult_OfferBolt12ParseErrorZ {
5770         fn clone(&self) -> Self {
5771                 if self.result_ok {
5772                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
5773                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
5774                         } }
5775                 } else {
5776                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
5777                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
5778                         } }
5779                 }
5780         }
5781 }
5782 #[no_mangle]
5783 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
5784 /// but with all dynamically-allocated buffers duplicated in new buffers.
5785 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
5786 #[repr(C)]
5787 /// The contents of CResult_PublicKeyErrorZ
5788 pub union CResult_PublicKeyErrorZPtr {
5789         /// A pointer to the contents in the success state.
5790         /// Reading from this pointer when `result_ok` is not set is undefined.
5791         pub result: *mut crate::c_types::PublicKey,
5792         /// A pointer to the contents in the error state.
5793         /// Reading from this pointer when `result_ok` is set is undefined.
5794         pub err: *mut crate::c_types::Secp256k1Error,
5795 }
5796 #[repr(C)]
5797 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
5798 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
5799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5800 pub struct CResult_PublicKeyErrorZ {
5801         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
5802         /// `err` or `result` depending on the state of `result_ok`.
5803         pub contents: CResult_PublicKeyErrorZPtr,
5804         /// Whether this CResult_PublicKeyErrorZ represents a success state.
5805         pub result_ok: bool,
5806 }
5807 #[no_mangle]
5808 /// Creates a new CResult_PublicKeyErrorZ in the success state.
5809 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
5810         CResult_PublicKeyErrorZ {
5811                 contents: CResult_PublicKeyErrorZPtr {
5812                         result: Box::into_raw(Box::new(o)),
5813                 },
5814                 result_ok: true,
5815         }
5816 }
5817 #[no_mangle]
5818 /// Creates a new CResult_PublicKeyErrorZ in the error state.
5819 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
5820         CResult_PublicKeyErrorZ {
5821                 contents: CResult_PublicKeyErrorZPtr {
5822                         err: Box::into_raw(Box::new(e)),
5823                 },
5824                 result_ok: false,
5825         }
5826 }
5827 /// Checks if the given object is currently in the success state
5828 #[no_mangle]
5829 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
5830         o.result_ok
5831 }
5832 #[no_mangle]
5833 /// Frees any resources used by the CResult_PublicKeyErrorZ.
5834 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
5835 impl Drop for CResult_PublicKeyErrorZ {
5836         fn drop(&mut self) {
5837                 if self.result_ok {
5838                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5839                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5840                         }
5841                 } else {
5842                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5843                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5844                         }
5845                 }
5846         }
5847 }
5848 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
5849         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
5850                 let contents = if o.result_ok {
5851                         let result = unsafe { o.contents.result };
5852                         unsafe { o.contents.result = core::ptr::null_mut() };
5853                         CResult_PublicKeyErrorZPtr { result }
5854                 } else {
5855                         let err = unsafe { o.contents.err };
5856                         unsafe { o.contents.err = core::ptr::null_mut(); }
5857                         CResult_PublicKeyErrorZPtr { err }
5858                 };
5859                 Self {
5860                         contents,
5861                         result_ok: o.result_ok,
5862                 }
5863         }
5864 }
5865 impl Clone for CResult_PublicKeyErrorZ {
5866         fn clone(&self) -> Self {
5867                 if self.result_ok {
5868                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
5869                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
5870                         } }
5871                 } else {
5872                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
5873                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5874                         } }
5875                 }
5876         }
5877 }
5878 #[no_mangle]
5879 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
5880 /// but with all dynamically-allocated buffers duplicated in new buffers.
5881 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
5882 #[repr(C)]
5883 /// The contents of CResult_NodeIdDecodeErrorZ
5884 pub union CResult_NodeIdDecodeErrorZPtr {
5885         /// A pointer to the contents in the success state.
5886         /// Reading from this pointer when `result_ok` is not set is undefined.
5887         pub result: *mut crate::lightning::routing::gossip::NodeId,
5888         /// A pointer to the contents in the error state.
5889         /// Reading from this pointer when `result_ok` is set is undefined.
5890         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5891 }
5892 #[repr(C)]
5893 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5894 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5896 pub struct CResult_NodeIdDecodeErrorZ {
5897         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5898         /// `err` or `result` depending on the state of `result_ok`.
5899         pub contents: CResult_NodeIdDecodeErrorZPtr,
5900         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5901         pub result_ok: bool,
5902 }
5903 #[no_mangle]
5904 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5905 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5906         CResult_NodeIdDecodeErrorZ {
5907                 contents: CResult_NodeIdDecodeErrorZPtr {
5908                         result: Box::into_raw(Box::new(o)),
5909                 },
5910                 result_ok: true,
5911         }
5912 }
5913 #[no_mangle]
5914 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5915 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5916         CResult_NodeIdDecodeErrorZ {
5917                 contents: CResult_NodeIdDecodeErrorZPtr {
5918                         err: Box::into_raw(Box::new(e)),
5919                 },
5920                 result_ok: false,
5921         }
5922 }
5923 /// Checks if the given object is currently in the success state
5924 #[no_mangle]
5925 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5926         o.result_ok
5927 }
5928 #[no_mangle]
5929 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5930 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5931 impl Drop for CResult_NodeIdDecodeErrorZ {
5932         fn drop(&mut self) {
5933                 if self.result_ok {
5934                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5935                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5936                         }
5937                 } else {
5938                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5939                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5940                         }
5941                 }
5942         }
5943 }
5944 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5945         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5946                 let contents = if o.result_ok {
5947                         let result = unsafe { o.contents.result };
5948                         unsafe { o.contents.result = core::ptr::null_mut() };
5949                         CResult_NodeIdDecodeErrorZPtr { result }
5950                 } else {
5951                         let err = unsafe { o.contents.err };
5952                         unsafe { o.contents.err = core::ptr::null_mut(); }
5953                         CResult_NodeIdDecodeErrorZPtr { err }
5954                 };
5955                 Self {
5956                         contents,
5957                         result_ok: o.result_ok,
5958                 }
5959         }
5960 }
5961 impl Clone for CResult_NodeIdDecodeErrorZ {
5962         fn clone(&self) -> Self {
5963                 if self.result_ok {
5964                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5965                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5966                         } }
5967                 } else {
5968                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5969                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5970                         } }
5971                 }
5972         }
5973 }
5974 #[no_mangle]
5975 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5976 /// but with all dynamically-allocated buffers duplicated in new buffers.
5977 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5978 #[repr(C)]
5979 #[derive(Clone)]
5980 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
5981 pub enum COption_NetworkUpdateZ {
5982         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
5983         Some(crate::lightning::routing::gossip::NetworkUpdate),
5984         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
5985         None
5986 }
5987 impl COption_NetworkUpdateZ {
5988         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5989                 if let Self::None = self { false } else { true }
5990         }
5991         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5992                 !self.is_some()
5993         }
5994         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
5995                 if let Self::Some(v) = self { v } else { unreachable!() }
5996         }
5997 }
5998 #[no_mangle]
5999 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6000 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6001         COption_NetworkUpdateZ::Some(o)
6002 }
6003 #[no_mangle]
6004 /// Constructs a new COption_NetworkUpdateZ containing nothing
6005 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6006         COption_NetworkUpdateZ::None
6007 }
6008 #[no_mangle]
6009 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6010 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6011 #[no_mangle]
6012 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6013 /// but with all dynamically-allocated buffers duplicated in new buffers.
6014 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6015 #[repr(C)]
6016 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6017 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6018         /// A pointer to the contents in the success state.
6019         /// Reading from this pointer when `result_ok` is not set is undefined.
6020         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6021         /// A pointer to the contents in the error state.
6022         /// Reading from this pointer when `result_ok` is set is undefined.
6023         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6024 }
6025 #[repr(C)]
6026 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6027 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6028 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6029 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6030         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6031         /// `err` or `result` depending on the state of `result_ok`.
6032         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6033         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6034         pub result_ok: bool,
6035 }
6036 #[no_mangle]
6037 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6038 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6039         CResult_COption_NetworkUpdateZDecodeErrorZ {
6040                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6041                         result: Box::into_raw(Box::new(o)),
6042                 },
6043                 result_ok: true,
6044         }
6045 }
6046 #[no_mangle]
6047 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6048 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6049         CResult_COption_NetworkUpdateZDecodeErrorZ {
6050                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6051                         err: Box::into_raw(Box::new(e)),
6052                 },
6053                 result_ok: false,
6054         }
6055 }
6056 /// Checks if the given object is currently in the success state
6057 #[no_mangle]
6058 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6059         o.result_ok
6060 }
6061 #[no_mangle]
6062 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6063 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6064 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6065         fn drop(&mut self) {
6066                 if self.result_ok {
6067                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6068                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6069                         }
6070                 } else {
6071                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6072                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6073                         }
6074                 }
6075         }
6076 }
6077 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6078         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6079                 let contents = if o.result_ok {
6080                         let result = unsafe { o.contents.result };
6081                         unsafe { o.contents.result = core::ptr::null_mut() };
6082                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6083                 } else {
6084                         let err = unsafe { o.contents.err };
6085                         unsafe { o.contents.err = core::ptr::null_mut(); }
6086                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6087                 };
6088                 Self {
6089                         contents,
6090                         result_ok: o.result_ok,
6091                 }
6092         }
6093 }
6094 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6095         fn clone(&self) -> Self {
6096                 if self.result_ok {
6097                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6098                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6099                         } }
6100                 } else {
6101                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6102                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6103                         } }
6104                 }
6105         }
6106 }
6107 #[no_mangle]
6108 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6109 /// but with all dynamically-allocated buffers duplicated in new buffers.
6110 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6111 #[repr(C)]
6112 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6113 pub enum COption_UtxoLookupZ {
6114         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6115         Some(crate::lightning::routing::utxo::UtxoLookup),
6116         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6117         None
6118 }
6119 impl COption_UtxoLookupZ {
6120         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6121                 if let Self::None = self { false } else { true }
6122         }
6123         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6124                 !self.is_some()
6125         }
6126         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6127                 if let Self::Some(v) = self { v } else { unreachable!() }
6128         }
6129 }
6130 #[no_mangle]
6131 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6132 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6133         COption_UtxoLookupZ::Some(o)
6134 }
6135 #[no_mangle]
6136 /// Constructs a new COption_UtxoLookupZ containing nothing
6137 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6138         COption_UtxoLookupZ::None
6139 }
6140 #[no_mangle]
6141 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6142 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6143 #[repr(C)]
6144 /// The contents of CResult_NoneLightningErrorZ
6145 pub union CResult_NoneLightningErrorZPtr {
6146         /// Note that this value is always NULL, as there are no contents in the OK variant
6147         pub result: *mut core::ffi::c_void,
6148         /// A pointer to the contents in the error state.
6149         /// Reading from this pointer when `result_ok` is set is undefined.
6150         pub err: *mut crate::lightning::ln::msgs::LightningError,
6151 }
6152 #[repr(C)]
6153 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6154 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6156 pub struct CResult_NoneLightningErrorZ {
6157         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6158         /// `err` or `result` depending on the state of `result_ok`.
6159         pub contents: CResult_NoneLightningErrorZPtr,
6160         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6161         pub result_ok: bool,
6162 }
6163 #[no_mangle]
6164 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6165 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6166         CResult_NoneLightningErrorZ {
6167                 contents: CResult_NoneLightningErrorZPtr {
6168                         result: core::ptr::null_mut(),
6169                 },
6170                 result_ok: true,
6171         }
6172 }
6173 #[no_mangle]
6174 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6175 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6176         CResult_NoneLightningErrorZ {
6177                 contents: CResult_NoneLightningErrorZPtr {
6178                         err: Box::into_raw(Box::new(e)),
6179                 },
6180                 result_ok: false,
6181         }
6182 }
6183 /// Checks if the given object is currently in the success state
6184 #[no_mangle]
6185 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6186         o.result_ok
6187 }
6188 #[no_mangle]
6189 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6190 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6191 impl Drop for CResult_NoneLightningErrorZ {
6192         fn drop(&mut self) {
6193                 if self.result_ok {
6194                 } else {
6195                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6196                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6197                         }
6198                 }
6199         }
6200 }
6201 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6202         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6203                 let contents = if o.result_ok {
6204                         let _ = unsafe { Box::from_raw(o.contents.result) };
6205                         o.contents.result = core::ptr::null_mut();
6206                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6207                 } else {
6208                         let err = unsafe { o.contents.err };
6209                         unsafe { o.contents.err = core::ptr::null_mut(); }
6210                         CResult_NoneLightningErrorZPtr { err }
6211                 };
6212                 Self {
6213                         contents,
6214                         result_ok: o.result_ok,
6215                 }
6216         }
6217 }
6218 impl Clone for CResult_NoneLightningErrorZ {
6219         fn clone(&self) -> Self {
6220                 if self.result_ok {
6221                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6222                                 result: core::ptr::null_mut()
6223                         } }
6224                 } else {
6225                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6226                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6227                         } }
6228                 }
6229         }
6230 }
6231 #[no_mangle]
6232 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6233 /// but with all dynamically-allocated buffers duplicated in new buffers.
6234 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6235 #[repr(C)]
6236 /// The contents of CResult_boolLightningErrorZ
6237 pub union CResult_boolLightningErrorZPtr {
6238         /// A pointer to the contents in the success state.
6239         /// Reading from this pointer when `result_ok` is not set is undefined.
6240         pub result: *mut bool,
6241         /// A pointer to the contents in the error state.
6242         /// Reading from this pointer when `result_ok` is set is undefined.
6243         pub err: *mut crate::lightning::ln::msgs::LightningError,
6244 }
6245 #[repr(C)]
6246 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6247 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6249 pub struct CResult_boolLightningErrorZ {
6250         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6251         /// `err` or `result` depending on the state of `result_ok`.
6252         pub contents: CResult_boolLightningErrorZPtr,
6253         /// Whether this CResult_boolLightningErrorZ represents a success state.
6254         pub result_ok: bool,
6255 }
6256 #[no_mangle]
6257 /// Creates a new CResult_boolLightningErrorZ in the success state.
6258 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6259         CResult_boolLightningErrorZ {
6260                 contents: CResult_boolLightningErrorZPtr {
6261                         result: Box::into_raw(Box::new(o)),
6262                 },
6263                 result_ok: true,
6264         }
6265 }
6266 #[no_mangle]
6267 /// Creates a new CResult_boolLightningErrorZ in the error state.
6268 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6269         CResult_boolLightningErrorZ {
6270                 contents: CResult_boolLightningErrorZPtr {
6271                         err: Box::into_raw(Box::new(e)),
6272                 },
6273                 result_ok: false,
6274         }
6275 }
6276 /// Checks if the given object is currently in the success state
6277 #[no_mangle]
6278 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6279         o.result_ok
6280 }
6281 #[no_mangle]
6282 /// Frees any resources used by the CResult_boolLightningErrorZ.
6283 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6284 impl Drop for CResult_boolLightningErrorZ {
6285         fn drop(&mut self) {
6286                 if self.result_ok {
6287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6289                         }
6290                 } else {
6291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6293                         }
6294                 }
6295         }
6296 }
6297 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6298         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6299                 let contents = if o.result_ok {
6300                         let result = unsafe { o.contents.result };
6301                         unsafe { o.contents.result = core::ptr::null_mut() };
6302                         CResult_boolLightningErrorZPtr { result }
6303                 } else {
6304                         let err = unsafe { o.contents.err };
6305                         unsafe { o.contents.err = core::ptr::null_mut(); }
6306                         CResult_boolLightningErrorZPtr { err }
6307                 };
6308                 Self {
6309                         contents,
6310                         result_ok: o.result_ok,
6311                 }
6312         }
6313 }
6314 impl Clone for CResult_boolLightningErrorZ {
6315         fn clone(&self) -> Self {
6316                 if self.result_ok {
6317                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6318                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6319                         } }
6320                 } else {
6321                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6322                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6323                         } }
6324                 }
6325         }
6326 }
6327 #[no_mangle]
6328 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6329 /// but with all dynamically-allocated buffers duplicated in new buffers.
6330 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6331 #[repr(C)]
6332 /// A tuple of 3 elements. See the individual fields for the types contained.
6333 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6334         /// The element at position 0
6335         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6336         /// The element at position 1
6337         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6338         /// The element at position 2
6339         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6340 }
6341 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6342         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6343                 Self {
6344                         a: tup.0,
6345                         b: tup.1,
6346                         c: tup.2,
6347                 }
6348         }
6349 }
6350 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6351         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6352                 (self.a, self.b, self.c)
6353         }
6354 }
6355 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6356         fn clone(&self) -> Self {
6357                 Self {
6358                         a: Clone::clone(&self.a),
6359                         b: Clone::clone(&self.b),
6360                         c: Clone::clone(&self.c),
6361                 }
6362         }
6363 }
6364 #[no_mangle]
6365 /// Creates a new tuple which has the same data as `orig`
6366 /// but with all dynamically-allocated buffers duplicated in new buffers.
6367 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6368 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6369 #[no_mangle]
6370 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 {
6371         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6372 }
6373
6374 #[no_mangle]
6375 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6376 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6377 #[repr(C)]
6378 #[derive(Clone)]
6379 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6380 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6381         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6382         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6383         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6384         None
6385 }
6386 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6387         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6388                 if let Self::None = self { false } else { true }
6389         }
6390         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6391                 !self.is_some()
6392         }
6393         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6394                 if let Self::Some(v) = self { v } else { unreachable!() }
6395         }
6396 }
6397 #[no_mangle]
6398 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6399 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6400         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6401 }
6402 #[no_mangle]
6403 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6404 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6405         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6406 }
6407 #[no_mangle]
6408 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6409 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6410 #[no_mangle]
6411 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6412 /// but with all dynamically-allocated buffers duplicated in new buffers.
6413 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6414 #[repr(C)]
6415 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6416 /// This corresponds to std::vector in C++
6417 pub struct CVec_MessageSendEventZ {
6418         /// The elements in the array.
6419         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6420         pub data: *mut crate::lightning::events::MessageSendEvent,
6421         /// The number of elements pointed to by `data`.
6422         pub datalen: usize
6423 }
6424 impl CVec_MessageSendEventZ {
6425         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6426                 if self.datalen == 0 { return Vec::new(); }
6427                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6428                 self.data = core::ptr::null_mut();
6429                 self.datalen = 0;
6430                 ret
6431         }
6432         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6433                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6434         }
6435 }
6436 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6437         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6438                 let datalen = v.len();
6439                 let data = Box::into_raw(v.into_boxed_slice());
6440                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6441         }
6442 }
6443 #[no_mangle]
6444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6445 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6446 impl Drop for CVec_MessageSendEventZ {
6447         fn drop(&mut self) {
6448                 if self.datalen == 0 { return; }
6449                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6450         }
6451 }
6452 impl Clone for CVec_MessageSendEventZ {
6453         fn clone(&self) -> Self {
6454                 let mut res = Vec::new();
6455                 if self.datalen == 0 { return Self::from(res); }
6456                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6457                 Self::from(res)
6458         }
6459 }
6460 #[repr(C)]
6461 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6462 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6463         /// A pointer to the contents in the success state.
6464         /// Reading from this pointer when `result_ok` is not set is undefined.
6465         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6466         /// A pointer to the contents in the error state.
6467         /// Reading from this pointer when `result_ok` is set is undefined.
6468         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6469 }
6470 #[repr(C)]
6471 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6472 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6475         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6476         /// `err` or `result` depending on the state of `result_ok`.
6477         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6478         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6479         pub result_ok: bool,
6480 }
6481 #[no_mangle]
6482 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6483 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6484         CResult_ChannelUpdateInfoDecodeErrorZ {
6485                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6486                         result: Box::into_raw(Box::new(o)),
6487                 },
6488                 result_ok: true,
6489         }
6490 }
6491 #[no_mangle]
6492 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6493 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6494         CResult_ChannelUpdateInfoDecodeErrorZ {
6495                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6496                         err: Box::into_raw(Box::new(e)),
6497                 },
6498                 result_ok: false,
6499         }
6500 }
6501 /// Checks if the given object is currently in the success state
6502 #[no_mangle]
6503 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6504         o.result_ok
6505 }
6506 #[no_mangle]
6507 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6508 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6509 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6510         fn drop(&mut self) {
6511                 if self.result_ok {
6512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6514                         }
6515                 } else {
6516                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6517                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6518                         }
6519                 }
6520         }
6521 }
6522 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6523         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6524                 let contents = if o.result_ok {
6525                         let result = unsafe { o.contents.result };
6526                         unsafe { o.contents.result = core::ptr::null_mut() };
6527                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6528                 } else {
6529                         let err = unsafe { o.contents.err };
6530                         unsafe { o.contents.err = core::ptr::null_mut(); }
6531                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6532                 };
6533                 Self {
6534                         contents,
6535                         result_ok: o.result_ok,
6536                 }
6537         }
6538 }
6539 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6540         fn clone(&self) -> Self {
6541                 if self.result_ok {
6542                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6543                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6544                         } }
6545                 } else {
6546                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6547                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6548                         } }
6549                 }
6550         }
6551 }
6552 #[no_mangle]
6553 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6554 /// but with all dynamically-allocated buffers duplicated in new buffers.
6555 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6556 #[repr(C)]
6557 /// The contents of CResult_ChannelInfoDecodeErrorZ
6558 pub union CResult_ChannelInfoDecodeErrorZPtr {
6559         /// A pointer to the contents in the success state.
6560         /// Reading from this pointer when `result_ok` is not set is undefined.
6561         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6562         /// A pointer to the contents in the error state.
6563         /// Reading from this pointer when `result_ok` is set is undefined.
6564         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6565 }
6566 #[repr(C)]
6567 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6568 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6570 pub struct CResult_ChannelInfoDecodeErrorZ {
6571         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6572         /// `err` or `result` depending on the state of `result_ok`.
6573         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6574         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6575         pub result_ok: bool,
6576 }
6577 #[no_mangle]
6578 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6579 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6580         CResult_ChannelInfoDecodeErrorZ {
6581                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6582                         result: Box::into_raw(Box::new(o)),
6583                 },
6584                 result_ok: true,
6585         }
6586 }
6587 #[no_mangle]
6588 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6589 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6590         CResult_ChannelInfoDecodeErrorZ {
6591                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6592                         err: Box::into_raw(Box::new(e)),
6593                 },
6594                 result_ok: false,
6595         }
6596 }
6597 /// Checks if the given object is currently in the success state
6598 #[no_mangle]
6599 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6600         o.result_ok
6601 }
6602 #[no_mangle]
6603 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6604 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6605 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6606         fn drop(&mut self) {
6607                 if self.result_ok {
6608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6610                         }
6611                 } else {
6612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6614                         }
6615                 }
6616         }
6617 }
6618 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6619         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6620                 let contents = if o.result_ok {
6621                         let result = unsafe { o.contents.result };
6622                         unsafe { o.contents.result = core::ptr::null_mut() };
6623                         CResult_ChannelInfoDecodeErrorZPtr { result }
6624                 } else {
6625                         let err = unsafe { o.contents.err };
6626                         unsafe { o.contents.err = core::ptr::null_mut(); }
6627                         CResult_ChannelInfoDecodeErrorZPtr { err }
6628                 };
6629                 Self {
6630                         contents,
6631                         result_ok: o.result_ok,
6632                 }
6633         }
6634 }
6635 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6636         fn clone(&self) -> Self {
6637                 if self.result_ok {
6638                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6639                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6640                         } }
6641                 } else {
6642                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6643                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6644                         } }
6645                 }
6646         }
6647 }
6648 #[no_mangle]
6649 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6650 /// but with all dynamically-allocated buffers duplicated in new buffers.
6651 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6652 #[repr(C)]
6653 /// The contents of CResult_RoutingFeesDecodeErrorZ
6654 pub union CResult_RoutingFeesDecodeErrorZPtr {
6655         /// A pointer to the contents in the success state.
6656         /// Reading from this pointer when `result_ok` is not set is undefined.
6657         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6658         /// A pointer to the contents in the error state.
6659         /// Reading from this pointer when `result_ok` is set is undefined.
6660         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6661 }
6662 #[repr(C)]
6663 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6664 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6666 pub struct CResult_RoutingFeesDecodeErrorZ {
6667         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6668         /// `err` or `result` depending on the state of `result_ok`.
6669         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6670         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6671         pub result_ok: bool,
6672 }
6673 #[no_mangle]
6674 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6675 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6676         CResult_RoutingFeesDecodeErrorZ {
6677                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6678                         result: Box::into_raw(Box::new(o)),
6679                 },
6680                 result_ok: true,
6681         }
6682 }
6683 #[no_mangle]
6684 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6685 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6686         CResult_RoutingFeesDecodeErrorZ {
6687                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6688                         err: Box::into_raw(Box::new(e)),
6689                 },
6690                 result_ok: false,
6691         }
6692 }
6693 /// Checks if the given object is currently in the success state
6694 #[no_mangle]
6695 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6696         o.result_ok
6697 }
6698 #[no_mangle]
6699 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6700 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6701 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6702         fn drop(&mut self) {
6703                 if self.result_ok {
6704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6706                         }
6707                 } else {
6708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6710                         }
6711                 }
6712         }
6713 }
6714 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6715         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6716                 let contents = if o.result_ok {
6717                         let result = unsafe { o.contents.result };
6718                         unsafe { o.contents.result = core::ptr::null_mut() };
6719                         CResult_RoutingFeesDecodeErrorZPtr { result }
6720                 } else {
6721                         let err = unsafe { o.contents.err };
6722                         unsafe { o.contents.err = core::ptr::null_mut(); }
6723                         CResult_RoutingFeesDecodeErrorZPtr { err }
6724                 };
6725                 Self {
6726                         contents,
6727                         result_ok: o.result_ok,
6728                 }
6729         }
6730 }
6731 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6732         fn clone(&self) -> Self {
6733                 if self.result_ok {
6734                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6735                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6736                         } }
6737                 } else {
6738                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6739                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6740                         } }
6741                 }
6742         }
6743 }
6744 #[no_mangle]
6745 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6746 /// but with all dynamically-allocated buffers duplicated in new buffers.
6747 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6748 #[repr(C)]
6749 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6750 /// This corresponds to std::vector in C++
6751 pub struct CVec_NetAddressZ {
6752         /// The elements in the array.
6753         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6754         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6755         /// The number of elements pointed to by `data`.
6756         pub datalen: usize
6757 }
6758 impl CVec_NetAddressZ {
6759         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6760                 if self.datalen == 0 { return Vec::new(); }
6761                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6762                 self.data = core::ptr::null_mut();
6763                 self.datalen = 0;
6764                 ret
6765         }
6766         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6767                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6768         }
6769 }
6770 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6771         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6772                 let datalen = v.len();
6773                 let data = Box::into_raw(v.into_boxed_slice());
6774                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6775         }
6776 }
6777 #[no_mangle]
6778 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6779 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6780 impl Drop for CVec_NetAddressZ {
6781         fn drop(&mut self) {
6782                 if self.datalen == 0 { return; }
6783                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6784         }
6785 }
6786 impl Clone for CVec_NetAddressZ {
6787         fn clone(&self) -> Self {
6788                 let mut res = Vec::new();
6789                 if self.datalen == 0 { return Self::from(res); }
6790                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6791                 Self::from(res)
6792         }
6793 }
6794 #[repr(C)]
6795 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6796 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6797         /// A pointer to the contents in the success state.
6798         /// Reading from this pointer when `result_ok` is not set is undefined.
6799         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6800         /// A pointer to the contents in the error state.
6801         /// Reading from this pointer when `result_ok` is set is undefined.
6802         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6803 }
6804 #[repr(C)]
6805 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6806 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6808 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6809         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6810         /// `err` or `result` depending on the state of `result_ok`.
6811         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6812         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6813         pub result_ok: bool,
6814 }
6815 #[no_mangle]
6816 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6817 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6818         CResult_NodeAnnouncementInfoDecodeErrorZ {
6819                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6820                         result: Box::into_raw(Box::new(o)),
6821                 },
6822                 result_ok: true,
6823         }
6824 }
6825 #[no_mangle]
6826 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6827 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6828         CResult_NodeAnnouncementInfoDecodeErrorZ {
6829                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6830                         err: Box::into_raw(Box::new(e)),
6831                 },
6832                 result_ok: false,
6833         }
6834 }
6835 /// Checks if the given object is currently in the success state
6836 #[no_mangle]
6837 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6838         o.result_ok
6839 }
6840 #[no_mangle]
6841 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6842 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6843 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6844         fn drop(&mut self) {
6845                 if self.result_ok {
6846                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6847                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6848                         }
6849                 } else {
6850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6852                         }
6853                 }
6854         }
6855 }
6856 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6857         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6858                 let contents = if o.result_ok {
6859                         let result = unsafe { o.contents.result };
6860                         unsafe { o.contents.result = core::ptr::null_mut() };
6861                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6862                 } else {
6863                         let err = unsafe { o.contents.err };
6864                         unsafe { o.contents.err = core::ptr::null_mut(); }
6865                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6866                 };
6867                 Self {
6868                         contents,
6869                         result_ok: o.result_ok,
6870                 }
6871         }
6872 }
6873 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6874         fn clone(&self) -> Self {
6875                 if self.result_ok {
6876                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6877                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6878                         } }
6879                 } else {
6880                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6881                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6882                         } }
6883                 }
6884         }
6885 }
6886 #[no_mangle]
6887 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6888 /// but with all dynamically-allocated buffers duplicated in new buffers.
6889 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6890 #[repr(C)]
6891 /// The contents of CResult_NodeAliasDecodeErrorZ
6892 pub union CResult_NodeAliasDecodeErrorZPtr {
6893         /// A pointer to the contents in the success state.
6894         /// Reading from this pointer when `result_ok` is not set is undefined.
6895         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6896         /// A pointer to the contents in the error state.
6897         /// Reading from this pointer when `result_ok` is set is undefined.
6898         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6899 }
6900 #[repr(C)]
6901 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6902 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6904 pub struct CResult_NodeAliasDecodeErrorZ {
6905         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6906         /// `err` or `result` depending on the state of `result_ok`.
6907         pub contents: CResult_NodeAliasDecodeErrorZPtr,
6908         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6909         pub result_ok: bool,
6910 }
6911 #[no_mangle]
6912 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6913 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6914         CResult_NodeAliasDecodeErrorZ {
6915                 contents: CResult_NodeAliasDecodeErrorZPtr {
6916                         result: Box::into_raw(Box::new(o)),
6917                 },
6918                 result_ok: true,
6919         }
6920 }
6921 #[no_mangle]
6922 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6923 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6924         CResult_NodeAliasDecodeErrorZ {
6925                 contents: CResult_NodeAliasDecodeErrorZPtr {
6926                         err: Box::into_raw(Box::new(e)),
6927                 },
6928                 result_ok: false,
6929         }
6930 }
6931 /// Checks if the given object is currently in the success state
6932 #[no_mangle]
6933 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6934         o.result_ok
6935 }
6936 #[no_mangle]
6937 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6938 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6939 impl Drop for CResult_NodeAliasDecodeErrorZ {
6940         fn drop(&mut self) {
6941                 if self.result_ok {
6942                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6943                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6944                         }
6945                 } else {
6946                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6947                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6948                         }
6949                 }
6950         }
6951 }
6952 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6953         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6954                 let contents = if o.result_ok {
6955                         let result = unsafe { o.contents.result };
6956                         unsafe { o.contents.result = core::ptr::null_mut() };
6957                         CResult_NodeAliasDecodeErrorZPtr { result }
6958                 } else {
6959                         let err = unsafe { o.contents.err };
6960                         unsafe { o.contents.err = core::ptr::null_mut(); }
6961                         CResult_NodeAliasDecodeErrorZPtr { err }
6962                 };
6963                 Self {
6964                         contents,
6965                         result_ok: o.result_ok,
6966                 }
6967         }
6968 }
6969 impl Clone for CResult_NodeAliasDecodeErrorZ {
6970         fn clone(&self) -> Self {
6971                 if self.result_ok {
6972                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6973                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6974                         } }
6975                 } else {
6976                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6977                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6978                         } }
6979                 }
6980         }
6981 }
6982 #[no_mangle]
6983 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6984 /// but with all dynamically-allocated buffers duplicated in new buffers.
6985 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6986 #[repr(C)]
6987 /// The contents of CResult_NodeInfoDecodeErrorZ
6988 pub union CResult_NodeInfoDecodeErrorZPtr {
6989         /// A pointer to the contents in the success state.
6990         /// Reading from this pointer when `result_ok` is not set is undefined.
6991         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6992         /// A pointer to the contents in the error state.
6993         /// Reading from this pointer when `result_ok` is set is undefined.
6994         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6995 }
6996 #[repr(C)]
6997 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6998 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7000 pub struct CResult_NodeInfoDecodeErrorZ {
7001         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7002         /// `err` or `result` depending on the state of `result_ok`.
7003         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7004         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7005         pub result_ok: bool,
7006 }
7007 #[no_mangle]
7008 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7009 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7010         CResult_NodeInfoDecodeErrorZ {
7011                 contents: CResult_NodeInfoDecodeErrorZPtr {
7012                         result: Box::into_raw(Box::new(o)),
7013                 },
7014                 result_ok: true,
7015         }
7016 }
7017 #[no_mangle]
7018 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7019 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7020         CResult_NodeInfoDecodeErrorZ {
7021                 contents: CResult_NodeInfoDecodeErrorZPtr {
7022                         err: Box::into_raw(Box::new(e)),
7023                 },
7024                 result_ok: false,
7025         }
7026 }
7027 /// Checks if the given object is currently in the success state
7028 #[no_mangle]
7029 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7030         o.result_ok
7031 }
7032 #[no_mangle]
7033 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7034 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7035 impl Drop for CResult_NodeInfoDecodeErrorZ {
7036         fn drop(&mut self) {
7037                 if self.result_ok {
7038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7040                         }
7041                 } else {
7042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7044                         }
7045                 }
7046         }
7047 }
7048 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7049         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7050                 let contents = if o.result_ok {
7051                         let result = unsafe { o.contents.result };
7052                         unsafe { o.contents.result = core::ptr::null_mut() };
7053                         CResult_NodeInfoDecodeErrorZPtr { result }
7054                 } else {
7055                         let err = unsafe { o.contents.err };
7056                         unsafe { o.contents.err = core::ptr::null_mut(); }
7057                         CResult_NodeInfoDecodeErrorZPtr { err }
7058                 };
7059                 Self {
7060                         contents,
7061                         result_ok: o.result_ok,
7062                 }
7063         }
7064 }
7065 impl Clone for CResult_NodeInfoDecodeErrorZ {
7066         fn clone(&self) -> Self {
7067                 if self.result_ok {
7068                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7069                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7070                         } }
7071                 } else {
7072                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7074                         } }
7075                 }
7076         }
7077 }
7078 #[no_mangle]
7079 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7080 /// but with all dynamically-allocated buffers duplicated in new buffers.
7081 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7082 #[repr(C)]
7083 /// The contents of CResult_NetworkGraphDecodeErrorZ
7084 pub union CResult_NetworkGraphDecodeErrorZPtr {
7085         /// A pointer to the contents in the success state.
7086         /// Reading from this pointer when `result_ok` is not set is undefined.
7087         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7088         /// A pointer to the contents in the error state.
7089         /// Reading from this pointer when `result_ok` is set is undefined.
7090         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7091 }
7092 #[repr(C)]
7093 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7094 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_NetworkGraphDecodeErrorZ {
7097         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7098         /// `err` or `result` depending on the state of `result_ok`.
7099         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7100         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7101         pub result_ok: bool,
7102 }
7103 #[no_mangle]
7104 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7105 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7106         CResult_NetworkGraphDecodeErrorZ {
7107                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7108                         result: Box::into_raw(Box::new(o)),
7109                 },
7110                 result_ok: true,
7111         }
7112 }
7113 #[no_mangle]
7114 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7115 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7116         CResult_NetworkGraphDecodeErrorZ {
7117                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7118                         err: Box::into_raw(Box::new(e)),
7119                 },
7120                 result_ok: false,
7121         }
7122 }
7123 /// Checks if the given object is currently in the success state
7124 #[no_mangle]
7125 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7126         o.result_ok
7127 }
7128 #[no_mangle]
7129 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7130 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7131 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7132         fn drop(&mut self) {
7133                 if self.result_ok {
7134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7136                         }
7137                 } else {
7138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7140                         }
7141                 }
7142         }
7143 }
7144 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7145         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7146                 let contents = if o.result_ok {
7147                         let result = unsafe { o.contents.result };
7148                         unsafe { o.contents.result = core::ptr::null_mut() };
7149                         CResult_NetworkGraphDecodeErrorZPtr { result }
7150                 } else {
7151                         let err = unsafe { o.contents.err };
7152                         unsafe { o.contents.err = core::ptr::null_mut(); }
7153                         CResult_NetworkGraphDecodeErrorZPtr { err }
7154                 };
7155                 Self {
7156                         contents,
7157                         result_ok: o.result_ok,
7158                 }
7159         }
7160 }
7161 #[repr(C)]
7162 #[derive(Clone)]
7163 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7164 pub enum COption_CVec_NetAddressZZ {
7165         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7166         Some(crate::c_types::derived::CVec_NetAddressZ),
7167         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7168         None
7169 }
7170 impl COption_CVec_NetAddressZZ {
7171         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7172                 if let Self::None = self { false } else { true }
7173         }
7174         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7175                 !self.is_some()
7176         }
7177         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
7178                 if let Self::Some(v) = self { v } else { unreachable!() }
7179         }
7180 }
7181 #[no_mangle]
7182 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
7183 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
7184         COption_CVec_NetAddressZZ::Some(o)
7185 }
7186 #[no_mangle]
7187 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
7188 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
7189         COption_CVec_NetAddressZZ::None
7190 }
7191 #[no_mangle]
7192 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
7193 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
7194 #[no_mangle]
7195 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
7196 /// but with all dynamically-allocated buffers duplicated in new buffers.
7197 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
7198 #[repr(C)]
7199 #[derive(Clone)]
7200 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7201 pub enum COption_PaymentPreimageZ {
7202         /// When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes
7203         Some(crate::c_types::ThirtyTwoBytes),
7204         /// When we're in this state, this COption_PaymentPreimageZ contains nothing
7205         None
7206 }
7207 impl COption_PaymentPreimageZ {
7208         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7209                 if let Self::None = self { false } else { true }
7210         }
7211         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7212                 !self.is_some()
7213         }
7214         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
7215                 if let Self::Some(v) = self { v } else { unreachable!() }
7216         }
7217 }
7218 #[no_mangle]
7219 /// Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes
7220 pub extern "C" fn COption_PaymentPreimageZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentPreimageZ {
7221         COption_PaymentPreimageZ::Some(o)
7222 }
7223 #[no_mangle]
7224 /// Constructs a new COption_PaymentPreimageZ containing nothing
7225 pub extern "C" fn COption_PaymentPreimageZ_none() -> COption_PaymentPreimageZ {
7226         COption_PaymentPreimageZ::None
7227 }
7228 #[no_mangle]
7229 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
7230 pub extern "C" fn COption_PaymentPreimageZ_free(_res: COption_PaymentPreimageZ) { }
7231 #[no_mangle]
7232 /// Creates a new COption_PaymentPreimageZ which has the same data as `orig`
7233 /// but with all dynamically-allocated buffers duplicated in new buffers.
7234 pub extern "C" fn COption_PaymentPreimageZ_clone(orig: &COption_PaymentPreimageZ) -> COption_PaymentPreimageZ { Clone::clone(&orig) }
7235 #[repr(C)]
7236 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
7237 /// This corresponds to std::vector in C++
7238 pub struct CVec_HTLCOutputInCommitmentZ {
7239         /// The elements in the array.
7240         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7241         pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
7242         /// The number of elements pointed to by `data`.
7243         pub datalen: usize
7244 }
7245 impl CVec_HTLCOutputInCommitmentZ {
7246         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
7247                 if self.datalen == 0 { return Vec::new(); }
7248                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7249                 self.data = core::ptr::null_mut();
7250                 self.datalen = 0;
7251                 ret
7252         }
7253         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
7254                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7255         }
7256 }
7257 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
7258         fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
7259                 let datalen = v.len();
7260                 let data = Box::into_raw(v.into_boxed_slice());
7261                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7262         }
7263 }
7264 #[no_mangle]
7265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7266 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
7267 impl Drop for CVec_HTLCOutputInCommitmentZ {
7268         fn drop(&mut self) {
7269                 if self.datalen == 0 { return; }
7270                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7271         }
7272 }
7273 impl Clone for CVec_HTLCOutputInCommitmentZ {
7274         fn clone(&self) -> Self {
7275                 let mut res = Vec::new();
7276                 if self.datalen == 0 { return Self::from(res); }
7277                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7278                 Self::from(res)
7279         }
7280 }
7281 #[repr(C)]
7282 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
7283 /// This corresponds to std::vector in C++
7284 pub struct CVec_HTLCDescriptorZ {
7285         /// The elements in the array.
7286         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7287         pub data: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7288         /// The number of elements pointed to by `data`.
7289         pub datalen: usize
7290 }
7291 impl CVec_HTLCDescriptorZ {
7292         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::HTLCDescriptor> {
7293                 if self.datalen == 0 { return Vec::new(); }
7294                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7295                 self.data = core::ptr::null_mut();
7296                 self.datalen = 0;
7297                 ret
7298         }
7299         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::HTLCDescriptor] {
7300                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7301         }
7302 }
7303 impl From<Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7304         fn from(v: Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>) -> Self {
7305                 let datalen = v.len();
7306                 let data = Box::into_raw(v.into_boxed_slice());
7307                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7308         }
7309 }
7310 #[no_mangle]
7311 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7312 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
7313 impl Drop for CVec_HTLCDescriptorZ {
7314         fn drop(&mut self) {
7315                 if self.datalen == 0 { return; }
7316                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7317         }
7318 }
7319 impl Clone for CVec_HTLCDescriptorZ {
7320         fn clone(&self) -> Self {
7321                 let mut res = Vec::new();
7322                 if self.datalen == 0 { return Self::from(res); }
7323                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7324                 Self::from(res)
7325         }
7326 }
7327 #[repr(C)]
7328 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
7329 /// This corresponds to std::vector in C++
7330 pub struct CVec_UtxoZ {
7331         /// The elements in the array.
7332         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7333         pub data: *mut crate::lightning::events::bump_transaction::Utxo,
7334         /// The number of elements pointed to by `data`.
7335         pub datalen: usize
7336 }
7337 impl CVec_UtxoZ {
7338         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
7339                 if self.datalen == 0 { return Vec::new(); }
7340                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7341                 self.data = core::ptr::null_mut();
7342                 self.datalen = 0;
7343                 ret
7344         }
7345         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
7346                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7347         }
7348 }
7349 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
7350         fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
7351                 let datalen = v.len();
7352                 let data = Box::into_raw(v.into_boxed_slice());
7353                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7354         }
7355 }
7356 #[no_mangle]
7357 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7358 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
7359 impl Drop for CVec_UtxoZ {
7360         fn drop(&mut self) {
7361                 if self.datalen == 0 { return; }
7362                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7363         }
7364 }
7365 impl Clone for CVec_UtxoZ {
7366         fn clone(&self) -> Self {
7367                 let mut res = Vec::new();
7368                 if self.datalen == 0 { return Self::from(res); }
7369                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7370                 Self::from(res)
7371         }
7372 }
7373 #[repr(C)]
7374 #[derive(Clone)]
7375 /// An enum which can either contain a crate::c_types::TxOut or not
7376 pub enum COption_TxOutZ {
7377         /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
7378         Some(crate::c_types::TxOut),
7379         /// When we're in this state, this COption_TxOutZ contains nothing
7380         None
7381 }
7382 impl COption_TxOutZ {
7383         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7384                 if let Self::None = self { false } else { true }
7385         }
7386         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7387                 !self.is_some()
7388         }
7389         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
7390                 if let Self::Some(v) = self { v } else { unreachable!() }
7391         }
7392 }
7393 #[no_mangle]
7394 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
7395 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
7396         COption_TxOutZ::Some(o)
7397 }
7398 #[no_mangle]
7399 /// Constructs a new COption_TxOutZ containing nothing
7400 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
7401         COption_TxOutZ::None
7402 }
7403 #[no_mangle]
7404 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
7405 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
7406 #[no_mangle]
7407 /// Creates a new COption_TxOutZ which has the same data as `orig`
7408 /// but with all dynamically-allocated buffers duplicated in new buffers.
7409 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
7410 #[repr(C)]
7411 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
7412 /// This corresponds to std::vector in C++
7413 pub struct CVec_InputZ {
7414         /// The elements in the array.
7415         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7416         pub data: *mut crate::lightning::events::bump_transaction::Input,
7417         /// The number of elements pointed to by `data`.
7418         pub datalen: usize
7419 }
7420 impl CVec_InputZ {
7421         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
7422                 if self.datalen == 0 { return Vec::new(); }
7423                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7424                 self.data = core::ptr::null_mut();
7425                 self.datalen = 0;
7426                 ret
7427         }
7428         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
7429                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7430         }
7431 }
7432 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
7433         fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
7434                 let datalen = v.len();
7435                 let data = Box::into_raw(v.into_boxed_slice());
7436                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7437         }
7438 }
7439 #[no_mangle]
7440 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7441 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
7442 impl Drop for CVec_InputZ {
7443         fn drop(&mut self) {
7444                 if self.datalen == 0 { return; }
7445                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7446         }
7447 }
7448 impl Clone for CVec_InputZ {
7449         fn clone(&self) -> Self {
7450                 let mut res = Vec::new();
7451                 if self.datalen == 0 { return Self::from(res); }
7452                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7453                 Self::from(res)
7454         }
7455 }
7456 #[repr(C)]
7457 /// The contents of CResult_CoinSelectionNoneZ
7458 pub union CResult_CoinSelectionNoneZPtr {
7459         /// A pointer to the contents in the success state.
7460         /// Reading from this pointer when `result_ok` is not set is undefined.
7461         pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
7462         /// Note that this value is always NULL, as there are no contents in the Err variant
7463         pub err: *mut core::ffi::c_void,
7464 }
7465 #[repr(C)]
7466 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
7467 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
7468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7469 pub struct CResult_CoinSelectionNoneZ {
7470         /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
7471         /// `err` or `result` depending on the state of `result_ok`.
7472         pub contents: CResult_CoinSelectionNoneZPtr,
7473         /// Whether this CResult_CoinSelectionNoneZ represents a success state.
7474         pub result_ok: bool,
7475 }
7476 #[no_mangle]
7477 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
7478 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
7479         CResult_CoinSelectionNoneZ {
7480                 contents: CResult_CoinSelectionNoneZPtr {
7481                         result: Box::into_raw(Box::new(o)),
7482                 },
7483                 result_ok: true,
7484         }
7485 }
7486 #[no_mangle]
7487 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
7488 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
7489         CResult_CoinSelectionNoneZ {
7490                 contents: CResult_CoinSelectionNoneZPtr {
7491                         err: core::ptr::null_mut(),
7492                 },
7493                 result_ok: false,
7494         }
7495 }
7496 /// Checks if the given object is currently in the success state
7497 #[no_mangle]
7498 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
7499         o.result_ok
7500 }
7501 #[no_mangle]
7502 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
7503 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
7504 impl Drop for CResult_CoinSelectionNoneZ {
7505         fn drop(&mut self) {
7506                 if self.result_ok {
7507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7509                         }
7510                 } else {
7511                 }
7512         }
7513 }
7514 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
7515         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
7516                 let contents = if o.result_ok {
7517                         let result = unsafe { o.contents.result };
7518                         unsafe { o.contents.result = core::ptr::null_mut() };
7519                         CResult_CoinSelectionNoneZPtr { result }
7520                 } else {
7521                         let _ = unsafe { Box::from_raw(o.contents.err) };
7522                         o.contents.err = core::ptr::null_mut();
7523                         CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
7524                 };
7525                 Self {
7526                         contents,
7527                         result_ok: o.result_ok,
7528                 }
7529         }
7530 }
7531 impl Clone for CResult_CoinSelectionNoneZ {
7532         fn clone(&self) -> Self {
7533                 if self.result_ok {
7534                         Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
7535                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
7536                         } }
7537                 } else {
7538                         Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
7539                                 err: core::ptr::null_mut()
7540                         } }
7541                 }
7542         }
7543 }
7544 #[no_mangle]
7545 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
7546 /// but with all dynamically-allocated buffers duplicated in new buffers.
7547 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
7548 #[repr(C)]
7549 /// The contents of CResult_CVec_UtxoZNoneZ
7550 pub union CResult_CVec_UtxoZNoneZPtr {
7551         /// A pointer to the contents in the success state.
7552         /// Reading from this pointer when `result_ok` is not set is undefined.
7553         pub result: *mut crate::c_types::derived::CVec_UtxoZ,
7554         /// Note that this value is always NULL, as there are no contents in the Err variant
7555         pub err: *mut core::ffi::c_void,
7556 }
7557 #[repr(C)]
7558 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
7559 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
7560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7561 pub struct CResult_CVec_UtxoZNoneZ {
7562         /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
7563         /// `err` or `result` depending on the state of `result_ok`.
7564         pub contents: CResult_CVec_UtxoZNoneZPtr,
7565         /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
7566         pub result_ok: bool,
7567 }
7568 #[no_mangle]
7569 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
7570 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
7571         CResult_CVec_UtxoZNoneZ {
7572                 contents: CResult_CVec_UtxoZNoneZPtr {
7573                         result: Box::into_raw(Box::new(o)),
7574                 },
7575                 result_ok: true,
7576         }
7577 }
7578 #[no_mangle]
7579 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
7580 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
7581         CResult_CVec_UtxoZNoneZ {
7582                 contents: CResult_CVec_UtxoZNoneZPtr {
7583                         err: core::ptr::null_mut(),
7584                 },
7585                 result_ok: false,
7586         }
7587 }
7588 /// Checks if the given object is currently in the success state
7589 #[no_mangle]
7590 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
7591         o.result_ok
7592 }
7593 #[no_mangle]
7594 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
7595 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
7596 impl Drop for CResult_CVec_UtxoZNoneZ {
7597         fn drop(&mut self) {
7598                 if self.result_ok {
7599                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7600                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7601                         }
7602                 } else {
7603                 }
7604         }
7605 }
7606 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
7607         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
7608                 let contents = if o.result_ok {
7609                         let result = unsafe { o.contents.result };
7610                         unsafe { o.contents.result = core::ptr::null_mut() };
7611                         CResult_CVec_UtxoZNoneZPtr { result }
7612                 } else {
7613                         let _ = unsafe { Box::from_raw(o.contents.err) };
7614                         o.contents.err = core::ptr::null_mut();
7615                         CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
7616                 };
7617                 Self {
7618                         contents,
7619                         result_ok: o.result_ok,
7620                 }
7621         }
7622 }
7623 impl Clone for CResult_CVec_UtxoZNoneZ {
7624         fn clone(&self) -> Self {
7625                 if self.result_ok {
7626                         Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
7627                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
7628                         } }
7629                 } else {
7630                         Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
7631                                 err: core::ptr::null_mut()
7632                         } }
7633                 }
7634         }
7635 }
7636 #[no_mangle]
7637 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
7638 /// but with all dynamically-allocated buffers duplicated in new buffers.
7639 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
7640 #[repr(C)]
7641 #[derive(Clone)]
7642 /// An enum which can either contain a u16 or not
7643 pub enum COption_u16Z {
7644         /// When we're in this state, this COption_u16Z contains a u16
7645         Some(u16),
7646         /// When we're in this state, this COption_u16Z contains nothing
7647         None
7648 }
7649 impl COption_u16Z {
7650         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7651                 if let Self::None = self { false } else { true }
7652         }
7653         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7654                 !self.is_some()
7655         }
7656         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7657                 if let Self::Some(v) = self { v } else { unreachable!() }
7658         }
7659 }
7660 #[no_mangle]
7661 /// Constructs a new COption_u16Z containing a u16
7662 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7663         COption_u16Z::Some(o)
7664 }
7665 #[no_mangle]
7666 /// Constructs a new COption_u16Z containing nothing
7667 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7668         COption_u16Z::None
7669 }
7670 #[no_mangle]
7671 /// Frees any resources associated with the u16, if we are in the Some state
7672 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7673 #[no_mangle]
7674 /// Creates a new COption_u16Z which has the same data as `orig`
7675 /// but with all dynamically-allocated buffers duplicated in new buffers.
7676 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7677 #[repr(C)]
7678 #[derive(Clone)]
7679 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
7680 pub enum COption_ChannelShutdownStateZ {
7681         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
7682         Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
7683         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
7684         None
7685 }
7686 impl COption_ChannelShutdownStateZ {
7687         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7688                 if let Self::None = self { false } else { true }
7689         }
7690         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7691                 !self.is_some()
7692         }
7693         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
7694                 if let Self::Some(v) = self { v } else { unreachable!() }
7695         }
7696 }
7697 #[no_mangle]
7698 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
7699 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
7700         COption_ChannelShutdownStateZ::Some(o)
7701 }
7702 #[no_mangle]
7703 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
7704 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
7705         COption_ChannelShutdownStateZ::None
7706 }
7707 #[no_mangle]
7708 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
7709 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
7710 #[no_mangle]
7711 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
7712 /// but with all dynamically-allocated buffers duplicated in new buffers.
7713 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
7714 #[repr(C)]
7715 #[derive(Clone)]
7716 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7717 pub enum COption_PaymentHashZ {
7718         /// When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes
7719         Some(crate::c_types::ThirtyTwoBytes),
7720         /// When we're in this state, this COption_PaymentHashZ contains nothing
7721         None
7722 }
7723 impl COption_PaymentHashZ {
7724         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7725                 if let Self::None = self { false } else { true }
7726         }
7727         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7728                 !self.is_some()
7729         }
7730         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
7731                 if let Self::Some(v) = self { v } else { unreachable!() }
7732         }
7733 }
7734 #[no_mangle]
7735 /// Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes
7736 pub extern "C" fn COption_PaymentHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentHashZ {
7737         COption_PaymentHashZ::Some(o)
7738 }
7739 #[no_mangle]
7740 /// Constructs a new COption_PaymentHashZ containing nothing
7741 pub extern "C" fn COption_PaymentHashZ_none() -> COption_PaymentHashZ {
7742         COption_PaymentHashZ::None
7743 }
7744 #[no_mangle]
7745 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
7746 pub extern "C" fn COption_PaymentHashZ_free(_res: COption_PaymentHashZ) { }
7747 #[no_mangle]
7748 /// Creates a new COption_PaymentHashZ which has the same data as `orig`
7749 /// but with all dynamically-allocated buffers duplicated in new buffers.
7750 pub extern "C" fn COption_PaymentHashZ_clone(orig: &COption_PaymentHashZ) -> COption_PaymentHashZ { Clone::clone(&orig) }
7751 #[repr(C)]
7752 /// The contents of CResult__u832APIErrorZ
7753 pub union CResult__u832APIErrorZPtr {
7754         /// A pointer to the contents in the success state.
7755         /// Reading from this pointer when `result_ok` is not set is undefined.
7756         pub result: *mut crate::c_types::ThirtyTwoBytes,
7757         /// A pointer to the contents in the error state.
7758         /// Reading from this pointer when `result_ok` is set is undefined.
7759         pub err: *mut crate::lightning::util::errors::APIError,
7760 }
7761 #[repr(C)]
7762 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7763 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7765 pub struct CResult__u832APIErrorZ {
7766         /// The contents of this CResult__u832APIErrorZ, accessible via either
7767         /// `err` or `result` depending on the state of `result_ok`.
7768         pub contents: CResult__u832APIErrorZPtr,
7769         /// Whether this CResult__u832APIErrorZ represents a success state.
7770         pub result_ok: bool,
7771 }
7772 #[no_mangle]
7773 /// Creates a new CResult__u832APIErrorZ in the success state.
7774 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7775         CResult__u832APIErrorZ {
7776                 contents: CResult__u832APIErrorZPtr {
7777                         result: Box::into_raw(Box::new(o)),
7778                 },
7779                 result_ok: true,
7780         }
7781 }
7782 #[no_mangle]
7783 /// Creates a new CResult__u832APIErrorZ in the error state.
7784 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7785         CResult__u832APIErrorZ {
7786                 contents: CResult__u832APIErrorZPtr {
7787                         err: Box::into_raw(Box::new(e)),
7788                 },
7789                 result_ok: false,
7790         }
7791 }
7792 /// Checks if the given object is currently in the success state
7793 #[no_mangle]
7794 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7795         o.result_ok
7796 }
7797 #[no_mangle]
7798 /// Frees any resources used by the CResult__u832APIErrorZ.
7799 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7800 impl Drop for CResult__u832APIErrorZ {
7801         fn drop(&mut self) {
7802                 if self.result_ok {
7803                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7804                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7805                         }
7806                 } else {
7807                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7808                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7809                         }
7810                 }
7811         }
7812 }
7813 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7814         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7815                 let contents = if o.result_ok {
7816                         let result = unsafe { o.contents.result };
7817                         unsafe { o.contents.result = core::ptr::null_mut() };
7818                         CResult__u832APIErrorZPtr { result }
7819                 } else {
7820                         let err = unsafe { o.contents.err };
7821                         unsafe { o.contents.err = core::ptr::null_mut(); }
7822                         CResult__u832APIErrorZPtr { err }
7823                 };
7824                 Self {
7825                         contents,
7826                         result_ok: o.result_ok,
7827                 }
7828         }
7829 }
7830 impl Clone for CResult__u832APIErrorZ {
7831         fn clone(&self) -> Self {
7832                 if self.result_ok {
7833                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7834                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7835                         } }
7836                 } else {
7837                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7838                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7839                         } }
7840                 }
7841         }
7842 }
7843 #[no_mangle]
7844 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7845 /// but with all dynamically-allocated buffers duplicated in new buffers.
7846 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7847 #[repr(C)]
7848 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
7849 /// This corresponds to std::vector in C++
7850 pub struct CVec_RecentPaymentDetailsZ {
7851         /// The elements in the array.
7852         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7853         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
7854         /// The number of elements pointed to by `data`.
7855         pub datalen: usize
7856 }
7857 impl CVec_RecentPaymentDetailsZ {
7858         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
7859                 if self.datalen == 0 { return Vec::new(); }
7860                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7861                 self.data = core::ptr::null_mut();
7862                 self.datalen = 0;
7863                 ret
7864         }
7865         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
7866                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7867         }
7868 }
7869 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
7870         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
7871                 let datalen = v.len();
7872                 let data = Box::into_raw(v.into_boxed_slice());
7873                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7874         }
7875 }
7876 #[no_mangle]
7877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7878 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
7879 impl Drop for CVec_RecentPaymentDetailsZ {
7880         fn drop(&mut self) {
7881                 if self.datalen == 0 { return; }
7882                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7883         }
7884 }
7885 #[repr(C)]
7886 /// The contents of CResult_NonePaymentSendFailureZ
7887 pub union CResult_NonePaymentSendFailureZPtr {
7888         /// Note that this value is always NULL, as there are no contents in the OK variant
7889         pub result: *mut core::ffi::c_void,
7890         /// A pointer to the contents in the error state.
7891         /// Reading from this pointer when `result_ok` is set is undefined.
7892         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
7893 }
7894 #[repr(C)]
7895 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7896 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
7897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7898 pub struct CResult_NonePaymentSendFailureZ {
7899         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7900         /// `err` or `result` depending on the state of `result_ok`.
7901         pub contents: CResult_NonePaymentSendFailureZPtr,
7902         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7903         pub result_ok: bool,
7904 }
7905 #[no_mangle]
7906 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7907 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7908         CResult_NonePaymentSendFailureZ {
7909                 contents: CResult_NonePaymentSendFailureZPtr {
7910                         result: core::ptr::null_mut(),
7911                 },
7912                 result_ok: true,
7913         }
7914 }
7915 #[no_mangle]
7916 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7917 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7918         CResult_NonePaymentSendFailureZ {
7919                 contents: CResult_NonePaymentSendFailureZPtr {
7920                         err: Box::into_raw(Box::new(e)),
7921                 },
7922                 result_ok: false,
7923         }
7924 }
7925 /// Checks if the given object is currently in the success state
7926 #[no_mangle]
7927 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7928         o.result_ok
7929 }
7930 #[no_mangle]
7931 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7932 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7933 impl Drop for CResult_NonePaymentSendFailureZ {
7934         fn drop(&mut self) {
7935                 if self.result_ok {
7936                 } else {
7937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7939                         }
7940                 }
7941         }
7942 }
7943 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7944         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
7945                 let contents = if o.result_ok {
7946                         let _ = unsafe { Box::from_raw(o.contents.result) };
7947                         o.contents.result = core::ptr::null_mut();
7948                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7949                 } else {
7950                         let err = unsafe { o.contents.err };
7951                         unsafe { o.contents.err = core::ptr::null_mut(); }
7952                         CResult_NonePaymentSendFailureZPtr { err }
7953                 };
7954                 Self {
7955                         contents,
7956                         result_ok: o.result_ok,
7957                 }
7958         }
7959 }
7960 impl Clone for CResult_NonePaymentSendFailureZ {
7961         fn clone(&self) -> Self {
7962                 if self.result_ok {
7963                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7964                                 result: core::ptr::null_mut()
7965                         } }
7966                 } else {
7967                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7969                         } }
7970                 }
7971         }
7972 }
7973 #[no_mangle]
7974 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7975 /// but with all dynamically-allocated buffers duplicated in new buffers.
7976 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7977 #[repr(C)]
7978 /// The contents of CResult_NoneRetryableSendFailureZ
7979 pub union CResult_NoneRetryableSendFailureZPtr {
7980         /// Note that this value is always NULL, as there are no contents in the OK variant
7981         pub result: *mut core::ffi::c_void,
7982         /// A pointer to the contents in the error state.
7983         /// Reading from this pointer when `result_ok` is set is undefined.
7984         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
7985 }
7986 #[repr(C)]
7987 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
7988 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
7989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7990 pub struct CResult_NoneRetryableSendFailureZ {
7991         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
7992         /// `err` or `result` depending on the state of `result_ok`.
7993         pub contents: CResult_NoneRetryableSendFailureZPtr,
7994         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
7995         pub result_ok: bool,
7996 }
7997 #[no_mangle]
7998 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
7999 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8000         CResult_NoneRetryableSendFailureZ {
8001                 contents: CResult_NoneRetryableSendFailureZPtr {
8002                         result: core::ptr::null_mut(),
8003                 },
8004                 result_ok: true,
8005         }
8006 }
8007 #[no_mangle]
8008 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8009 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8010         CResult_NoneRetryableSendFailureZ {
8011                 contents: CResult_NoneRetryableSendFailureZPtr {
8012                         err: Box::into_raw(Box::new(e)),
8013                 },
8014                 result_ok: false,
8015         }
8016 }
8017 /// Checks if the given object is currently in the success state
8018 #[no_mangle]
8019 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8020         o.result_ok
8021 }
8022 #[no_mangle]
8023 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8024 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8025 impl Drop for CResult_NoneRetryableSendFailureZ {
8026         fn drop(&mut self) {
8027                 if self.result_ok {
8028                 } else {
8029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8031                         }
8032                 }
8033         }
8034 }
8035 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8036         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8037                 let contents = if o.result_ok {
8038                         let _ = unsafe { Box::from_raw(o.contents.result) };
8039                         o.contents.result = core::ptr::null_mut();
8040                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8041                 } else {
8042                         let err = unsafe { o.contents.err };
8043                         unsafe { o.contents.err = core::ptr::null_mut(); }
8044                         CResult_NoneRetryableSendFailureZPtr { err }
8045                 };
8046                 Self {
8047                         contents,
8048                         result_ok: o.result_ok,
8049                 }
8050         }
8051 }
8052 impl Clone for CResult_NoneRetryableSendFailureZ {
8053         fn clone(&self) -> Self {
8054                 if self.result_ok {
8055                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8056                                 result: core::ptr::null_mut()
8057                         } }
8058                 } else {
8059                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8060                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8061                         } }
8062                 }
8063         }
8064 }
8065 #[no_mangle]
8066 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8067 /// but with all dynamically-allocated buffers duplicated in new buffers.
8068 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8069 #[repr(C)]
8070 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8071 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8072         /// A pointer to the contents in the success state.
8073         /// Reading from this pointer when `result_ok` is not set is undefined.
8074         pub result: *mut crate::c_types::ThirtyTwoBytes,
8075         /// A pointer to the contents in the error state.
8076         /// Reading from this pointer when `result_ok` is set is undefined.
8077         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8078 }
8079 #[repr(C)]
8080 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8081 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8083 pub struct CResult_PaymentHashPaymentSendFailureZ {
8084         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8085         /// `err` or `result` depending on the state of `result_ok`.
8086         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8087         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8088         pub result_ok: bool,
8089 }
8090 #[no_mangle]
8091 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8092 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8093         CResult_PaymentHashPaymentSendFailureZ {
8094                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8095                         result: Box::into_raw(Box::new(o)),
8096                 },
8097                 result_ok: true,
8098         }
8099 }
8100 #[no_mangle]
8101 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8102 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8103         CResult_PaymentHashPaymentSendFailureZ {
8104                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8105                         err: Box::into_raw(Box::new(e)),
8106                 },
8107                 result_ok: false,
8108         }
8109 }
8110 /// Checks if the given object is currently in the success state
8111 #[no_mangle]
8112 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8113         o.result_ok
8114 }
8115 #[no_mangle]
8116 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8117 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8118 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8119         fn drop(&mut self) {
8120                 if self.result_ok {
8121                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8122                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8123                         }
8124                 } else {
8125                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8126                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8127                         }
8128                 }
8129         }
8130 }
8131 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8132         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8133                 let contents = if o.result_ok {
8134                         let result = unsafe { o.contents.result };
8135                         unsafe { o.contents.result = core::ptr::null_mut() };
8136                         CResult_PaymentHashPaymentSendFailureZPtr { result }
8137                 } else {
8138                         let err = unsafe { o.contents.err };
8139                         unsafe { o.contents.err = core::ptr::null_mut(); }
8140                         CResult_PaymentHashPaymentSendFailureZPtr { err }
8141                 };
8142                 Self {
8143                         contents,
8144                         result_ok: o.result_ok,
8145                 }
8146         }
8147 }
8148 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8149         fn clone(&self) -> Self {
8150                 if self.result_ok {
8151                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8152                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8153                         } }
8154                 } else {
8155                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8156                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8157                         } }
8158                 }
8159         }
8160 }
8161 #[no_mangle]
8162 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8163 /// but with all dynamically-allocated buffers duplicated in new buffers.
8164 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8165 #[repr(C)]
8166 /// The contents of CResult_PaymentHashRetryableSendFailureZ
8167 pub union CResult_PaymentHashRetryableSendFailureZPtr {
8168         /// A pointer to the contents in the success state.
8169         /// Reading from this pointer when `result_ok` is not set is undefined.
8170         pub result: *mut crate::c_types::ThirtyTwoBytes,
8171         /// A pointer to the contents in the error state.
8172         /// Reading from this pointer when `result_ok` is set is undefined.
8173         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8174 }
8175 #[repr(C)]
8176 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8177 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8179 pub struct CResult_PaymentHashRetryableSendFailureZ {
8180         /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8181         /// `err` or `result` depending on the state of `result_ok`.
8182         pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
8183         /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8184         pub result_ok: bool,
8185 }
8186 #[no_mangle]
8187 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
8188 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
8189         CResult_PaymentHashRetryableSendFailureZ {
8190                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8191                         result: Box::into_raw(Box::new(o)),
8192                 },
8193                 result_ok: true,
8194         }
8195 }
8196 #[no_mangle]
8197 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
8198 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
8199         CResult_PaymentHashRetryableSendFailureZ {
8200                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8201                         err: Box::into_raw(Box::new(e)),
8202                 },
8203                 result_ok: false,
8204         }
8205 }
8206 /// Checks if the given object is currently in the success state
8207 #[no_mangle]
8208 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
8209         o.result_ok
8210 }
8211 #[no_mangle]
8212 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
8213 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
8214 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
8215         fn drop(&mut self) {
8216                 if self.result_ok {
8217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8219                         }
8220                 } else {
8221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8223                         }
8224                 }
8225         }
8226 }
8227 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
8228         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8229                 let contents = if o.result_ok {
8230                         let result = unsafe { o.contents.result };
8231                         unsafe { o.contents.result = core::ptr::null_mut() };
8232                         CResult_PaymentHashRetryableSendFailureZPtr { result }
8233                 } else {
8234                         let err = unsafe { o.contents.err };
8235                         unsafe { o.contents.err = core::ptr::null_mut(); }
8236                         CResult_PaymentHashRetryableSendFailureZPtr { err }
8237                 };
8238                 Self {
8239                         contents,
8240                         result_ok: o.result_ok,
8241                 }
8242         }
8243 }
8244 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
8245         fn clone(&self) -> Self {
8246                 if self.result_ok {
8247                         Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8248                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8249                         } }
8250                 } else {
8251                         Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8252                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8253                         } }
8254                 }
8255         }
8256 }
8257 #[no_mangle]
8258 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
8259 /// but with all dynamically-allocated buffers duplicated in new buffers.
8260 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
8261 #[repr(C)]
8262 /// A tuple of 2 elements. See the individual fields for the types contained.
8263 pub struct C2Tuple_PaymentHashPaymentIdZ {
8264         /// The element at position 0
8265         pub a: crate::c_types::ThirtyTwoBytes,
8266         /// The element at position 1
8267         pub b: crate::c_types::ThirtyTwoBytes,
8268 }
8269 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8270         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8271                 Self {
8272                         a: tup.0,
8273                         b: tup.1,
8274                 }
8275         }
8276 }
8277 impl C2Tuple_PaymentHashPaymentIdZ {
8278         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8279                 (self.a, self.b)
8280         }
8281 }
8282 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8283         fn clone(&self) -> Self {
8284                 Self {
8285                         a: Clone::clone(&self.a),
8286                         b: Clone::clone(&self.b),
8287                 }
8288         }
8289 }
8290 #[no_mangle]
8291 /// Creates a new tuple which has the same data as `orig`
8292 /// but with all dynamically-allocated buffers duplicated in new buffers.
8293 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8294 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8295 #[no_mangle]
8296 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8297         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8298 }
8299
8300 #[no_mangle]
8301 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8302 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8303 #[repr(C)]
8304 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8305 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8306         /// A pointer to the contents in the success state.
8307         /// Reading from this pointer when `result_ok` is not set is undefined.
8308         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8309         /// A pointer to the contents in the error state.
8310         /// Reading from this pointer when `result_ok` is set is undefined.
8311         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8312 }
8313 #[repr(C)]
8314 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8315 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8316 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8317 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8318         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8319         /// `err` or `result` depending on the state of `result_ok`.
8320         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8321         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8322         pub result_ok: bool,
8323 }
8324 #[no_mangle]
8325 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8326 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8327         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8328                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8329                         result: Box::into_raw(Box::new(o)),
8330                 },
8331                 result_ok: true,
8332         }
8333 }
8334 #[no_mangle]
8335 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8336 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8337         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8338                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8339                         err: Box::into_raw(Box::new(e)),
8340                 },
8341                 result_ok: false,
8342         }
8343 }
8344 /// Checks if the given object is currently in the success state
8345 #[no_mangle]
8346 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8347         o.result_ok
8348 }
8349 #[no_mangle]
8350 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8351 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8352 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8353         fn drop(&mut self) {
8354                 if self.result_ok {
8355                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8356                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8357                         }
8358                 } else {
8359                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8360                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8361                         }
8362                 }
8363         }
8364 }
8365 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8366         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8367                 let contents = if o.result_ok {
8368                         let result = unsafe { o.contents.result };
8369                         unsafe { o.contents.result = core::ptr::null_mut() };
8370                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8371                 } else {
8372                         let err = unsafe { o.contents.err };
8373                         unsafe { o.contents.err = core::ptr::null_mut(); }
8374                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8375                 };
8376                 Self {
8377                         contents,
8378                         result_ok: o.result_ok,
8379                 }
8380         }
8381 }
8382 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8383         fn clone(&self) -> Self {
8384                 if self.result_ok {
8385                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8386                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8387                         } }
8388                 } else {
8389                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8390                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8391                         } }
8392                 }
8393         }
8394 }
8395 #[no_mangle]
8396 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8397 /// but with all dynamically-allocated buffers duplicated in new buffers.
8398 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8399 #[repr(C)]
8400 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8401 /// This corresponds to std::vector in C++
8402 pub struct CVec_ThirtyTwoBytesZ {
8403         /// The elements in the array.
8404         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8405         pub data: *mut crate::c_types::ThirtyTwoBytes,
8406         /// The number of elements pointed to by `data`.
8407         pub datalen: usize
8408 }
8409 impl CVec_ThirtyTwoBytesZ {
8410         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8411                 if self.datalen == 0 { return Vec::new(); }
8412                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8413                 self.data = core::ptr::null_mut();
8414                 self.datalen = 0;
8415                 ret
8416         }
8417         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8418                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8419         }
8420 }
8421 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8422         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8423                 let datalen = v.len();
8424                 let data = Box::into_raw(v.into_boxed_slice());
8425                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8426         }
8427 }
8428 #[no_mangle]
8429 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8430 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8431 impl Drop for CVec_ThirtyTwoBytesZ {
8432         fn drop(&mut self) {
8433                 if self.datalen == 0 { return; }
8434                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8435         }
8436 }
8437 impl Clone for CVec_ThirtyTwoBytesZ {
8438         fn clone(&self) -> Self {
8439                 let mut res = Vec::new();
8440                 if self.datalen == 0 { return Self::from(res); }
8441                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8442                 Self::from(res)
8443         }
8444 }
8445 #[repr(C)]
8446 /// A tuple of 2 elements. See the individual fields for the types contained.
8447 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8448         /// The element at position 0
8449         pub a: crate::c_types::ThirtyTwoBytes,
8450         /// The element at position 1
8451         pub b: crate::c_types::ThirtyTwoBytes,
8452 }
8453 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8454         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8455                 Self {
8456                         a: tup.0,
8457                         b: tup.1,
8458                 }
8459         }
8460 }
8461 impl C2Tuple_PaymentHashPaymentSecretZ {
8462         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8463                 (self.a, self.b)
8464         }
8465 }
8466 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8467         fn clone(&self) -> Self {
8468                 Self {
8469                         a: Clone::clone(&self.a),
8470                         b: Clone::clone(&self.b),
8471                 }
8472         }
8473 }
8474 #[no_mangle]
8475 /// Creates a new tuple which has the same data as `orig`
8476 /// but with all dynamically-allocated buffers duplicated in new buffers.
8477 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8478 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8479 #[no_mangle]
8480 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8481         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8482 }
8483
8484 #[no_mangle]
8485 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8486 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8487 #[repr(C)]
8488 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8489 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8490         /// A pointer to the contents in the success state.
8491         /// Reading from this pointer when `result_ok` is not set is undefined.
8492         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8493         /// Note that this value is always NULL, as there are no contents in the Err variant
8494         pub err: *mut core::ffi::c_void,
8495 }
8496 #[repr(C)]
8497 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8498 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8500 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8501         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8502         /// `err` or `result` depending on the state of `result_ok`.
8503         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8504         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8505         pub result_ok: bool,
8506 }
8507 #[no_mangle]
8508 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8509 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8510         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8511                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8512                         result: Box::into_raw(Box::new(o)),
8513                 },
8514                 result_ok: true,
8515         }
8516 }
8517 #[no_mangle]
8518 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8519 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8520         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8521                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8522                         err: core::ptr::null_mut(),
8523                 },
8524                 result_ok: false,
8525         }
8526 }
8527 /// Checks if the given object is currently in the success state
8528 #[no_mangle]
8529 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8530         o.result_ok
8531 }
8532 #[no_mangle]
8533 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8534 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8535 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8536         fn drop(&mut self) {
8537                 if self.result_ok {
8538                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8539                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8540                         }
8541                 } else {
8542                 }
8543         }
8544 }
8545 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8546         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8547                 let contents = if o.result_ok {
8548                         let result = unsafe { o.contents.result };
8549                         unsafe { o.contents.result = core::ptr::null_mut() };
8550                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8551                 } else {
8552                         let _ = unsafe { Box::from_raw(o.contents.err) };
8553                         o.contents.err = core::ptr::null_mut();
8554                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8555                 };
8556                 Self {
8557                         contents,
8558                         result_ok: o.result_ok,
8559                 }
8560         }
8561 }
8562 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8563         fn clone(&self) -> Self {
8564                 if self.result_ok {
8565                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8566                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8567                         } }
8568                 } else {
8569                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8570                                 err: core::ptr::null_mut()
8571                         } }
8572                 }
8573         }
8574 }
8575 #[no_mangle]
8576 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8577 /// but with all dynamically-allocated buffers duplicated in new buffers.
8578 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8579 #[repr(C)]
8580 /// The contents of CResult_PaymentSecretNoneZ
8581 pub union CResult_PaymentSecretNoneZPtr {
8582         /// A pointer to the contents in the success state.
8583         /// Reading from this pointer when `result_ok` is not set is undefined.
8584         pub result: *mut crate::c_types::ThirtyTwoBytes,
8585         /// Note that this value is always NULL, as there are no contents in the Err variant
8586         pub err: *mut core::ffi::c_void,
8587 }
8588 #[repr(C)]
8589 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8590 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8592 pub struct CResult_PaymentSecretNoneZ {
8593         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8594         /// `err` or `result` depending on the state of `result_ok`.
8595         pub contents: CResult_PaymentSecretNoneZPtr,
8596         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8597         pub result_ok: bool,
8598 }
8599 #[no_mangle]
8600 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8601 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8602         CResult_PaymentSecretNoneZ {
8603                 contents: CResult_PaymentSecretNoneZPtr {
8604                         result: Box::into_raw(Box::new(o)),
8605                 },
8606                 result_ok: true,
8607         }
8608 }
8609 #[no_mangle]
8610 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8611 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8612         CResult_PaymentSecretNoneZ {
8613                 contents: CResult_PaymentSecretNoneZPtr {
8614                         err: core::ptr::null_mut(),
8615                 },
8616                 result_ok: false,
8617         }
8618 }
8619 /// Checks if the given object is currently in the success state
8620 #[no_mangle]
8621 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8622         o.result_ok
8623 }
8624 #[no_mangle]
8625 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8626 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8627 impl Drop for CResult_PaymentSecretNoneZ {
8628         fn drop(&mut self) {
8629                 if self.result_ok {
8630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8632                         }
8633                 } else {
8634                 }
8635         }
8636 }
8637 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8638         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8639                 let contents = if o.result_ok {
8640                         let result = unsafe { o.contents.result };
8641                         unsafe { o.contents.result = core::ptr::null_mut() };
8642                         CResult_PaymentSecretNoneZPtr { result }
8643                 } else {
8644                         let _ = unsafe { Box::from_raw(o.contents.err) };
8645                         o.contents.err = core::ptr::null_mut();
8646                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8647                 };
8648                 Self {
8649                         contents,
8650                         result_ok: o.result_ok,
8651                 }
8652         }
8653 }
8654 impl Clone for CResult_PaymentSecretNoneZ {
8655         fn clone(&self) -> Self {
8656                 if self.result_ok {
8657                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8658                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8659                         } }
8660                 } else {
8661                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8662                                 err: core::ptr::null_mut()
8663                         } }
8664                 }
8665         }
8666 }
8667 #[no_mangle]
8668 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8669 /// but with all dynamically-allocated buffers duplicated in new buffers.
8670 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8671 #[repr(C)]
8672 /// The contents of CResult_PaymentPreimageAPIErrorZ
8673 pub union CResult_PaymentPreimageAPIErrorZPtr {
8674         /// A pointer to the contents in the success state.
8675         /// Reading from this pointer when `result_ok` is not set is undefined.
8676         pub result: *mut crate::c_types::ThirtyTwoBytes,
8677         /// A pointer to the contents in the error state.
8678         /// Reading from this pointer when `result_ok` is set is undefined.
8679         pub err: *mut crate::lightning::util::errors::APIError,
8680 }
8681 #[repr(C)]
8682 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8683 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8685 pub struct CResult_PaymentPreimageAPIErrorZ {
8686         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8687         /// `err` or `result` depending on the state of `result_ok`.
8688         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8689         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8690         pub result_ok: bool,
8691 }
8692 #[no_mangle]
8693 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8694 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8695         CResult_PaymentPreimageAPIErrorZ {
8696                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8697                         result: Box::into_raw(Box::new(o)),
8698                 },
8699                 result_ok: true,
8700         }
8701 }
8702 #[no_mangle]
8703 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8704 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8705         CResult_PaymentPreimageAPIErrorZ {
8706                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8707                         err: Box::into_raw(Box::new(e)),
8708                 },
8709                 result_ok: false,
8710         }
8711 }
8712 /// Checks if the given object is currently in the success state
8713 #[no_mangle]
8714 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8715         o.result_ok
8716 }
8717 #[no_mangle]
8718 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8719 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8720 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8721         fn drop(&mut self) {
8722                 if self.result_ok {
8723                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8724                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8725                         }
8726                 } else {
8727                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8728                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8729                         }
8730                 }
8731         }
8732 }
8733 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8734         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8735                 let contents = if o.result_ok {
8736                         let result = unsafe { o.contents.result };
8737                         unsafe { o.contents.result = core::ptr::null_mut() };
8738                         CResult_PaymentPreimageAPIErrorZPtr { result }
8739                 } else {
8740                         let err = unsafe { o.contents.err };
8741                         unsafe { o.contents.err = core::ptr::null_mut(); }
8742                         CResult_PaymentPreimageAPIErrorZPtr { err }
8743                 };
8744                 Self {
8745                         contents,
8746                         result_ok: o.result_ok,
8747                 }
8748         }
8749 }
8750 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8751         fn clone(&self) -> Self {
8752                 if self.result_ok {
8753                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8754                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8755                         } }
8756                 } else {
8757                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8758                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8759                         } }
8760                 }
8761         }
8762 }
8763 #[no_mangle]
8764 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8765 /// but with all dynamically-allocated buffers duplicated in new buffers.
8766 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8767 #[repr(C)]
8768 #[derive(Clone)]
8769 /// An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not
8770 pub enum COption_CVec_ChainHashZZ {
8771         /// When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ
8772         Some(crate::c_types::derived::CVec_ChainHashZ),
8773         /// When we're in this state, this COption_CVec_ChainHashZZ contains nothing
8774         None
8775 }
8776 impl COption_CVec_ChainHashZZ {
8777         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8778                 if let Self::None = self { false } else { true }
8779         }
8780         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8781                 !self.is_some()
8782         }
8783         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ChainHashZ {
8784                 if let Self::Some(v) = self { v } else { unreachable!() }
8785         }
8786 }
8787 #[no_mangle]
8788 /// Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ
8789 pub extern "C" fn COption_CVec_ChainHashZZ_some(o: crate::c_types::derived::CVec_ChainHashZ) -> COption_CVec_ChainHashZZ {
8790         COption_CVec_ChainHashZZ::Some(o)
8791 }
8792 #[no_mangle]
8793 /// Constructs a new COption_CVec_ChainHashZZ containing nothing
8794 pub extern "C" fn COption_CVec_ChainHashZZ_none() -> COption_CVec_ChainHashZZ {
8795         COption_CVec_ChainHashZZ::None
8796 }
8797 #[no_mangle]
8798 /// Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state
8799 pub extern "C" fn COption_CVec_ChainHashZZ_free(_res: COption_CVec_ChainHashZZ) { }
8800 #[no_mangle]
8801 /// Creates a new COption_CVec_ChainHashZZ which has the same data as `orig`
8802 /// but with all dynamically-allocated buffers duplicated in new buffers.
8803 pub extern "C" fn COption_CVec_ChainHashZZ_clone(orig: &COption_CVec_ChainHashZZ) -> COption_CVec_ChainHashZZ { Clone::clone(&orig) }
8804 #[repr(C)]
8805 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8806 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8807         /// A pointer to the contents in the success state.
8808         /// Reading from this pointer when `result_ok` is not set is undefined.
8809         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8810         /// A pointer to the contents in the error state.
8811         /// Reading from this pointer when `result_ok` is set is undefined.
8812         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8813 }
8814 #[repr(C)]
8815 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8816 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8817 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8818 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8819         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8820         /// `err` or `result` depending on the state of `result_ok`.
8821         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8822         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8823         pub result_ok: bool,
8824 }
8825 #[no_mangle]
8826 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8827 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8828         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8829                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8830                         result: Box::into_raw(Box::new(o)),
8831                 },
8832                 result_ok: true,
8833         }
8834 }
8835 #[no_mangle]
8836 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8837 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8838         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8839                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8840                         err: Box::into_raw(Box::new(e)),
8841                 },
8842                 result_ok: false,
8843         }
8844 }
8845 /// Checks if the given object is currently in the success state
8846 #[no_mangle]
8847 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8848         o.result_ok
8849 }
8850 #[no_mangle]
8851 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8852 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8853 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8854         fn drop(&mut self) {
8855                 if self.result_ok {
8856                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8857                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8858                         }
8859                 } else {
8860                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8861                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8862                         }
8863                 }
8864         }
8865 }
8866 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8867         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8868                 let contents = if o.result_ok {
8869                         let result = unsafe { o.contents.result };
8870                         unsafe { o.contents.result = core::ptr::null_mut() };
8871                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8872                 } else {
8873                         let err = unsafe { o.contents.err };
8874                         unsafe { o.contents.err = core::ptr::null_mut(); }
8875                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8876                 };
8877                 Self {
8878                         contents,
8879                         result_ok: o.result_ok,
8880                 }
8881         }
8882 }
8883 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8884         fn clone(&self) -> Self {
8885                 if self.result_ok {
8886                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8887                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8888                         } }
8889                 } else {
8890                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8891                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8892                         } }
8893                 }
8894         }
8895 }
8896 #[no_mangle]
8897 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8898 /// but with all dynamically-allocated buffers duplicated in new buffers.
8899 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8900 #[repr(C)]
8901 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8902 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8903         /// A pointer to the contents in the success state.
8904         /// Reading from this pointer when `result_ok` is not set is undefined.
8905         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8906         /// A pointer to the contents in the error state.
8907         /// Reading from this pointer when `result_ok` is set is undefined.
8908         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8909 }
8910 #[repr(C)]
8911 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8912 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8913 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8914 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8915         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8916         /// `err` or `result` depending on the state of `result_ok`.
8917         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8918         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8919         pub result_ok: bool,
8920 }
8921 #[no_mangle]
8922 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8923 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8924         CResult_ChannelCounterpartyDecodeErrorZ {
8925                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8926                         result: Box::into_raw(Box::new(o)),
8927                 },
8928                 result_ok: true,
8929         }
8930 }
8931 #[no_mangle]
8932 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8933 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8934         CResult_ChannelCounterpartyDecodeErrorZ {
8935                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8936                         err: Box::into_raw(Box::new(e)),
8937                 },
8938                 result_ok: false,
8939         }
8940 }
8941 /// Checks if the given object is currently in the success state
8942 #[no_mangle]
8943 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8944         o.result_ok
8945 }
8946 #[no_mangle]
8947 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8948 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8949 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8950         fn drop(&mut self) {
8951                 if self.result_ok {
8952                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8953                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8954                         }
8955                 } else {
8956                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8957                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8958                         }
8959                 }
8960         }
8961 }
8962 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8963         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8964                 let contents = if o.result_ok {
8965                         let result = unsafe { o.contents.result };
8966                         unsafe { o.contents.result = core::ptr::null_mut() };
8967                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8968                 } else {
8969                         let err = unsafe { o.contents.err };
8970                         unsafe { o.contents.err = core::ptr::null_mut(); }
8971                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8972                 };
8973                 Self {
8974                         contents,
8975                         result_ok: o.result_ok,
8976                 }
8977         }
8978 }
8979 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8980         fn clone(&self) -> Self {
8981                 if self.result_ok {
8982                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8983                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8984                         } }
8985                 } else {
8986                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8987                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8988                         } }
8989                 }
8990         }
8991 }
8992 #[no_mangle]
8993 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8994 /// but with all dynamically-allocated buffers duplicated in new buffers.
8995 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8996 #[repr(C)]
8997 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8998 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8999         /// A pointer to the contents in the success state.
9000         /// Reading from this pointer when `result_ok` is not set is undefined.
9001         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9002         /// A pointer to the contents in the error state.
9003         /// Reading from this pointer when `result_ok` is set is undefined.
9004         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9005 }
9006 #[repr(C)]
9007 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9008 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9010 pub struct CResult_ChannelDetailsDecodeErrorZ {
9011         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9012         /// `err` or `result` depending on the state of `result_ok`.
9013         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9014         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9015         pub result_ok: bool,
9016 }
9017 #[no_mangle]
9018 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9019 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9020         CResult_ChannelDetailsDecodeErrorZ {
9021                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9022                         result: Box::into_raw(Box::new(o)),
9023                 },
9024                 result_ok: true,
9025         }
9026 }
9027 #[no_mangle]
9028 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9029 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9030         CResult_ChannelDetailsDecodeErrorZ {
9031                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9032                         err: Box::into_raw(Box::new(e)),
9033                 },
9034                 result_ok: false,
9035         }
9036 }
9037 /// Checks if the given object is currently in the success state
9038 #[no_mangle]
9039 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9040         o.result_ok
9041 }
9042 #[no_mangle]
9043 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9044 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9045 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9046         fn drop(&mut self) {
9047                 if self.result_ok {
9048                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9049                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9050                         }
9051                 } else {
9052                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9053                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9054                         }
9055                 }
9056         }
9057 }
9058 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9059         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9060                 let contents = if o.result_ok {
9061                         let result = unsafe { o.contents.result };
9062                         unsafe { o.contents.result = core::ptr::null_mut() };
9063                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9064                 } else {
9065                         let err = unsafe { o.contents.err };
9066                         unsafe { o.contents.err = core::ptr::null_mut(); }
9067                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9068                 };
9069                 Self {
9070                         contents,
9071                         result_ok: o.result_ok,
9072                 }
9073         }
9074 }
9075 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9076         fn clone(&self) -> Self {
9077                 if self.result_ok {
9078                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9079                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9080                         } }
9081                 } else {
9082                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9083                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9084                         } }
9085                 }
9086         }
9087 }
9088 #[no_mangle]
9089 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9090 /// but with all dynamically-allocated buffers duplicated in new buffers.
9091 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9092 #[repr(C)]
9093 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9094 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9095         /// A pointer to the contents in the success state.
9096         /// Reading from this pointer when `result_ok` is not set is undefined.
9097         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9098         /// A pointer to the contents in the error state.
9099         /// Reading from this pointer when `result_ok` is set is undefined.
9100         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9101 }
9102 #[repr(C)]
9103 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9104 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9106 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9107         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9108         /// `err` or `result` depending on the state of `result_ok`.
9109         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9110         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9111         pub result_ok: bool,
9112 }
9113 #[no_mangle]
9114 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9115 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9116         CResult_PhantomRouteHintsDecodeErrorZ {
9117                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9118                         result: Box::into_raw(Box::new(o)),
9119                 },
9120                 result_ok: true,
9121         }
9122 }
9123 #[no_mangle]
9124 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9125 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9126         CResult_PhantomRouteHintsDecodeErrorZ {
9127                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9128                         err: Box::into_raw(Box::new(e)),
9129                 },
9130                 result_ok: false,
9131         }
9132 }
9133 /// Checks if the given object is currently in the success state
9134 #[no_mangle]
9135 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9136         o.result_ok
9137 }
9138 #[no_mangle]
9139 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9140 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9141 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9142         fn drop(&mut self) {
9143                 if self.result_ok {
9144                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9145                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9146                         }
9147                 } else {
9148                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9149                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9150                         }
9151                 }
9152         }
9153 }
9154 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9155         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9156                 let contents = if o.result_ok {
9157                         let result = unsafe { o.contents.result };
9158                         unsafe { o.contents.result = core::ptr::null_mut() };
9159                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9160                 } else {
9161                         let err = unsafe { o.contents.err };
9162                         unsafe { o.contents.err = core::ptr::null_mut(); }
9163                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9164                 };
9165                 Self {
9166                         contents,
9167                         result_ok: o.result_ok,
9168                 }
9169         }
9170 }
9171 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9172         fn clone(&self) -> Self {
9173                 if self.result_ok {
9174                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9175                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9176                         } }
9177                 } else {
9178                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9179                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9180                         } }
9181                 }
9182         }
9183 }
9184 #[no_mangle]
9185 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9186 /// but with all dynamically-allocated buffers duplicated in new buffers.
9187 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9188 #[repr(C)]
9189 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9190 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9191         /// A pointer to the contents in the success state.
9192         /// Reading from this pointer when `result_ok` is not set is undefined.
9193         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9194         /// A pointer to the contents in the error state.
9195         /// Reading from this pointer when `result_ok` is set is undefined.
9196         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9197 }
9198 #[repr(C)]
9199 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9200 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9201 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9202 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9203         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9204         /// `err` or `result` depending on the state of `result_ok`.
9205         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9206         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9207         pub result_ok: bool,
9208 }
9209 #[no_mangle]
9210 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9211 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9212         CResult_ChannelShutdownStateDecodeErrorZ {
9213                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9214                         result: Box::into_raw(Box::new(o)),
9215                 },
9216                 result_ok: true,
9217         }
9218 }
9219 #[no_mangle]
9220 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9221 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9222         CResult_ChannelShutdownStateDecodeErrorZ {
9223                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9224                         err: Box::into_raw(Box::new(e)),
9225                 },
9226                 result_ok: false,
9227         }
9228 }
9229 /// Checks if the given object is currently in the success state
9230 #[no_mangle]
9231 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9232         o.result_ok
9233 }
9234 #[no_mangle]
9235 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9236 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9237 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9238         fn drop(&mut self) {
9239                 if self.result_ok {
9240                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9241                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9242                         }
9243                 } else {
9244                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9245                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9246                         }
9247                 }
9248         }
9249 }
9250 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9251         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9252                 let contents = if o.result_ok {
9253                         let result = unsafe { o.contents.result };
9254                         unsafe { o.contents.result = core::ptr::null_mut() };
9255                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9256                 } else {
9257                         let err = unsafe { o.contents.err };
9258                         unsafe { o.contents.err = core::ptr::null_mut(); }
9259                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9260                 };
9261                 Self {
9262                         contents,
9263                         result_ok: o.result_ok,
9264                 }
9265         }
9266 }
9267 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9268         fn clone(&self) -> Self {
9269                 if self.result_ok {
9270                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9271                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9272                         } }
9273                 } else {
9274                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9275                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9276                         } }
9277                 }
9278         }
9279 }
9280 #[no_mangle]
9281 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9282 /// but with all dynamically-allocated buffers duplicated in new buffers.
9283 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9284 #[repr(C)]
9285 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9286 /// This corresponds to std::vector in C++
9287 pub struct CVec_ChannelMonitorZ {
9288         /// The elements in the array.
9289         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9290         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9291         /// The number of elements pointed to by `data`.
9292         pub datalen: usize
9293 }
9294 impl CVec_ChannelMonitorZ {
9295         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9296                 if self.datalen == 0 { return Vec::new(); }
9297                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9298                 self.data = core::ptr::null_mut();
9299                 self.datalen = 0;
9300                 ret
9301         }
9302         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9303                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9304         }
9305 }
9306 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9307         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9308                 let datalen = v.len();
9309                 let data = Box::into_raw(v.into_boxed_slice());
9310                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9311         }
9312 }
9313 #[no_mangle]
9314 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9315 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9316 impl Drop for CVec_ChannelMonitorZ {
9317         fn drop(&mut self) {
9318                 if self.datalen == 0 { return; }
9319                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9320         }
9321 }
9322 #[repr(C)]
9323 /// A tuple of 2 elements. See the individual fields for the types contained.
9324 pub struct C2Tuple_BlockHashChannelManagerZ {
9325         /// The element at position 0
9326         pub a: crate::c_types::ThirtyTwoBytes,
9327         /// The element at position 1
9328         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9329 }
9330 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9331         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9332                 Self {
9333                         a: tup.0,
9334                         b: tup.1,
9335                 }
9336         }
9337 }
9338 impl C2Tuple_BlockHashChannelManagerZ {
9339         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9340                 (self.a, self.b)
9341         }
9342 }
9343 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9344 #[no_mangle]
9345 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9346         C2Tuple_BlockHashChannelManagerZ { a, b, }
9347 }
9348
9349 #[no_mangle]
9350 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9351 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9352 #[repr(C)]
9353 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9354 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9355         /// A pointer to the contents in the success state.
9356         /// Reading from this pointer when `result_ok` is not set is undefined.
9357         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9358         /// A pointer to the contents in the error state.
9359         /// Reading from this pointer when `result_ok` is set is undefined.
9360         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9361 }
9362 #[repr(C)]
9363 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9364 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9366 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9367         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9368         /// `err` or `result` depending on the state of `result_ok`.
9369         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9370         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9371         pub result_ok: bool,
9372 }
9373 #[no_mangle]
9374 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9375 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9376         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9377                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9378                         result: Box::into_raw(Box::new(o)),
9379                 },
9380                 result_ok: true,
9381         }
9382 }
9383 #[no_mangle]
9384 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9385 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9386         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9387                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9388                         err: Box::into_raw(Box::new(e)),
9389                 },
9390                 result_ok: false,
9391         }
9392 }
9393 /// Checks if the given object is currently in the success state
9394 #[no_mangle]
9395 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9396         o.result_ok
9397 }
9398 #[no_mangle]
9399 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9400 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9401 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9402         fn drop(&mut self) {
9403                 if self.result_ok {
9404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9406                         }
9407                 } else {
9408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9410                         }
9411                 }
9412         }
9413 }
9414 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9415         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9416                 let contents = if o.result_ok {
9417                         let result = unsafe { o.contents.result };
9418                         unsafe { o.contents.result = core::ptr::null_mut() };
9419                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9420                 } else {
9421                         let err = unsafe { o.contents.err };
9422                         unsafe { o.contents.err = core::ptr::null_mut(); }
9423                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9424                 };
9425                 Self {
9426                         contents,
9427                         result_ok: o.result_ok,
9428                 }
9429         }
9430 }
9431 #[repr(C)]
9432 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
9433 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9434         /// A pointer to the contents in the success state.
9435         /// Reading from this pointer when `result_ok` is not set is undefined.
9436         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
9437         /// A pointer to the contents in the error state.
9438         /// Reading from this pointer when `result_ok` is set is undefined.
9439         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9440 }
9441 #[repr(C)]
9442 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
9443 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
9444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9445 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
9446         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
9447         /// `err` or `result` depending on the state of `result_ok`.
9448         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
9449         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
9450         pub result_ok: bool,
9451 }
9452 #[no_mangle]
9453 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
9454 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9455         CResult_MaxDustHTLCExposureDecodeErrorZ {
9456                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9457                         result: Box::into_raw(Box::new(o)),
9458                 },
9459                 result_ok: true,
9460         }
9461 }
9462 #[no_mangle]
9463 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
9464 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9465         CResult_MaxDustHTLCExposureDecodeErrorZ {
9466                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9467                         err: Box::into_raw(Box::new(e)),
9468                 },
9469                 result_ok: false,
9470         }
9471 }
9472 /// Checks if the given object is currently in the success state
9473 #[no_mangle]
9474 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
9475         o.result_ok
9476 }
9477 #[no_mangle]
9478 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
9479 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
9480 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
9481         fn drop(&mut self) {
9482                 if self.result_ok {
9483                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9484                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9485                         }
9486                 } else {
9487                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9488                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9489                         }
9490                 }
9491         }
9492 }
9493 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
9494         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
9495                 let contents = if o.result_ok {
9496                         let result = unsafe { o.contents.result };
9497                         unsafe { o.contents.result = core::ptr::null_mut() };
9498                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
9499                 } else {
9500                         let err = unsafe { o.contents.err };
9501                         unsafe { o.contents.err = core::ptr::null_mut(); }
9502                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
9503                 };
9504                 Self {
9505                         contents,
9506                         result_ok: o.result_ok,
9507                 }
9508         }
9509 }
9510 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
9511         fn clone(&self) -> Self {
9512                 if self.result_ok {
9513                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9514                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
9515                         } }
9516                 } else {
9517                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9518                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9519                         } }
9520                 }
9521         }
9522 }
9523 #[no_mangle]
9524 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
9525 /// but with all dynamically-allocated buffers duplicated in new buffers.
9526 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
9527 #[repr(C)]
9528 /// The contents of CResult_ChannelConfigDecodeErrorZ
9529 pub union CResult_ChannelConfigDecodeErrorZPtr {
9530         /// A pointer to the contents in the success state.
9531         /// Reading from this pointer when `result_ok` is not set is undefined.
9532         pub result: *mut crate::lightning::util::config::ChannelConfig,
9533         /// A pointer to the contents in the error state.
9534         /// Reading from this pointer when `result_ok` is set is undefined.
9535         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9536 }
9537 #[repr(C)]
9538 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9539 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9540 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9541 pub struct CResult_ChannelConfigDecodeErrorZ {
9542         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9543         /// `err` or `result` depending on the state of `result_ok`.
9544         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9545         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9546         pub result_ok: bool,
9547 }
9548 #[no_mangle]
9549 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9550 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9551         CResult_ChannelConfigDecodeErrorZ {
9552                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9553                         result: Box::into_raw(Box::new(o)),
9554                 },
9555                 result_ok: true,
9556         }
9557 }
9558 #[no_mangle]
9559 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9560 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9561         CResult_ChannelConfigDecodeErrorZ {
9562                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9563                         err: Box::into_raw(Box::new(e)),
9564                 },
9565                 result_ok: false,
9566         }
9567 }
9568 /// Checks if the given object is currently in the success state
9569 #[no_mangle]
9570 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9571         o.result_ok
9572 }
9573 #[no_mangle]
9574 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9575 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9576 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9577         fn drop(&mut self) {
9578                 if self.result_ok {
9579                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9580                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9581                         }
9582                 } else {
9583                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9584                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9585                         }
9586                 }
9587         }
9588 }
9589 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9590         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9591                 let contents = if o.result_ok {
9592                         let result = unsafe { o.contents.result };
9593                         unsafe { o.contents.result = core::ptr::null_mut() };
9594                         CResult_ChannelConfigDecodeErrorZPtr { result }
9595                 } else {
9596                         let err = unsafe { o.contents.err };
9597                         unsafe { o.contents.err = core::ptr::null_mut(); }
9598                         CResult_ChannelConfigDecodeErrorZPtr { err }
9599                 };
9600                 Self {
9601                         contents,
9602                         result_ok: o.result_ok,
9603                 }
9604         }
9605 }
9606 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9607         fn clone(&self) -> Self {
9608                 if self.result_ok {
9609                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9610                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9611                         } }
9612                 } else {
9613                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9614                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9615                         } }
9616                 }
9617         }
9618 }
9619 #[no_mangle]
9620 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9621 /// but with all dynamically-allocated buffers duplicated in new buffers.
9622 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9623 #[repr(C)]
9624 #[derive(Clone)]
9625 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
9626 pub enum COption_MaxDustHTLCExposureZ {
9627         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
9628         Some(crate::lightning::util::config::MaxDustHTLCExposure),
9629         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
9630         None
9631 }
9632 impl COption_MaxDustHTLCExposureZ {
9633         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9634                 if let Self::None = self { false } else { true }
9635         }
9636         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9637                 !self.is_some()
9638         }
9639         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
9640                 if let Self::Some(v) = self { v } else { unreachable!() }
9641         }
9642 }
9643 #[no_mangle]
9644 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
9645 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
9646         COption_MaxDustHTLCExposureZ::Some(o)
9647 }
9648 #[no_mangle]
9649 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
9650 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
9651         COption_MaxDustHTLCExposureZ::None
9652 }
9653 #[no_mangle]
9654 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
9655 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
9656 #[no_mangle]
9657 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
9658 /// but with all dynamically-allocated buffers duplicated in new buffers.
9659 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
9660 #[repr(C)]
9661 #[derive(Clone)]
9662 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
9663 pub enum COption_APIErrorZ {
9664         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
9665         Some(crate::lightning::util::errors::APIError),
9666         /// When we're in this state, this COption_APIErrorZ contains nothing
9667         None
9668 }
9669 impl COption_APIErrorZ {
9670         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9671                 if let Self::None = self { false } else { true }
9672         }
9673         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9674                 !self.is_some()
9675         }
9676         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
9677                 if let Self::Some(v) = self { v } else { unreachable!() }
9678         }
9679 }
9680 #[no_mangle]
9681 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
9682 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
9683         COption_APIErrorZ::Some(o)
9684 }
9685 #[no_mangle]
9686 /// Constructs a new COption_APIErrorZ containing nothing
9687 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
9688         COption_APIErrorZ::None
9689 }
9690 #[no_mangle]
9691 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
9692 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
9693 #[no_mangle]
9694 /// Creates a new COption_APIErrorZ which has the same data as `orig`
9695 /// but with all dynamically-allocated buffers duplicated in new buffers.
9696 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
9697 #[repr(C)]
9698 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
9699 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
9700         /// A pointer to the contents in the success state.
9701         /// Reading from this pointer when `result_ok` is not set is undefined.
9702         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
9703         /// A pointer to the contents in the error state.
9704         /// Reading from this pointer when `result_ok` is set is undefined.
9705         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9706 }
9707 #[repr(C)]
9708 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
9709 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9711 pub struct CResult_COption_APIErrorZDecodeErrorZ {
9712         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
9713         /// `err` or `result` depending on the state of `result_ok`.
9714         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
9715         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
9716         pub result_ok: bool,
9717 }
9718 #[no_mangle]
9719 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
9720 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
9721         CResult_COption_APIErrorZDecodeErrorZ {
9722                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9723                         result: Box::into_raw(Box::new(o)),
9724                 },
9725                 result_ok: true,
9726         }
9727 }
9728 #[no_mangle]
9729 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
9730 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
9731         CResult_COption_APIErrorZDecodeErrorZ {
9732                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9733                         err: Box::into_raw(Box::new(e)),
9734                 },
9735                 result_ok: false,
9736         }
9737 }
9738 /// Checks if the given object is currently in the success state
9739 #[no_mangle]
9740 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
9741         o.result_ok
9742 }
9743 #[no_mangle]
9744 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
9745 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
9746 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
9747         fn drop(&mut self) {
9748                 if self.result_ok {
9749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9751                         }
9752                 } else {
9753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9755                         }
9756                 }
9757         }
9758 }
9759 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
9760         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9761                 let contents = if o.result_ok {
9762                         let result = unsafe { o.contents.result };
9763                         unsafe { o.contents.result = core::ptr::null_mut() };
9764                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
9765                 } else {
9766                         let err = unsafe { o.contents.err };
9767                         unsafe { o.contents.err = core::ptr::null_mut(); }
9768                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
9769                 };
9770                 Self {
9771                         contents,
9772                         result_ok: o.result_ok,
9773                 }
9774         }
9775 }
9776 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
9777         fn clone(&self) -> Self {
9778                 if self.result_ok {
9779                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9780                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
9781                         } }
9782                 } else {
9783                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9785                         } }
9786                 }
9787         }
9788 }
9789 #[no_mangle]
9790 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
9791 /// but with all dynamically-allocated buffers duplicated in new buffers.
9792 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
9793 #[repr(C)]
9794 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9795 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9796         /// A pointer to the contents in the success state.
9797         /// Reading from this pointer when `result_ok` is not set is undefined.
9798         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9799         /// A pointer to the contents in the error state.
9800         /// Reading from this pointer when `result_ok` is set is undefined.
9801         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9802 }
9803 #[repr(C)]
9804 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9805 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9807 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9808         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9809         /// `err` or `result` depending on the state of `result_ok`.
9810         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9811         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9812         pub result_ok: bool,
9813 }
9814 #[no_mangle]
9815 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9816 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9817         CResult_ChannelMonitorUpdateDecodeErrorZ {
9818                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9819                         result: Box::into_raw(Box::new(o)),
9820                 },
9821                 result_ok: true,
9822         }
9823 }
9824 #[no_mangle]
9825 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9826 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9827         CResult_ChannelMonitorUpdateDecodeErrorZ {
9828                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9829                         err: Box::into_raw(Box::new(e)),
9830                 },
9831                 result_ok: false,
9832         }
9833 }
9834 /// Checks if the given object is currently in the success state
9835 #[no_mangle]
9836 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9837         o.result_ok
9838 }
9839 #[no_mangle]
9840 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9841 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9842 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9843         fn drop(&mut self) {
9844                 if self.result_ok {
9845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9847                         }
9848                 } else {
9849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9851                         }
9852                 }
9853         }
9854 }
9855 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9856         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9857                 let contents = if o.result_ok {
9858                         let result = unsafe { o.contents.result };
9859                         unsafe { o.contents.result = core::ptr::null_mut() };
9860                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9861                 } else {
9862                         let err = unsafe { o.contents.err };
9863                         unsafe { o.contents.err = core::ptr::null_mut(); }
9864                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9865                 };
9866                 Self {
9867                         contents,
9868                         result_ok: o.result_ok,
9869                 }
9870         }
9871 }
9872 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9873         fn clone(&self) -> Self {
9874                 if self.result_ok {
9875                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9876                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9877                         } }
9878                 } else {
9879                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9881                         } }
9882                 }
9883         }
9884 }
9885 #[no_mangle]
9886 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9887 /// but with all dynamically-allocated buffers duplicated in new buffers.
9888 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9889 #[repr(C)]
9890 #[derive(Clone)]
9891 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9892 pub enum COption_MonitorEventZ {
9893         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9894         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9895         /// When we're in this state, this COption_MonitorEventZ contains nothing
9896         None
9897 }
9898 impl COption_MonitorEventZ {
9899         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9900                 if let Self::None = self { false } else { true }
9901         }
9902         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9903                 !self.is_some()
9904         }
9905         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9906                 if let Self::Some(v) = self { v } else { unreachable!() }
9907         }
9908 }
9909 #[no_mangle]
9910 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9911 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9912         COption_MonitorEventZ::Some(o)
9913 }
9914 #[no_mangle]
9915 /// Constructs a new COption_MonitorEventZ containing nothing
9916 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9917         COption_MonitorEventZ::None
9918 }
9919 #[no_mangle]
9920 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9921 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9922 #[no_mangle]
9923 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9924 /// but with all dynamically-allocated buffers duplicated in new buffers.
9925 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9926 #[repr(C)]
9927 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9928 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9929         /// A pointer to the contents in the success state.
9930         /// Reading from this pointer when `result_ok` is not set is undefined.
9931         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9932         /// A pointer to the contents in the error state.
9933         /// Reading from this pointer when `result_ok` is set is undefined.
9934         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9935 }
9936 #[repr(C)]
9937 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9938 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9940 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9941         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9942         /// `err` or `result` depending on the state of `result_ok`.
9943         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9944         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9945         pub result_ok: bool,
9946 }
9947 #[no_mangle]
9948 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9949 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9950         CResult_COption_MonitorEventZDecodeErrorZ {
9951                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9952                         result: Box::into_raw(Box::new(o)),
9953                 },
9954                 result_ok: true,
9955         }
9956 }
9957 #[no_mangle]
9958 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9959 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9960         CResult_COption_MonitorEventZDecodeErrorZ {
9961                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9962                         err: Box::into_raw(Box::new(e)),
9963                 },
9964                 result_ok: false,
9965         }
9966 }
9967 /// Checks if the given object is currently in the success state
9968 #[no_mangle]
9969 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9970         o.result_ok
9971 }
9972 #[no_mangle]
9973 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9974 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9975 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9976         fn drop(&mut self) {
9977                 if self.result_ok {
9978                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9979                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9980                         }
9981                 } else {
9982                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9983                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9984                         }
9985                 }
9986         }
9987 }
9988 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9989         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9990                 let contents = if o.result_ok {
9991                         let result = unsafe { o.contents.result };
9992                         unsafe { o.contents.result = core::ptr::null_mut() };
9993                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9994                 } else {
9995                         let err = unsafe { o.contents.err };
9996                         unsafe { o.contents.err = core::ptr::null_mut(); }
9997                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9998                 };
9999                 Self {
10000                         contents,
10001                         result_ok: o.result_ok,
10002                 }
10003         }
10004 }
10005 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10006         fn clone(&self) -> Self {
10007                 if self.result_ok {
10008                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10009                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10010                         } }
10011                 } else {
10012                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10013                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10014                         } }
10015                 }
10016         }
10017 }
10018 #[no_mangle]
10019 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10020 /// but with all dynamically-allocated buffers duplicated in new buffers.
10021 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10022 #[repr(C)]
10023 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10024 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10025         /// A pointer to the contents in the success state.
10026         /// Reading from this pointer when `result_ok` is not set is undefined.
10027         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10028         /// A pointer to the contents in the error state.
10029         /// Reading from this pointer when `result_ok` is set is undefined.
10030         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10031 }
10032 #[repr(C)]
10033 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10034 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10036 pub struct CResult_HTLCUpdateDecodeErrorZ {
10037         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10038         /// `err` or `result` depending on the state of `result_ok`.
10039         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10040         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10041         pub result_ok: bool,
10042 }
10043 #[no_mangle]
10044 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10045 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10046         CResult_HTLCUpdateDecodeErrorZ {
10047                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10048                         result: Box::into_raw(Box::new(o)),
10049                 },
10050                 result_ok: true,
10051         }
10052 }
10053 #[no_mangle]
10054 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10055 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10056         CResult_HTLCUpdateDecodeErrorZ {
10057                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10058                         err: Box::into_raw(Box::new(e)),
10059                 },
10060                 result_ok: false,
10061         }
10062 }
10063 /// Checks if the given object is currently in the success state
10064 #[no_mangle]
10065 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10066         o.result_ok
10067 }
10068 #[no_mangle]
10069 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10070 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10071 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10072         fn drop(&mut self) {
10073                 if self.result_ok {
10074                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10075                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10076                         }
10077                 } else {
10078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10080                         }
10081                 }
10082         }
10083 }
10084 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10086                 let contents = if o.result_ok {
10087                         let result = unsafe { o.contents.result };
10088                         unsafe { o.contents.result = core::ptr::null_mut() };
10089                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10090                 } else {
10091                         let err = unsafe { o.contents.err };
10092                         unsafe { o.contents.err = core::ptr::null_mut(); }
10093                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10094                 };
10095                 Self {
10096                         contents,
10097                         result_ok: o.result_ok,
10098                 }
10099         }
10100 }
10101 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10102         fn clone(&self) -> Self {
10103                 if self.result_ok {
10104                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10105                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10106                         } }
10107                 } else {
10108                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10109                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10110                         } }
10111                 }
10112         }
10113 }
10114 #[no_mangle]
10115 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10116 /// but with all dynamically-allocated buffers duplicated in new buffers.
10117 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10118 #[repr(C)]
10119 /// A tuple of 2 elements. See the individual fields for the types contained.
10120 pub struct C2Tuple_OutPointScriptZ {
10121         /// The element at position 0
10122         pub a: crate::lightning::chain::transaction::OutPoint,
10123         /// The element at position 1
10124         pub b: crate::c_types::derived::CVec_u8Z,
10125 }
10126 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10127         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10128                 Self {
10129                         a: tup.0,
10130                         b: tup.1,
10131                 }
10132         }
10133 }
10134 impl C2Tuple_OutPointScriptZ {
10135         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10136                 (self.a, self.b)
10137         }
10138 }
10139 impl Clone for C2Tuple_OutPointScriptZ {
10140         fn clone(&self) -> Self {
10141                 Self {
10142                         a: Clone::clone(&self.a),
10143                         b: Clone::clone(&self.b),
10144                 }
10145         }
10146 }
10147 #[no_mangle]
10148 /// Creates a new tuple which has the same data as `orig`
10149 /// but with all dynamically-allocated buffers duplicated in new buffers.
10150 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10151 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10152 #[no_mangle]
10153 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10154         C2Tuple_OutPointScriptZ { a, b, }
10155 }
10156
10157 #[no_mangle]
10158 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10159 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10160 #[repr(C)]
10161 /// A tuple of 2 elements. See the individual fields for the types contained.
10162 pub struct C2Tuple_u32ScriptZ {
10163         /// The element at position 0
10164         pub a: u32,
10165         /// The element at position 1
10166         pub b: crate::c_types::derived::CVec_u8Z,
10167 }
10168 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10169         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10170                 Self {
10171                         a: tup.0,
10172                         b: tup.1,
10173                 }
10174         }
10175 }
10176 impl C2Tuple_u32ScriptZ {
10177         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10178                 (self.a, self.b)
10179         }
10180 }
10181 impl Clone for C2Tuple_u32ScriptZ {
10182         fn clone(&self) -> Self {
10183                 Self {
10184                         a: Clone::clone(&self.a),
10185                         b: Clone::clone(&self.b),
10186                 }
10187         }
10188 }
10189 #[no_mangle]
10190 /// Creates a new tuple which has the same data as `orig`
10191 /// but with all dynamically-allocated buffers duplicated in new buffers.
10192 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10193 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10194 #[no_mangle]
10195 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10196         C2Tuple_u32ScriptZ { a, b, }
10197 }
10198
10199 #[no_mangle]
10200 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10201 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10202 #[repr(C)]
10203 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10204 /// This corresponds to std::vector in C++
10205 pub struct CVec_C2Tuple_u32ScriptZZ {
10206         /// The elements in the array.
10207         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10208         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10209         /// The number of elements pointed to by `data`.
10210         pub datalen: usize
10211 }
10212 impl CVec_C2Tuple_u32ScriptZZ {
10213         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10214                 if self.datalen == 0 { return Vec::new(); }
10215                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10216                 self.data = core::ptr::null_mut();
10217                 self.datalen = 0;
10218                 ret
10219         }
10220         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10221                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10222         }
10223 }
10224 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10225         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10226                 let datalen = v.len();
10227                 let data = Box::into_raw(v.into_boxed_slice());
10228                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10229         }
10230 }
10231 #[no_mangle]
10232 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10233 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10234 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10235         fn drop(&mut self) {
10236                 if self.datalen == 0 { return; }
10237                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10238         }
10239 }
10240 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10241         fn clone(&self) -> Self {
10242                 let mut res = Vec::new();
10243                 if self.datalen == 0 { return Self::from(res); }
10244                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10245                 Self::from(res)
10246         }
10247 }
10248 #[repr(C)]
10249 /// A tuple of 2 elements. See the individual fields for the types contained.
10250 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10251         /// The element at position 0
10252         pub a: crate::c_types::ThirtyTwoBytes,
10253         /// The element at position 1
10254         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10255 }
10256 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10257         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10258                 Self {
10259                         a: tup.0,
10260                         b: tup.1,
10261                 }
10262         }
10263 }
10264 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10265         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10266                 (self.a, self.b)
10267         }
10268 }
10269 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10270         fn clone(&self) -> Self {
10271                 Self {
10272                         a: Clone::clone(&self.a),
10273                         b: Clone::clone(&self.b),
10274                 }
10275         }
10276 }
10277 #[no_mangle]
10278 /// Creates a new tuple which has the same data as `orig`
10279 /// but with all dynamically-allocated buffers duplicated in new buffers.
10280 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10281 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10282 #[no_mangle]
10283 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 {
10284         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10285 }
10286
10287 #[no_mangle]
10288 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10289 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
10290 #[repr(C)]
10291 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
10292 /// This corresponds to std::vector in C++
10293 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10294         /// The elements in the array.
10295         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10296         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
10297         /// The number of elements pointed to by `data`.
10298         pub datalen: usize
10299 }
10300 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10301         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
10302                 if self.datalen == 0 { return Vec::new(); }
10303                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10304                 self.data = core::ptr::null_mut();
10305                 self.datalen = 0;
10306                 ret
10307         }
10308         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
10309                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10310         }
10311 }
10312 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10313         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
10314                 let datalen = v.len();
10315                 let data = Box::into_raw(v.into_boxed_slice());
10316                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10317         }
10318 }
10319 #[no_mangle]
10320 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10321 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
10322 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10323         fn drop(&mut self) {
10324                 if self.datalen == 0 { return; }
10325                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10326         }
10327 }
10328 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10329         fn clone(&self) -> Self {
10330                 let mut res = Vec::new();
10331                 if self.datalen == 0 { return Self::from(res); }
10332                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10333                 Self::from(res)
10334         }
10335 }
10336 #[repr(C)]
10337 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
10338 /// This corresponds to std::vector in C++
10339 pub struct CVec_TransactionZ {
10340         /// The elements in the array.
10341         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10342         pub data: *mut crate::c_types::Transaction,
10343         /// The number of elements pointed to by `data`.
10344         pub datalen: usize
10345 }
10346 impl CVec_TransactionZ {
10347         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
10348                 if self.datalen == 0 { return Vec::new(); }
10349                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10350                 self.data = core::ptr::null_mut();
10351                 self.datalen = 0;
10352                 ret
10353         }
10354         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
10355                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10356         }
10357 }
10358 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
10359         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
10360                 let datalen = v.len();
10361                 let data = Box::into_raw(v.into_boxed_slice());
10362                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10363         }
10364 }
10365 #[no_mangle]
10366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10367 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
10368 impl Drop for CVec_TransactionZ {
10369         fn drop(&mut self) {
10370                 if self.datalen == 0 { return; }
10371                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10372         }
10373 }
10374 impl Clone for CVec_TransactionZ {
10375         fn clone(&self) -> Self {
10376                 let mut res = Vec::new();
10377                 if self.datalen == 0 { return Self::from(res); }
10378                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10379                 Self::from(res)
10380         }
10381 }
10382 #[repr(C)]
10383 /// A tuple of 2 elements. See the individual fields for the types contained.
10384 pub struct C2Tuple_u32TxOutZ {
10385         /// The element at position 0
10386         pub a: u32,
10387         /// The element at position 1
10388         pub b: crate::c_types::TxOut,
10389 }
10390 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
10391         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
10392                 Self {
10393                         a: tup.0,
10394                         b: tup.1,
10395                 }
10396         }
10397 }
10398 impl C2Tuple_u32TxOutZ {
10399         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
10400                 (self.a, self.b)
10401         }
10402 }
10403 impl Clone for C2Tuple_u32TxOutZ {
10404         fn clone(&self) -> Self {
10405                 Self {
10406                         a: Clone::clone(&self.a),
10407                         b: Clone::clone(&self.b),
10408                 }
10409         }
10410 }
10411 #[no_mangle]
10412 /// Creates a new tuple which has the same data as `orig`
10413 /// but with all dynamically-allocated buffers duplicated in new buffers.
10414 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
10415 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
10416 #[no_mangle]
10417 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
10418         C2Tuple_u32TxOutZ { a, b, }
10419 }
10420
10421 #[no_mangle]
10422 /// Frees any resources used by the C2Tuple_u32TxOutZ.
10423 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
10424 #[repr(C)]
10425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
10426 /// This corresponds to std::vector in C++
10427 pub struct CVec_C2Tuple_u32TxOutZZ {
10428         /// The elements in the array.
10429         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10430         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
10431         /// The number of elements pointed to by `data`.
10432         pub datalen: usize
10433 }
10434 impl CVec_C2Tuple_u32TxOutZZ {
10435         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
10436                 if self.datalen == 0 { return Vec::new(); }
10437                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10438                 self.data = core::ptr::null_mut();
10439                 self.datalen = 0;
10440                 ret
10441         }
10442         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
10443                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10444         }
10445 }
10446 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
10447         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
10448                 let datalen = v.len();
10449                 let data = Box::into_raw(v.into_boxed_slice());
10450                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10451         }
10452 }
10453 #[no_mangle]
10454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10455 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
10456 impl Drop for CVec_C2Tuple_u32TxOutZZ {
10457         fn drop(&mut self) {
10458                 if self.datalen == 0 { return; }
10459                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10460         }
10461 }
10462 impl Clone for CVec_C2Tuple_u32TxOutZZ {
10463         fn clone(&self) -> Self {
10464                 let mut res = Vec::new();
10465                 if self.datalen == 0 { return Self::from(res); }
10466                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10467                 Self::from(res)
10468         }
10469 }
10470 #[repr(C)]
10471 /// A tuple of 2 elements. See the individual fields for the types contained.
10472 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10473         /// The element at position 0
10474         pub a: crate::c_types::ThirtyTwoBytes,
10475         /// The element at position 1
10476         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
10477 }
10478 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10479         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
10480                 Self {
10481                         a: tup.0,
10482                         b: tup.1,
10483                 }
10484         }
10485 }
10486 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10487         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
10488                 (self.a, self.b)
10489         }
10490 }
10491 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10492         fn clone(&self) -> Self {
10493                 Self {
10494                         a: Clone::clone(&self.a),
10495                         b: Clone::clone(&self.b),
10496                 }
10497         }
10498 }
10499 #[no_mangle]
10500 /// Creates a new tuple which has the same data as `orig`
10501 /// but with all dynamically-allocated buffers duplicated in new buffers.
10502 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
10503 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10504 #[no_mangle]
10505 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 {
10506         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
10507 }
10508
10509 #[no_mangle]
10510 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10511 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
10512 #[repr(C)]
10513 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
10514 /// This corresponds to std::vector in C++
10515 pub struct CVec_TransactionOutputsZ {
10516         /// The elements in the array.
10517         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10518         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
10519         /// The number of elements pointed to by `data`.
10520         pub datalen: usize
10521 }
10522 impl CVec_TransactionOutputsZ {
10523         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
10524                 if self.datalen == 0 { return Vec::new(); }
10525                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10526                 self.data = core::ptr::null_mut();
10527                 self.datalen = 0;
10528                 ret
10529         }
10530         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
10531                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10532         }
10533 }
10534 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
10535         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
10536                 let datalen = v.len();
10537                 let data = Box::into_raw(v.into_boxed_slice());
10538                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10539         }
10540 }
10541 #[no_mangle]
10542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10543 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
10544 impl Drop for CVec_TransactionOutputsZ {
10545         fn drop(&mut self) {
10546                 if self.datalen == 0 { return; }
10547                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10548         }
10549 }
10550 impl Clone for CVec_TransactionOutputsZ {
10551         fn clone(&self) -> Self {
10552                 let mut res = Vec::new();
10553                 if self.datalen == 0 { return Self::from(res); }
10554                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10555                 Self::from(res)
10556         }
10557 }
10558 #[repr(C)]
10559 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10560 /// This corresponds to std::vector in C++
10561 pub struct CVec_BalanceZ {
10562         /// The elements in the array.
10563         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10564         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10565         /// The number of elements pointed to by `data`.
10566         pub datalen: usize
10567 }
10568 impl CVec_BalanceZ {
10569         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10570                 if self.datalen == 0 { return Vec::new(); }
10571                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10572                 self.data = core::ptr::null_mut();
10573                 self.datalen = 0;
10574                 ret
10575         }
10576         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10577                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10578         }
10579 }
10580 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10581         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10582                 let datalen = v.len();
10583                 let data = Box::into_raw(v.into_boxed_slice());
10584                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10585         }
10586 }
10587 #[no_mangle]
10588 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10589 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10590 impl Drop for CVec_BalanceZ {
10591         fn drop(&mut self) {
10592                 if self.datalen == 0 { return; }
10593                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10594         }
10595 }
10596 impl Clone for CVec_BalanceZ {
10597         fn clone(&self) -> Self {
10598                 let mut res = Vec::new();
10599                 if self.datalen == 0 { return Self::from(res); }
10600                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10601                 Self::from(res)
10602         }
10603 }
10604 #[repr(C)]
10605 /// A tuple of 2 elements. See the individual fields for the types contained.
10606 pub struct C2Tuple_BlockHashChannelMonitorZ {
10607         /// The element at position 0
10608         pub a: crate::c_types::ThirtyTwoBytes,
10609         /// The element at position 1
10610         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
10611 }
10612 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
10613         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
10614                 Self {
10615                         a: tup.0,
10616                         b: tup.1,
10617                 }
10618         }
10619 }
10620 impl C2Tuple_BlockHashChannelMonitorZ {
10621         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
10622                 (self.a, self.b)
10623         }
10624 }
10625 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
10626 #[no_mangle]
10627 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
10628         C2Tuple_BlockHashChannelMonitorZ { a, b, }
10629 }
10630
10631 #[no_mangle]
10632 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
10633 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
10634 #[repr(C)]
10635 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10636 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10637         /// A pointer to the contents in the success state.
10638         /// Reading from this pointer when `result_ok` is not set is undefined.
10639         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10640         /// A pointer to the contents in the error state.
10641         /// Reading from this pointer when `result_ok` is set is undefined.
10642         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10643 }
10644 #[repr(C)]
10645 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10646 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10648 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10649         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10650         /// `err` or `result` depending on the state of `result_ok`.
10651         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10652         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10653         pub result_ok: bool,
10654 }
10655 #[no_mangle]
10656 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10657 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10658         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10659                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10660                         result: Box::into_raw(Box::new(o)),
10661                 },
10662                 result_ok: true,
10663         }
10664 }
10665 #[no_mangle]
10666 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10667 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10668         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10669                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10670                         err: Box::into_raw(Box::new(e)),
10671                 },
10672                 result_ok: false,
10673         }
10674 }
10675 /// Checks if the given object is currently in the success state
10676 #[no_mangle]
10677 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10678         o.result_ok
10679 }
10680 #[no_mangle]
10681 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10683 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10684         fn drop(&mut self) {
10685                 if self.result_ok {
10686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10688                         }
10689                 } else {
10690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10692                         }
10693                 }
10694         }
10695 }
10696 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10697         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10698                 let contents = if o.result_ok {
10699                         let result = unsafe { o.contents.result };
10700                         unsafe { o.contents.result = core::ptr::null_mut() };
10701                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10702                 } else {
10703                         let err = unsafe { o.contents.err };
10704                         unsafe { o.contents.err = core::ptr::null_mut(); }
10705                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10706                 };
10707                 Self {
10708                         contents,
10709                         result_ok: o.result_ok,
10710                 }
10711         }
10712 }
10713 #[repr(C)]
10714 /// A tuple of 2 elements. See the individual fields for the types contained.
10715 pub struct C2Tuple_PublicKeyTypeZ {
10716         /// The element at position 0
10717         pub a: crate::c_types::PublicKey,
10718         /// The element at position 1
10719         pub b: crate::lightning::ln::wire::Type,
10720 }
10721 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10722         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10723                 Self {
10724                         a: tup.0,
10725                         b: tup.1,
10726                 }
10727         }
10728 }
10729 impl C2Tuple_PublicKeyTypeZ {
10730         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10731                 (self.a, self.b)
10732         }
10733 }
10734 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10735 #[no_mangle]
10736 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10737         C2Tuple_PublicKeyTypeZ { a, b, }
10738 }
10739
10740 #[no_mangle]
10741 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10742 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10743 #[repr(C)]
10744 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10745 /// This corresponds to std::vector in C++
10746 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10747         /// The elements in the array.
10748         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10749         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10750         /// The number of elements pointed to by `data`.
10751         pub datalen: usize
10752 }
10753 impl CVec_C2Tuple_PublicKeyTypeZZ {
10754         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10755                 if self.datalen == 0 { return Vec::new(); }
10756                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10757                 self.data = core::ptr::null_mut();
10758                 self.datalen = 0;
10759                 ret
10760         }
10761         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10762                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10763         }
10764 }
10765 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10766         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10767                 let datalen = v.len();
10768                 let data = Box::into_raw(v.into_boxed_slice());
10769                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10770         }
10771 }
10772 #[no_mangle]
10773 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10774 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10775 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10776         fn drop(&mut self) {
10777                 if self.datalen == 0 { return; }
10778                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10779         }
10780 }
10781 #[repr(C)]
10782 #[derive(Clone)]
10783 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10784 pub enum COption_OffersMessageZ {
10785         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10786         Some(crate::lightning::onion_message::offers::OffersMessage),
10787         /// When we're in this state, this COption_OffersMessageZ contains nothing
10788         None
10789 }
10790 impl COption_OffersMessageZ {
10791         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10792                 if let Self::None = self { false } else { true }
10793         }
10794         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10795                 !self.is_some()
10796         }
10797         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10798                 if let Self::Some(v) = self { v } else { unreachable!() }
10799         }
10800 }
10801 #[no_mangle]
10802 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10803 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10804         COption_OffersMessageZ::Some(o)
10805 }
10806 #[no_mangle]
10807 /// Constructs a new COption_OffersMessageZ containing nothing
10808 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10809         COption_OffersMessageZ::None
10810 }
10811 #[no_mangle]
10812 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10813 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10814 #[no_mangle]
10815 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10816 /// but with all dynamically-allocated buffers duplicated in new buffers.
10817 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10818 #[repr(C)]
10819 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
10820 pub enum COption_CustomOnionMessageContentsZ {
10821         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
10822         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
10823         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
10824         None
10825 }
10826 impl COption_CustomOnionMessageContentsZ {
10827         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10828                 if let Self::None = self { false } else { true }
10829         }
10830         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10831                 !self.is_some()
10832         }
10833         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
10834                 if let Self::Some(v) = self { v } else { unreachable!() }
10835         }
10836 }
10837 #[no_mangle]
10838 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
10839 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
10840         COption_CustomOnionMessageContentsZ::Some(o)
10841 }
10842 #[no_mangle]
10843 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
10844 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
10845         COption_CustomOnionMessageContentsZ::None
10846 }
10847 #[no_mangle]
10848 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
10849 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
10850 #[repr(C)]
10851 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
10852 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10853         /// A pointer to the contents in the success state.
10854         /// Reading from this pointer when `result_ok` is not set is undefined.
10855         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
10856         /// A pointer to the contents in the error state.
10857         /// Reading from this pointer when `result_ok` is set is undefined.
10858         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10859 }
10860 #[repr(C)]
10861 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
10862 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10864 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10865         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
10866         /// `err` or `result` depending on the state of `result_ok`.
10867         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
10868         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
10869         pub result_ok: bool,
10870 }
10871 #[no_mangle]
10872 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
10873 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10874         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10875                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10876                         result: Box::into_raw(Box::new(o)),
10877                 },
10878                 result_ok: true,
10879         }
10880 }
10881 #[no_mangle]
10882 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
10883 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10884         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10885                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10886                         err: Box::into_raw(Box::new(e)),
10887                 },
10888                 result_ok: false,
10889         }
10890 }
10891 /// Checks if the given object is currently in the success state
10892 #[no_mangle]
10893 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
10894         o.result_ok
10895 }
10896 #[no_mangle]
10897 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
10898 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
10899 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10900         fn drop(&mut self) {
10901                 if self.result_ok {
10902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10904                         }
10905                 } else {
10906                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10907                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10908                         }
10909                 }
10910         }
10911 }
10912 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10913         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10914                 let contents = if o.result_ok {
10915                         let result = unsafe { o.contents.result };
10916                         unsafe { o.contents.result = core::ptr::null_mut() };
10917                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
10918                 } else {
10919                         let err = unsafe { o.contents.err };
10920                         unsafe { o.contents.err = core::ptr::null_mut(); }
10921                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
10922                 };
10923                 Self {
10924                         contents,
10925                         result_ok: o.result_ok,
10926                 }
10927         }
10928 }
10929 #[repr(C)]
10930 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10931 pub enum COption_TypeZ {
10932         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10933         Some(crate::lightning::ln::wire::Type),
10934         /// When we're in this state, this COption_TypeZ contains nothing
10935         None
10936 }
10937 impl COption_TypeZ {
10938         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10939                 if let Self::None = self { false } else { true }
10940         }
10941         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10942                 !self.is_some()
10943         }
10944         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10945                 if let Self::Some(v) = self { v } else { unreachable!() }
10946         }
10947 }
10948 #[no_mangle]
10949 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10950 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10951         COption_TypeZ::Some(o)
10952 }
10953 #[no_mangle]
10954 /// Constructs a new COption_TypeZ containing nothing
10955 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10956         COption_TypeZ::None
10957 }
10958 #[no_mangle]
10959 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10960 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10961 #[repr(C)]
10962 /// The contents of CResult_COption_TypeZDecodeErrorZ
10963 pub union CResult_COption_TypeZDecodeErrorZPtr {
10964         /// A pointer to the contents in the success state.
10965         /// Reading from this pointer when `result_ok` is not set is undefined.
10966         pub result: *mut crate::c_types::derived::COption_TypeZ,
10967         /// A pointer to the contents in the error state.
10968         /// Reading from this pointer when `result_ok` is set is undefined.
10969         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10970 }
10971 #[repr(C)]
10972 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10973 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10975 pub struct CResult_COption_TypeZDecodeErrorZ {
10976         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10977         /// `err` or `result` depending on the state of `result_ok`.
10978         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10979         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10980         pub result_ok: bool,
10981 }
10982 #[no_mangle]
10983 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10984 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10985         CResult_COption_TypeZDecodeErrorZ {
10986                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10987                         result: Box::into_raw(Box::new(o)),
10988                 },
10989                 result_ok: true,
10990         }
10991 }
10992 #[no_mangle]
10993 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10994 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10995         CResult_COption_TypeZDecodeErrorZ {
10996                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10997                         err: Box::into_raw(Box::new(e)),
10998                 },
10999                 result_ok: false,
11000         }
11001 }
11002 /// Checks if the given object is currently in the success state
11003 #[no_mangle]
11004 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11005         o.result_ok
11006 }
11007 #[no_mangle]
11008 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11009 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11010 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11011         fn drop(&mut self) {
11012                 if self.result_ok {
11013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11015                         }
11016                 } else {
11017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11019                         }
11020                 }
11021         }
11022 }
11023 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11024         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11025                 let contents = if o.result_ok {
11026                         let result = unsafe { o.contents.result };
11027                         unsafe { o.contents.result = core::ptr::null_mut() };
11028                         CResult_COption_TypeZDecodeErrorZPtr { result }
11029                 } else {
11030                         let err = unsafe { o.contents.err };
11031                         unsafe { o.contents.err = core::ptr::null_mut(); }
11032                         CResult_COption_TypeZDecodeErrorZPtr { err }
11033                 };
11034                 Self {
11035                         contents,
11036                         result_ok: o.result_ok,
11037                 }
11038         }
11039 }
11040 #[repr(C)]
11041 #[derive(Clone)]
11042 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11043 pub enum COption_NetAddressZ {
11044         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11045         Some(crate::lightning::ln::msgs::NetAddress),
11046         /// When we're in this state, this COption_NetAddressZ contains nothing
11047         None
11048 }
11049 impl COption_NetAddressZ {
11050         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11051                 if let Self::None = self { false } else { true }
11052         }
11053         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11054                 !self.is_some()
11055         }
11056         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11057                 if let Self::Some(v) = self { v } else { unreachable!() }
11058         }
11059 }
11060 #[no_mangle]
11061 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11062 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11063         COption_NetAddressZ::Some(o)
11064 }
11065 #[no_mangle]
11066 /// Constructs a new COption_NetAddressZ containing nothing
11067 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11068         COption_NetAddressZ::None
11069 }
11070 #[no_mangle]
11071 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11072 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11073 #[no_mangle]
11074 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11075 /// but with all dynamically-allocated buffers duplicated in new buffers.
11076 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11077 #[repr(C)]
11078 /// A tuple of 2 elements. See the individual fields for the types contained.
11079 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
11080         /// The element at position 0
11081         pub a: crate::c_types::PublicKey,
11082         /// The element at position 1
11083         pub b: crate::c_types::derived::COption_NetAddressZ,
11084 }
11085 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
11086         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
11087                 Self {
11088                         a: tup.0,
11089                         b: tup.1,
11090                 }
11091         }
11092 }
11093 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
11094         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
11095                 (self.a, self.b)
11096         }
11097 }
11098 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
11099         fn clone(&self) -> Self {
11100                 Self {
11101                         a: Clone::clone(&self.a),
11102                         b: Clone::clone(&self.b),
11103                 }
11104         }
11105 }
11106 #[no_mangle]
11107 /// Creates a new tuple which has the same data as `orig`
11108 /// but with all dynamically-allocated buffers duplicated in new buffers.
11109 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
11110 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
11111 #[no_mangle]
11112 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
11113         C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
11114 }
11115
11116 #[no_mangle]
11117 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
11118 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
11119 #[repr(C)]
11120 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
11121 /// This corresponds to std::vector in C++
11122 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11123         /// The elements in the array.
11124         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11125         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
11126         /// The number of elements pointed to by `data`.
11127         pub datalen: usize
11128 }
11129 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11130         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
11131                 if self.datalen == 0 { return Vec::new(); }
11132                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11133                 self.data = core::ptr::null_mut();
11134                 self.datalen = 0;
11135                 ret
11136         }
11137         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
11138                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11139         }
11140 }
11141 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11142         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
11143                 let datalen = v.len();
11144                 let data = Box::into_raw(v.into_boxed_slice());
11145                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11146         }
11147 }
11148 #[no_mangle]
11149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11150 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
11151 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11152         fn drop(&mut self) {
11153                 if self.datalen == 0 { return; }
11154                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11155         }
11156 }
11157 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11158         fn clone(&self) -> Self {
11159                 let mut res = Vec::new();
11160                 if self.datalen == 0 { return Self::from(res); }
11161                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11162                 Self::from(res)
11163         }
11164 }
11165 #[repr(C)]
11166 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11167 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11168         /// A pointer to the contents in the success state.
11169         /// Reading from this pointer when `result_ok` is not set is undefined.
11170         pub result: *mut crate::c_types::derived::CVec_u8Z,
11171         /// A pointer to the contents in the error state.
11172         /// Reading from this pointer when `result_ok` is set is undefined.
11173         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11174 }
11175 #[repr(C)]
11176 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11177 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11179 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11180         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11181         /// `err` or `result` depending on the state of `result_ok`.
11182         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11183         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11184         pub result_ok: bool,
11185 }
11186 #[no_mangle]
11187 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11188 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11189         CResult_CVec_u8ZPeerHandleErrorZ {
11190                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11191                         result: Box::into_raw(Box::new(o)),
11192                 },
11193                 result_ok: true,
11194         }
11195 }
11196 #[no_mangle]
11197 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11198 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11199         CResult_CVec_u8ZPeerHandleErrorZ {
11200                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11201                         err: Box::into_raw(Box::new(e)),
11202                 },
11203                 result_ok: false,
11204         }
11205 }
11206 /// Checks if the given object is currently in the success state
11207 #[no_mangle]
11208 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11209         o.result_ok
11210 }
11211 #[no_mangle]
11212 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11213 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11214 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11215         fn drop(&mut self) {
11216                 if self.result_ok {
11217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11219                         }
11220                 } else {
11221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11223                         }
11224                 }
11225         }
11226 }
11227 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11228         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11229                 let contents = if o.result_ok {
11230                         let result = unsafe { o.contents.result };
11231                         unsafe { o.contents.result = core::ptr::null_mut() };
11232                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11233                 } else {
11234                         let err = unsafe { o.contents.err };
11235                         unsafe { o.contents.err = core::ptr::null_mut(); }
11236                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11237                 };
11238                 Self {
11239                         contents,
11240                         result_ok: o.result_ok,
11241                 }
11242         }
11243 }
11244 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11245         fn clone(&self) -> Self {
11246                 if self.result_ok {
11247                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11248                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11249                         } }
11250                 } else {
11251                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11252                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11253                         } }
11254                 }
11255         }
11256 }
11257 #[no_mangle]
11258 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11259 /// but with all dynamically-allocated buffers duplicated in new buffers.
11260 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11261 #[repr(C)]
11262 /// The contents of CResult_NonePeerHandleErrorZ
11263 pub union CResult_NonePeerHandleErrorZPtr {
11264         /// Note that this value is always NULL, as there are no contents in the OK variant
11265         pub result: *mut core::ffi::c_void,
11266         /// A pointer to the contents in the error state.
11267         /// Reading from this pointer when `result_ok` is set is undefined.
11268         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11269 }
11270 #[repr(C)]
11271 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11272 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11274 pub struct CResult_NonePeerHandleErrorZ {
11275         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11276         /// `err` or `result` depending on the state of `result_ok`.
11277         pub contents: CResult_NonePeerHandleErrorZPtr,
11278         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11279         pub result_ok: bool,
11280 }
11281 #[no_mangle]
11282 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11283 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11284         CResult_NonePeerHandleErrorZ {
11285                 contents: CResult_NonePeerHandleErrorZPtr {
11286                         result: core::ptr::null_mut(),
11287                 },
11288                 result_ok: true,
11289         }
11290 }
11291 #[no_mangle]
11292 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11293 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11294         CResult_NonePeerHandleErrorZ {
11295                 contents: CResult_NonePeerHandleErrorZPtr {
11296                         err: Box::into_raw(Box::new(e)),
11297                 },
11298                 result_ok: false,
11299         }
11300 }
11301 /// Checks if the given object is currently in the success state
11302 #[no_mangle]
11303 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11304         o.result_ok
11305 }
11306 #[no_mangle]
11307 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11308 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11309 impl Drop for CResult_NonePeerHandleErrorZ {
11310         fn drop(&mut self) {
11311                 if self.result_ok {
11312                 } else {
11313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11315                         }
11316                 }
11317         }
11318 }
11319 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11320         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11321                 let contents = if o.result_ok {
11322                         let _ = unsafe { Box::from_raw(o.contents.result) };
11323                         o.contents.result = core::ptr::null_mut();
11324                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11325                 } else {
11326                         let err = unsafe { o.contents.err };
11327                         unsafe { o.contents.err = core::ptr::null_mut(); }
11328                         CResult_NonePeerHandleErrorZPtr { err }
11329                 };
11330                 Self {
11331                         contents,
11332                         result_ok: o.result_ok,
11333                 }
11334         }
11335 }
11336 impl Clone for CResult_NonePeerHandleErrorZ {
11337         fn clone(&self) -> Self {
11338                 if self.result_ok {
11339                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11340                                 result: core::ptr::null_mut()
11341                         } }
11342                 } else {
11343                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11345                         } }
11346                 }
11347         }
11348 }
11349 #[no_mangle]
11350 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11351 /// but with all dynamically-allocated buffers duplicated in new buffers.
11352 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11353 #[repr(C)]
11354 /// The contents of CResult_boolPeerHandleErrorZ
11355 pub union CResult_boolPeerHandleErrorZPtr {
11356         /// A pointer to the contents in the success state.
11357         /// Reading from this pointer when `result_ok` is not set is undefined.
11358         pub result: *mut bool,
11359         /// A pointer to the contents in the error state.
11360         /// Reading from this pointer when `result_ok` is set is undefined.
11361         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11362 }
11363 #[repr(C)]
11364 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11365 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11367 pub struct CResult_boolPeerHandleErrorZ {
11368         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11369         /// `err` or `result` depending on the state of `result_ok`.
11370         pub contents: CResult_boolPeerHandleErrorZPtr,
11371         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11372         pub result_ok: bool,
11373 }
11374 #[no_mangle]
11375 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11376 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11377         CResult_boolPeerHandleErrorZ {
11378                 contents: CResult_boolPeerHandleErrorZPtr {
11379                         result: Box::into_raw(Box::new(o)),
11380                 },
11381                 result_ok: true,
11382         }
11383 }
11384 #[no_mangle]
11385 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11386 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11387         CResult_boolPeerHandleErrorZ {
11388                 contents: CResult_boolPeerHandleErrorZPtr {
11389                         err: Box::into_raw(Box::new(e)),
11390                 },
11391                 result_ok: false,
11392         }
11393 }
11394 /// Checks if the given object is currently in the success state
11395 #[no_mangle]
11396 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11397         o.result_ok
11398 }
11399 #[no_mangle]
11400 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11401 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11402 impl Drop for CResult_boolPeerHandleErrorZ {
11403         fn drop(&mut self) {
11404                 if self.result_ok {
11405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11407                         }
11408                 } else {
11409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11411                         }
11412                 }
11413         }
11414 }
11415 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11416         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11417                 let contents = if o.result_ok {
11418                         let result = unsafe { o.contents.result };
11419                         unsafe { o.contents.result = core::ptr::null_mut() };
11420                         CResult_boolPeerHandleErrorZPtr { result }
11421                 } else {
11422                         let err = unsafe { o.contents.err };
11423                         unsafe { o.contents.err = core::ptr::null_mut(); }
11424                         CResult_boolPeerHandleErrorZPtr { err }
11425                 };
11426                 Self {
11427                         contents,
11428                         result_ok: o.result_ok,
11429                 }
11430         }
11431 }
11432 impl Clone for CResult_boolPeerHandleErrorZ {
11433         fn clone(&self) -> Self {
11434                 if self.result_ok {
11435                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11436                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11437                         } }
11438                 } else {
11439                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11441                         } }
11442                 }
11443         }
11444 }
11445 #[no_mangle]
11446 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11447 /// but with all dynamically-allocated buffers duplicated in new buffers.
11448 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11449 #[repr(C)]
11450 /// The contents of CResult_u32GraphSyncErrorZ
11451 pub union CResult_u32GraphSyncErrorZPtr {
11452         /// A pointer to the contents in the success state.
11453         /// Reading from this pointer when `result_ok` is not set is undefined.
11454         pub result: *mut u32,
11455         /// A pointer to the contents in the error state.
11456         /// Reading from this pointer when `result_ok` is set is undefined.
11457         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11458 }
11459 #[repr(C)]
11460 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11461 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11463 pub struct CResult_u32GraphSyncErrorZ {
11464         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11465         /// `err` or `result` depending on the state of `result_ok`.
11466         pub contents: CResult_u32GraphSyncErrorZPtr,
11467         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11468         pub result_ok: bool,
11469 }
11470 #[no_mangle]
11471 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11472 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11473         CResult_u32GraphSyncErrorZ {
11474                 contents: CResult_u32GraphSyncErrorZPtr {
11475                         result: Box::into_raw(Box::new(o)),
11476                 },
11477                 result_ok: true,
11478         }
11479 }
11480 #[no_mangle]
11481 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11482 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11483         CResult_u32GraphSyncErrorZ {
11484                 contents: CResult_u32GraphSyncErrorZPtr {
11485                         err: Box::into_raw(Box::new(e)),
11486                 },
11487                 result_ok: false,
11488         }
11489 }
11490 /// Checks if the given object is currently in the success state
11491 #[no_mangle]
11492 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11493         o.result_ok
11494 }
11495 #[no_mangle]
11496 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11497 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11498 impl Drop for CResult_u32GraphSyncErrorZ {
11499         fn drop(&mut self) {
11500                 if self.result_ok {
11501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11503                         }
11504                 } else {
11505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11507                         }
11508                 }
11509         }
11510 }
11511 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11512         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11513                 let contents = if o.result_ok {
11514                         let result = unsafe { o.contents.result };
11515                         unsafe { o.contents.result = core::ptr::null_mut() };
11516                         CResult_u32GraphSyncErrorZPtr { result }
11517                 } else {
11518                         let err = unsafe { o.contents.err };
11519                         unsafe { o.contents.err = core::ptr::null_mut(); }
11520                         CResult_u32GraphSyncErrorZPtr { err }
11521                 };
11522                 Self {
11523                         contents,
11524                         result_ok: o.result_ok,
11525                 }
11526         }
11527 }
11528 #[repr(C)]
11529 #[derive(Clone)]
11530 /// An enum which can either contain a crate::c_types::SecretKey or not
11531 pub enum COption_KeyPairZ {
11532         /// When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey
11533         Some(crate::c_types::SecretKey),
11534         /// When we're in this state, this COption_KeyPairZ contains nothing
11535         None
11536 }
11537 impl COption_KeyPairZ {
11538         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11539                 if let Self::None = self { false } else { true }
11540         }
11541         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11542                 !self.is_some()
11543         }
11544         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
11545                 if let Self::Some(v) = self { v } else { unreachable!() }
11546         }
11547 }
11548 #[no_mangle]
11549 /// Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey
11550 pub extern "C" fn COption_KeyPairZ_some(o: crate::c_types::SecretKey) -> COption_KeyPairZ {
11551         COption_KeyPairZ::Some(o)
11552 }
11553 #[no_mangle]
11554 /// Constructs a new COption_KeyPairZ containing nothing
11555 pub extern "C" fn COption_KeyPairZ_none() -> COption_KeyPairZ {
11556         COption_KeyPairZ::None
11557 }
11558 #[no_mangle]
11559 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
11560 pub extern "C" fn COption_KeyPairZ_free(_res: COption_KeyPairZ) { }
11561 #[no_mangle]
11562 /// Creates a new COption_KeyPairZ which has the same data as `orig`
11563 /// but with all dynamically-allocated buffers duplicated in new buffers.
11564 pub extern "C" fn COption_KeyPairZ_clone(orig: &COption_KeyPairZ) -> COption_KeyPairZ { Clone::clone(&orig) }
11565 #[repr(C)]
11566 /// The contents of CResult_COption_KeyPairZNoneZ
11567 pub union CResult_COption_KeyPairZNoneZPtr {
11568         /// A pointer to the contents in the success state.
11569         /// Reading from this pointer when `result_ok` is not set is undefined.
11570         pub result: *mut crate::c_types::derived::COption_KeyPairZ,
11571         /// Note that this value is always NULL, as there are no contents in the Err variant
11572         pub err: *mut core::ffi::c_void,
11573 }
11574 #[repr(C)]
11575 /// A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation,
11576 /// containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure.
11577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11578 pub struct CResult_COption_KeyPairZNoneZ {
11579         /// The contents of this CResult_COption_KeyPairZNoneZ, accessible via either
11580         /// `err` or `result` depending on the state of `result_ok`.
11581         pub contents: CResult_COption_KeyPairZNoneZPtr,
11582         /// Whether this CResult_COption_KeyPairZNoneZ represents a success state.
11583         pub result_ok: bool,
11584 }
11585 #[no_mangle]
11586 /// Creates a new CResult_COption_KeyPairZNoneZ in the success state.
11587 pub extern "C" fn CResult_COption_KeyPairZNoneZ_ok(o: crate::c_types::derived::COption_KeyPairZ) -> CResult_COption_KeyPairZNoneZ {
11588         CResult_COption_KeyPairZNoneZ {
11589                 contents: CResult_COption_KeyPairZNoneZPtr {
11590                         result: Box::into_raw(Box::new(o)),
11591                 },
11592                 result_ok: true,
11593         }
11594 }
11595 #[no_mangle]
11596 /// Creates a new CResult_COption_KeyPairZNoneZ in the error state.
11597 pub extern "C" fn CResult_COption_KeyPairZNoneZ_err() -> CResult_COption_KeyPairZNoneZ {
11598         CResult_COption_KeyPairZNoneZ {
11599                 contents: CResult_COption_KeyPairZNoneZPtr {
11600                         err: core::ptr::null_mut(),
11601                 },
11602                 result_ok: false,
11603         }
11604 }
11605 /// Checks if the given object is currently in the success state
11606 #[no_mangle]
11607 pub extern "C" fn CResult_COption_KeyPairZNoneZ_is_ok(o: &CResult_COption_KeyPairZNoneZ) -> bool {
11608         o.result_ok
11609 }
11610 #[no_mangle]
11611 /// Frees any resources used by the CResult_COption_KeyPairZNoneZ.
11612 pub extern "C" fn CResult_COption_KeyPairZNoneZ_free(_res: CResult_COption_KeyPairZNoneZ) { }
11613 impl Drop for CResult_COption_KeyPairZNoneZ {
11614         fn drop(&mut self) {
11615                 if self.result_ok {
11616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11618                         }
11619                 } else {
11620                 }
11621         }
11622 }
11623 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_KeyPairZ, ()>> for CResult_COption_KeyPairZNoneZ {
11624         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_KeyPairZ, ()>) -> Self {
11625                 let contents = if o.result_ok {
11626                         let result = unsafe { o.contents.result };
11627                         unsafe { o.contents.result = core::ptr::null_mut() };
11628                         CResult_COption_KeyPairZNoneZPtr { result }
11629                 } else {
11630                         let _ = unsafe { Box::from_raw(o.contents.err) };
11631                         o.contents.err = core::ptr::null_mut();
11632                         CResult_COption_KeyPairZNoneZPtr { err: core::ptr::null_mut() }
11633                 };
11634                 Self {
11635                         contents,
11636                         result_ok: o.result_ok,
11637                 }
11638         }
11639 }
11640 impl Clone for CResult_COption_KeyPairZNoneZ {
11641         fn clone(&self) -> Self {
11642                 if self.result_ok {
11643                         Self { result_ok: true, contents: CResult_COption_KeyPairZNoneZPtr {
11644                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_KeyPairZ>::clone(unsafe { &*self.contents.result })))
11645                         } }
11646                 } else {
11647                         Self { result_ok: false, contents: CResult_COption_KeyPairZNoneZPtr {
11648                                 err: core::ptr::null_mut()
11649                         } }
11650                 }
11651         }
11652 }
11653 #[no_mangle]
11654 /// Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig`
11655 /// but with all dynamically-allocated buffers duplicated in new buffers.
11656 pub extern "C" fn CResult_COption_KeyPairZNoneZ_clone(orig: &CResult_COption_KeyPairZNoneZ) -> CResult_COption_KeyPairZNoneZ { Clone::clone(&orig) }
11657 #[repr(C)]
11658 #[derive(Clone)]
11659 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
11660 pub enum COption_ScriptZ {
11661         /// When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z
11662         Some(crate::c_types::derived::CVec_u8Z),
11663         /// When we're in this state, this COption_ScriptZ contains nothing
11664         None
11665 }
11666 impl COption_ScriptZ {
11667         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11668                 if let Self::None = self { false } else { true }
11669         }
11670         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11671                 !self.is_some()
11672         }
11673         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
11674                 if let Self::Some(v) = self { v } else { unreachable!() }
11675         }
11676 }
11677 #[no_mangle]
11678 /// Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z
11679 pub extern "C" fn COption_ScriptZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_ScriptZ {
11680         COption_ScriptZ::Some(o)
11681 }
11682 #[no_mangle]
11683 /// Constructs a new COption_ScriptZ containing nothing
11684 pub extern "C" fn COption_ScriptZ_none() -> COption_ScriptZ {
11685         COption_ScriptZ::None
11686 }
11687 #[no_mangle]
11688 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
11689 pub extern "C" fn COption_ScriptZ_free(_res: COption_ScriptZ) { }
11690 #[no_mangle]
11691 /// Creates a new COption_ScriptZ which has the same data as `orig`
11692 /// but with all dynamically-allocated buffers duplicated in new buffers.
11693 pub extern "C" fn COption_ScriptZ_clone(orig: &COption_ScriptZ) -> COption_ScriptZ { Clone::clone(&orig) }
11694 #[repr(C)]
11695 /// An enum which can either contain a  or not
11696 pub enum COption_NoneZ {
11697         /// When we're in this state, this COption_NoneZ contains a 
11698         Some,
11699         /// When we're in this state, this COption_NoneZ contains nothing
11700         None
11701 }
11702 impl COption_NoneZ {
11703         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11704                 if let Self::None = self { false } else { true }
11705         }
11706         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11707                 !self.is_some()
11708         }
11709 }
11710 #[no_mangle]
11711 /// Constructs a new COption_NoneZ containing a 
11712 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
11713         COption_NoneZ::Some
11714 }
11715 #[no_mangle]
11716 /// Constructs a new COption_NoneZ containing nothing
11717 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
11718         COption_NoneZ::None
11719 }
11720 #[no_mangle]
11721 /// Frees any resources associated with the , if we are in the Some state
11722 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
11723 #[repr(C)]
11724 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
11725 /// This corresponds to std::vector in C++
11726 pub struct CVec_WitnessZ {
11727         /// The elements in the array.
11728         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11729         pub data: *mut crate::c_types::Witness,
11730         /// The number of elements pointed to by `data`.
11731         pub datalen: usize
11732 }
11733 impl CVec_WitnessZ {
11734         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
11735                 if self.datalen == 0 { return Vec::new(); }
11736                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11737                 self.data = core::ptr::null_mut();
11738                 self.datalen = 0;
11739                 ret
11740         }
11741         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
11742                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11743         }
11744 }
11745 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
11746         fn from(v: Vec<crate::c_types::Witness>) -> Self {
11747                 let datalen = v.len();
11748                 let data = Box::into_raw(v.into_boxed_slice());
11749                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11750         }
11751 }
11752 #[no_mangle]
11753 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11754 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
11755 impl Drop for CVec_WitnessZ {
11756         fn drop(&mut self) {
11757                 if self.datalen == 0 { return; }
11758                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11759         }
11760 }
11761 impl Clone for CVec_WitnessZ {
11762         fn clone(&self) -> Self {
11763                 let mut res = Vec::new();
11764                 if self.datalen == 0 { return Self::from(res); }
11765                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11766                 Self::from(res)
11767         }
11768 }
11769 #[repr(C)]
11770 #[derive(Clone)]
11771 /// An enum which can either contain a i64 or not
11772 pub enum COption_i64Z {
11773         /// When we're in this state, this COption_i64Z contains a i64
11774         Some(i64),
11775         /// When we're in this state, this COption_i64Z contains nothing
11776         None
11777 }
11778 impl COption_i64Z {
11779         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11780                 if let Self::None = self { false } else { true }
11781         }
11782         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11783                 !self.is_some()
11784         }
11785         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
11786                 if let Self::Some(v) = self { v } else { unreachable!() }
11787         }
11788 }
11789 #[no_mangle]
11790 /// Constructs a new COption_i64Z containing a i64
11791 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
11792         COption_i64Z::Some(o)
11793 }
11794 #[no_mangle]
11795 /// Constructs a new COption_i64Z containing nothing
11796 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
11797         COption_i64Z::None
11798 }
11799 #[no_mangle]
11800 /// Frees any resources associated with the i64, if we are in the Some state
11801 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
11802 #[no_mangle]
11803 /// Creates a new COption_i64Z which has the same data as `orig`
11804 /// but with all dynamically-allocated buffers duplicated in new buffers.
11805 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
11806 #[repr(C)]
11807 #[derive(Clone)]
11808 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
11809 pub enum COption_TxidZ {
11810         /// When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes
11811         Some(crate::c_types::ThirtyTwoBytes),
11812         /// When we're in this state, this COption_TxidZ contains nothing
11813         None
11814 }
11815 impl COption_TxidZ {
11816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11817                 if let Self::None = self { false } else { true }
11818         }
11819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11820                 !self.is_some()
11821         }
11822         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
11823                 if let Self::Some(v) = self { v } else { unreachable!() }
11824         }
11825 }
11826 #[no_mangle]
11827 /// Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes
11828 pub extern "C" fn COption_TxidZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_TxidZ {
11829         COption_TxidZ::Some(o)
11830 }
11831 #[no_mangle]
11832 /// Constructs a new COption_TxidZ containing nothing
11833 pub extern "C" fn COption_TxidZ_none() -> COption_TxidZ {
11834         COption_TxidZ::None
11835 }
11836 #[no_mangle]
11837 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
11838 pub extern "C" fn COption_TxidZ_free(_res: COption_TxidZ) { }
11839 #[no_mangle]
11840 /// Creates a new COption_TxidZ which has the same data as `orig`
11841 /// but with all dynamically-allocated buffers duplicated in new buffers.
11842 pub extern "C" fn COption_TxidZ_clone(orig: &COption_TxidZ) -> COption_TxidZ { Clone::clone(&orig) }
11843 #[repr(C)]
11844 /// The contents of CResult_NetAddressDecodeErrorZ
11845 pub union CResult_NetAddressDecodeErrorZPtr {
11846         /// A pointer to the contents in the success state.
11847         /// Reading from this pointer when `result_ok` is not set is undefined.
11848         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11849         /// A pointer to the contents in the error state.
11850         /// Reading from this pointer when `result_ok` is set is undefined.
11851         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11852 }
11853 #[repr(C)]
11854 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11855 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11857 pub struct CResult_NetAddressDecodeErrorZ {
11858         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11859         /// `err` or `result` depending on the state of `result_ok`.
11860         pub contents: CResult_NetAddressDecodeErrorZPtr,
11861         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11862         pub result_ok: bool,
11863 }
11864 #[no_mangle]
11865 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11866 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11867         CResult_NetAddressDecodeErrorZ {
11868                 contents: CResult_NetAddressDecodeErrorZPtr {
11869                         result: Box::into_raw(Box::new(o)),
11870                 },
11871                 result_ok: true,
11872         }
11873 }
11874 #[no_mangle]
11875 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11876 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11877         CResult_NetAddressDecodeErrorZ {
11878                 contents: CResult_NetAddressDecodeErrorZPtr {
11879                         err: Box::into_raw(Box::new(e)),
11880                 },
11881                 result_ok: false,
11882         }
11883 }
11884 /// Checks if the given object is currently in the success state
11885 #[no_mangle]
11886 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11887         o.result_ok
11888 }
11889 #[no_mangle]
11890 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11891 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11892 impl Drop for CResult_NetAddressDecodeErrorZ {
11893         fn drop(&mut self) {
11894                 if self.result_ok {
11895                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11896                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11897                         }
11898                 } else {
11899                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11900                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11901                         }
11902                 }
11903         }
11904 }
11905 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11906         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11907                 let contents = if o.result_ok {
11908                         let result = unsafe { o.contents.result };
11909                         unsafe { o.contents.result = core::ptr::null_mut() };
11910                         CResult_NetAddressDecodeErrorZPtr { result }
11911                 } else {
11912                         let err = unsafe { o.contents.err };
11913                         unsafe { o.contents.err = core::ptr::null_mut(); }
11914                         CResult_NetAddressDecodeErrorZPtr { err }
11915                 };
11916                 Self {
11917                         contents,
11918                         result_ok: o.result_ok,
11919                 }
11920         }
11921 }
11922 impl Clone for CResult_NetAddressDecodeErrorZ {
11923         fn clone(&self) -> Self {
11924                 if self.result_ok {
11925                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11926                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11927                         } }
11928                 } else {
11929                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11930                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11931                         } }
11932                 }
11933         }
11934 }
11935 #[no_mangle]
11936 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11937 /// but with all dynamically-allocated buffers duplicated in new buffers.
11938 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11939 #[repr(C)]
11940 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11941 /// This corresponds to std::vector in C++
11942 pub struct CVec_UpdateAddHTLCZ {
11943         /// The elements in the array.
11944         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11945         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11946         /// The number of elements pointed to by `data`.
11947         pub datalen: usize
11948 }
11949 impl CVec_UpdateAddHTLCZ {
11950         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11951                 if self.datalen == 0 { return Vec::new(); }
11952                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11953                 self.data = core::ptr::null_mut();
11954                 self.datalen = 0;
11955                 ret
11956         }
11957         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11958                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11959         }
11960 }
11961 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11962         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11963                 let datalen = v.len();
11964                 let data = Box::into_raw(v.into_boxed_slice());
11965                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11966         }
11967 }
11968 #[no_mangle]
11969 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11970 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11971 impl Drop for CVec_UpdateAddHTLCZ {
11972         fn drop(&mut self) {
11973                 if self.datalen == 0 { return; }
11974                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11975         }
11976 }
11977 impl Clone for CVec_UpdateAddHTLCZ {
11978         fn clone(&self) -> Self {
11979                 let mut res = Vec::new();
11980                 if self.datalen == 0 { return Self::from(res); }
11981                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11982                 Self::from(res)
11983         }
11984 }
11985 #[repr(C)]
11986 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11987 /// This corresponds to std::vector in C++
11988 pub struct CVec_UpdateFulfillHTLCZ {
11989         /// The elements in the array.
11990         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11991         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11992         /// The number of elements pointed to by `data`.
11993         pub datalen: usize
11994 }
11995 impl CVec_UpdateFulfillHTLCZ {
11996         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11997                 if self.datalen == 0 { return Vec::new(); }
11998                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11999                 self.data = core::ptr::null_mut();
12000                 self.datalen = 0;
12001                 ret
12002         }
12003         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12004                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12005         }
12006 }
12007 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12008         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12009                 let datalen = v.len();
12010                 let data = Box::into_raw(v.into_boxed_slice());
12011                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12012         }
12013 }
12014 #[no_mangle]
12015 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12016 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12017 impl Drop for CVec_UpdateFulfillHTLCZ {
12018         fn drop(&mut self) {
12019                 if self.datalen == 0 { return; }
12020                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12021         }
12022 }
12023 impl Clone for CVec_UpdateFulfillHTLCZ {
12024         fn clone(&self) -> Self {
12025                 let mut res = Vec::new();
12026                 if self.datalen == 0 { return Self::from(res); }
12027                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12028                 Self::from(res)
12029         }
12030 }
12031 #[repr(C)]
12032 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12033 /// This corresponds to std::vector in C++
12034 pub struct CVec_UpdateFailHTLCZ {
12035         /// The elements in the array.
12036         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12037         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12038         /// The number of elements pointed to by `data`.
12039         pub datalen: usize
12040 }
12041 impl CVec_UpdateFailHTLCZ {
12042         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12043                 if self.datalen == 0 { return Vec::new(); }
12044                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12045                 self.data = core::ptr::null_mut();
12046                 self.datalen = 0;
12047                 ret
12048         }
12049         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12050                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12051         }
12052 }
12053 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12054         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12055                 let datalen = v.len();
12056                 let data = Box::into_raw(v.into_boxed_slice());
12057                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12058         }
12059 }
12060 #[no_mangle]
12061 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12062 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12063 impl Drop for CVec_UpdateFailHTLCZ {
12064         fn drop(&mut self) {
12065                 if self.datalen == 0 { return; }
12066                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12067         }
12068 }
12069 impl Clone for CVec_UpdateFailHTLCZ {
12070         fn clone(&self) -> Self {
12071                 let mut res = Vec::new();
12072                 if self.datalen == 0 { return Self::from(res); }
12073                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12074                 Self::from(res)
12075         }
12076 }
12077 #[repr(C)]
12078 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12079 /// This corresponds to std::vector in C++
12080 pub struct CVec_UpdateFailMalformedHTLCZ {
12081         /// The elements in the array.
12082         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12083         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12084         /// The number of elements pointed to by `data`.
12085         pub datalen: usize
12086 }
12087 impl CVec_UpdateFailMalformedHTLCZ {
12088         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12089                 if self.datalen == 0 { return Vec::new(); }
12090                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12091                 self.data = core::ptr::null_mut();
12092                 self.datalen = 0;
12093                 ret
12094         }
12095         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12096                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12097         }
12098 }
12099 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12100         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12101                 let datalen = v.len();
12102                 let data = Box::into_raw(v.into_boxed_slice());
12103                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12104         }
12105 }
12106 #[no_mangle]
12107 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12108 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12109 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12110         fn drop(&mut self) {
12111                 if self.datalen == 0 { return; }
12112                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12113         }
12114 }
12115 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12116         fn clone(&self) -> Self {
12117                 let mut res = Vec::new();
12118                 if self.datalen == 0 { return Self::from(res); }
12119                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12120                 Self::from(res)
12121         }
12122 }
12123 #[repr(C)]
12124 /// The contents of CResult_AcceptChannelDecodeErrorZ
12125 pub union CResult_AcceptChannelDecodeErrorZPtr {
12126         /// A pointer to the contents in the success state.
12127         /// Reading from this pointer when `result_ok` is not set is undefined.
12128         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12129         /// A pointer to the contents in the error state.
12130         /// Reading from this pointer when `result_ok` is set is undefined.
12131         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12132 }
12133 #[repr(C)]
12134 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12135 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12137 pub struct CResult_AcceptChannelDecodeErrorZ {
12138         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12139         /// `err` or `result` depending on the state of `result_ok`.
12140         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12141         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12142         pub result_ok: bool,
12143 }
12144 #[no_mangle]
12145 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12146 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12147         CResult_AcceptChannelDecodeErrorZ {
12148                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12149                         result: Box::into_raw(Box::new(o)),
12150                 },
12151                 result_ok: true,
12152         }
12153 }
12154 #[no_mangle]
12155 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12156 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12157         CResult_AcceptChannelDecodeErrorZ {
12158                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12159                         err: Box::into_raw(Box::new(e)),
12160                 },
12161                 result_ok: false,
12162         }
12163 }
12164 /// Checks if the given object is currently in the success state
12165 #[no_mangle]
12166 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12167         o.result_ok
12168 }
12169 #[no_mangle]
12170 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12171 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12172 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12173         fn drop(&mut self) {
12174                 if self.result_ok {
12175                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12176                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12177                         }
12178                 } else {
12179                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12180                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12181                         }
12182                 }
12183         }
12184 }
12185 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12186         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12187                 let contents = if o.result_ok {
12188                         let result = unsafe { o.contents.result };
12189                         unsafe { o.contents.result = core::ptr::null_mut() };
12190                         CResult_AcceptChannelDecodeErrorZPtr { result }
12191                 } else {
12192                         let err = unsafe { o.contents.err };
12193                         unsafe { o.contents.err = core::ptr::null_mut(); }
12194                         CResult_AcceptChannelDecodeErrorZPtr { err }
12195                 };
12196                 Self {
12197                         contents,
12198                         result_ok: o.result_ok,
12199                 }
12200         }
12201 }
12202 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12203         fn clone(&self) -> Self {
12204                 if self.result_ok {
12205                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12206                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12207                         } }
12208                 } else {
12209                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12210                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12211                         } }
12212                 }
12213         }
12214 }
12215 #[no_mangle]
12216 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12217 /// but with all dynamically-allocated buffers duplicated in new buffers.
12218 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12219 #[repr(C)]
12220 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
12221 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
12222         /// A pointer to the contents in the success state.
12223         /// Reading from this pointer when `result_ok` is not set is undefined.
12224         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
12225         /// A pointer to the contents in the error state.
12226         /// Reading from this pointer when `result_ok` is set is undefined.
12227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12228 }
12229 #[repr(C)]
12230 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
12231 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
12232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12233 pub struct CResult_AcceptChannelV2DecodeErrorZ {
12234         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
12235         /// `err` or `result` depending on the state of `result_ok`.
12236         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
12237         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
12238         pub result_ok: bool,
12239 }
12240 #[no_mangle]
12241 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
12242 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
12243         CResult_AcceptChannelV2DecodeErrorZ {
12244                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12245                         result: Box::into_raw(Box::new(o)),
12246                 },
12247                 result_ok: true,
12248         }
12249 }
12250 #[no_mangle]
12251 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
12252 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
12253         CResult_AcceptChannelV2DecodeErrorZ {
12254                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12255                         err: Box::into_raw(Box::new(e)),
12256                 },
12257                 result_ok: false,
12258         }
12259 }
12260 /// Checks if the given object is currently in the success state
12261 #[no_mangle]
12262 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
12263         o.result_ok
12264 }
12265 #[no_mangle]
12266 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
12267 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
12268 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
12269         fn drop(&mut self) {
12270                 if self.result_ok {
12271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12273                         }
12274                 } else {
12275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12277                         }
12278                 }
12279         }
12280 }
12281 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
12282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
12283                 let contents = if o.result_ok {
12284                         let result = unsafe { o.contents.result };
12285                         unsafe { o.contents.result = core::ptr::null_mut() };
12286                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
12287                 } else {
12288                         let err = unsafe { o.contents.err };
12289                         unsafe { o.contents.err = core::ptr::null_mut(); }
12290                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
12291                 };
12292                 Self {
12293                         contents,
12294                         result_ok: o.result_ok,
12295                 }
12296         }
12297 }
12298 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
12299         fn clone(&self) -> Self {
12300                 if self.result_ok {
12301                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12302                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
12303                         } }
12304                 } else {
12305                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12306                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12307                         } }
12308                 }
12309         }
12310 }
12311 #[no_mangle]
12312 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
12313 /// but with all dynamically-allocated buffers duplicated in new buffers.
12314 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
12315 #[repr(C)]
12316 /// The contents of CResult_TxAddInputDecodeErrorZ
12317 pub union CResult_TxAddInputDecodeErrorZPtr {
12318         /// A pointer to the contents in the success state.
12319         /// Reading from this pointer when `result_ok` is not set is undefined.
12320         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
12321         /// A pointer to the contents in the error state.
12322         /// Reading from this pointer when `result_ok` is set is undefined.
12323         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12324 }
12325 #[repr(C)]
12326 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
12327 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12329 pub struct CResult_TxAddInputDecodeErrorZ {
12330         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
12331         /// `err` or `result` depending on the state of `result_ok`.
12332         pub contents: CResult_TxAddInputDecodeErrorZPtr,
12333         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
12334         pub result_ok: bool,
12335 }
12336 #[no_mangle]
12337 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
12338 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
12339         CResult_TxAddInputDecodeErrorZ {
12340                 contents: CResult_TxAddInputDecodeErrorZPtr {
12341                         result: Box::into_raw(Box::new(o)),
12342                 },
12343                 result_ok: true,
12344         }
12345 }
12346 #[no_mangle]
12347 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
12348 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
12349         CResult_TxAddInputDecodeErrorZ {
12350                 contents: CResult_TxAddInputDecodeErrorZPtr {
12351                         err: Box::into_raw(Box::new(e)),
12352                 },
12353                 result_ok: false,
12354         }
12355 }
12356 /// Checks if the given object is currently in the success state
12357 #[no_mangle]
12358 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
12359         o.result_ok
12360 }
12361 #[no_mangle]
12362 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
12363 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
12364 impl Drop for CResult_TxAddInputDecodeErrorZ {
12365         fn drop(&mut self) {
12366                 if self.result_ok {
12367                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12368                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12369                         }
12370                 } else {
12371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12373                         }
12374                 }
12375         }
12376 }
12377 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
12378         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12379                 let contents = if o.result_ok {
12380                         let result = unsafe { o.contents.result };
12381                         unsafe { o.contents.result = core::ptr::null_mut() };
12382                         CResult_TxAddInputDecodeErrorZPtr { result }
12383                 } else {
12384                         let err = unsafe { o.contents.err };
12385                         unsafe { o.contents.err = core::ptr::null_mut(); }
12386                         CResult_TxAddInputDecodeErrorZPtr { err }
12387                 };
12388                 Self {
12389                         contents,
12390                         result_ok: o.result_ok,
12391                 }
12392         }
12393 }
12394 impl Clone for CResult_TxAddInputDecodeErrorZ {
12395         fn clone(&self) -> Self {
12396                 if self.result_ok {
12397                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
12398                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
12399                         } }
12400                 } else {
12401                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
12402                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12403                         } }
12404                 }
12405         }
12406 }
12407 #[no_mangle]
12408 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
12409 /// but with all dynamically-allocated buffers duplicated in new buffers.
12410 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
12411 #[repr(C)]
12412 /// The contents of CResult_TxAddOutputDecodeErrorZ
12413 pub union CResult_TxAddOutputDecodeErrorZPtr {
12414         /// A pointer to the contents in the success state.
12415         /// Reading from this pointer when `result_ok` is not set is undefined.
12416         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
12417         /// A pointer to the contents in the error state.
12418         /// Reading from this pointer when `result_ok` is set is undefined.
12419         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12420 }
12421 #[repr(C)]
12422 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
12423 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12425 pub struct CResult_TxAddOutputDecodeErrorZ {
12426         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
12427         /// `err` or `result` depending on the state of `result_ok`.
12428         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
12429         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
12430         pub result_ok: bool,
12431 }
12432 #[no_mangle]
12433 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
12434 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
12435         CResult_TxAddOutputDecodeErrorZ {
12436                 contents: CResult_TxAddOutputDecodeErrorZPtr {
12437                         result: Box::into_raw(Box::new(o)),
12438                 },
12439                 result_ok: true,
12440         }
12441 }
12442 #[no_mangle]
12443 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
12444 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
12445         CResult_TxAddOutputDecodeErrorZ {
12446                 contents: CResult_TxAddOutputDecodeErrorZPtr {
12447                         err: Box::into_raw(Box::new(e)),
12448                 },
12449                 result_ok: false,
12450         }
12451 }
12452 /// Checks if the given object is currently in the success state
12453 #[no_mangle]
12454 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
12455         o.result_ok
12456 }
12457 #[no_mangle]
12458 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
12459 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
12460 impl Drop for CResult_TxAddOutputDecodeErrorZ {
12461         fn drop(&mut self) {
12462                 if self.result_ok {
12463                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12464                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12465                         }
12466                 } else {
12467                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12468                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12469                         }
12470                 }
12471         }
12472 }
12473 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
12474         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12475                 let contents = if o.result_ok {
12476                         let result = unsafe { o.contents.result };
12477                         unsafe { o.contents.result = core::ptr::null_mut() };
12478                         CResult_TxAddOutputDecodeErrorZPtr { result }
12479                 } else {
12480                         let err = unsafe { o.contents.err };
12481                         unsafe { o.contents.err = core::ptr::null_mut(); }
12482                         CResult_TxAddOutputDecodeErrorZPtr { err }
12483                 };
12484                 Self {
12485                         contents,
12486                         result_ok: o.result_ok,
12487                 }
12488         }
12489 }
12490 impl Clone for CResult_TxAddOutputDecodeErrorZ {
12491         fn clone(&self) -> Self {
12492                 if self.result_ok {
12493                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
12494                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
12495                         } }
12496                 } else {
12497                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
12498                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12499                         } }
12500                 }
12501         }
12502 }
12503 #[no_mangle]
12504 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
12505 /// but with all dynamically-allocated buffers duplicated in new buffers.
12506 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
12507 #[repr(C)]
12508 /// The contents of CResult_TxRemoveInputDecodeErrorZ
12509 pub union CResult_TxRemoveInputDecodeErrorZPtr {
12510         /// A pointer to the contents in the success state.
12511         /// Reading from this pointer when `result_ok` is not set is undefined.
12512         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
12513         /// A pointer to the contents in the error state.
12514         /// Reading from this pointer when `result_ok` is set is undefined.
12515         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12516 }
12517 #[repr(C)]
12518 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
12519 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12520 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12521 pub struct CResult_TxRemoveInputDecodeErrorZ {
12522         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
12523         /// `err` or `result` depending on the state of `result_ok`.
12524         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
12525         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
12526         pub result_ok: bool,
12527 }
12528 #[no_mangle]
12529 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
12530 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
12531         CResult_TxRemoveInputDecodeErrorZ {
12532                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
12533                         result: Box::into_raw(Box::new(o)),
12534                 },
12535                 result_ok: true,
12536         }
12537 }
12538 #[no_mangle]
12539 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
12540 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
12541         CResult_TxRemoveInputDecodeErrorZ {
12542                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
12543                         err: Box::into_raw(Box::new(e)),
12544                 },
12545                 result_ok: false,
12546         }
12547 }
12548 /// Checks if the given object is currently in the success state
12549 #[no_mangle]
12550 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
12551         o.result_ok
12552 }
12553 #[no_mangle]
12554 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
12555 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
12556 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
12557         fn drop(&mut self) {
12558                 if self.result_ok {
12559                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12560                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12561                         }
12562                 } else {
12563                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12564                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12565                         }
12566                 }
12567         }
12568 }
12569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
12570         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12571                 let contents = if o.result_ok {
12572                         let result = unsafe { o.contents.result };
12573                         unsafe { o.contents.result = core::ptr::null_mut() };
12574                         CResult_TxRemoveInputDecodeErrorZPtr { result }
12575                 } else {
12576                         let err = unsafe { o.contents.err };
12577                         unsafe { o.contents.err = core::ptr::null_mut(); }
12578                         CResult_TxRemoveInputDecodeErrorZPtr { err }
12579                 };
12580                 Self {
12581                         contents,
12582                         result_ok: o.result_ok,
12583                 }
12584         }
12585 }
12586 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
12587         fn clone(&self) -> Self {
12588                 if self.result_ok {
12589                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
12590                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
12591                         } }
12592                 } else {
12593                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
12594                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12595                         } }
12596                 }
12597         }
12598 }
12599 #[no_mangle]
12600 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
12601 /// but with all dynamically-allocated buffers duplicated in new buffers.
12602 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
12603 #[repr(C)]
12604 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
12605 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
12606         /// A pointer to the contents in the success state.
12607         /// Reading from this pointer when `result_ok` is not set is undefined.
12608         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
12609         /// A pointer to the contents in the error state.
12610         /// Reading from this pointer when `result_ok` is set is undefined.
12611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12612 }
12613 #[repr(C)]
12614 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
12615 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12617 pub struct CResult_TxRemoveOutputDecodeErrorZ {
12618         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
12619         /// `err` or `result` depending on the state of `result_ok`.
12620         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
12621         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
12622         pub result_ok: bool,
12623 }
12624 #[no_mangle]
12625 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
12626 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
12627         CResult_TxRemoveOutputDecodeErrorZ {
12628                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12629                         result: Box::into_raw(Box::new(o)),
12630                 },
12631                 result_ok: true,
12632         }
12633 }
12634 #[no_mangle]
12635 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
12636 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
12637         CResult_TxRemoveOutputDecodeErrorZ {
12638                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12639                         err: Box::into_raw(Box::new(e)),
12640                 },
12641                 result_ok: false,
12642         }
12643 }
12644 /// Checks if the given object is currently in the success state
12645 #[no_mangle]
12646 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
12647         o.result_ok
12648 }
12649 #[no_mangle]
12650 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
12651 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
12652 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
12653         fn drop(&mut self) {
12654                 if self.result_ok {
12655                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12656                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12657                         }
12658                 } else {
12659                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12660                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12661                         }
12662                 }
12663         }
12664 }
12665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
12666         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12667                 let contents = if o.result_ok {
12668                         let result = unsafe { o.contents.result };
12669                         unsafe { o.contents.result = core::ptr::null_mut() };
12670                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
12671                 } else {
12672                         let err = unsafe { o.contents.err };
12673                         unsafe { o.contents.err = core::ptr::null_mut(); }
12674                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
12675                 };
12676                 Self {
12677                         contents,
12678                         result_ok: o.result_ok,
12679                 }
12680         }
12681 }
12682 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
12683         fn clone(&self) -> Self {
12684                 if self.result_ok {
12685                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12686                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
12687                         } }
12688                 } else {
12689                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12690                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12691                         } }
12692                 }
12693         }
12694 }
12695 #[no_mangle]
12696 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
12697 /// but with all dynamically-allocated buffers duplicated in new buffers.
12698 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
12699 #[repr(C)]
12700 /// The contents of CResult_TxCompleteDecodeErrorZ
12701 pub union CResult_TxCompleteDecodeErrorZPtr {
12702         /// A pointer to the contents in the success state.
12703         /// Reading from this pointer when `result_ok` is not set is undefined.
12704         pub result: *mut crate::lightning::ln::msgs::TxComplete,
12705         /// A pointer to the contents in the error state.
12706         /// Reading from this pointer when `result_ok` is set is undefined.
12707         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12708 }
12709 #[repr(C)]
12710 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
12711 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
12712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12713 pub struct CResult_TxCompleteDecodeErrorZ {
12714         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
12715         /// `err` or `result` depending on the state of `result_ok`.
12716         pub contents: CResult_TxCompleteDecodeErrorZPtr,
12717         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
12718         pub result_ok: bool,
12719 }
12720 #[no_mangle]
12721 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
12722 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
12723         CResult_TxCompleteDecodeErrorZ {
12724                 contents: CResult_TxCompleteDecodeErrorZPtr {
12725                         result: Box::into_raw(Box::new(o)),
12726                 },
12727                 result_ok: true,
12728         }
12729 }
12730 #[no_mangle]
12731 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
12732 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
12733         CResult_TxCompleteDecodeErrorZ {
12734                 contents: CResult_TxCompleteDecodeErrorZPtr {
12735                         err: Box::into_raw(Box::new(e)),
12736                 },
12737                 result_ok: false,
12738         }
12739 }
12740 /// Checks if the given object is currently in the success state
12741 #[no_mangle]
12742 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
12743         o.result_ok
12744 }
12745 #[no_mangle]
12746 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
12747 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
12748 impl Drop for CResult_TxCompleteDecodeErrorZ {
12749         fn drop(&mut self) {
12750                 if self.result_ok {
12751                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12752                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12753                         }
12754                 } else {
12755                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12756                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12757                         }
12758                 }
12759         }
12760 }
12761 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
12762         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
12763                 let contents = if o.result_ok {
12764                         let result = unsafe { o.contents.result };
12765                         unsafe { o.contents.result = core::ptr::null_mut() };
12766                         CResult_TxCompleteDecodeErrorZPtr { result }
12767                 } else {
12768                         let err = unsafe { o.contents.err };
12769                         unsafe { o.contents.err = core::ptr::null_mut(); }
12770                         CResult_TxCompleteDecodeErrorZPtr { err }
12771                 };
12772                 Self {
12773                         contents,
12774                         result_ok: o.result_ok,
12775                 }
12776         }
12777 }
12778 impl Clone for CResult_TxCompleteDecodeErrorZ {
12779         fn clone(&self) -> Self {
12780                 if self.result_ok {
12781                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
12782                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
12783                         } }
12784                 } else {
12785                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
12786                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12787                         } }
12788                 }
12789         }
12790 }
12791 #[no_mangle]
12792 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
12793 /// but with all dynamically-allocated buffers duplicated in new buffers.
12794 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
12795 #[repr(C)]
12796 /// The contents of CResult_TxSignaturesDecodeErrorZ
12797 pub union CResult_TxSignaturesDecodeErrorZPtr {
12798         /// A pointer to the contents in the success state.
12799         /// Reading from this pointer when `result_ok` is not set is undefined.
12800         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
12801         /// A pointer to the contents in the error state.
12802         /// Reading from this pointer when `result_ok` is set is undefined.
12803         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12804 }
12805 #[repr(C)]
12806 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
12807 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12809 pub struct CResult_TxSignaturesDecodeErrorZ {
12810         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
12811         /// `err` or `result` depending on the state of `result_ok`.
12812         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
12813         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
12814         pub result_ok: bool,
12815 }
12816 #[no_mangle]
12817 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
12818 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
12819         CResult_TxSignaturesDecodeErrorZ {
12820                 contents: CResult_TxSignaturesDecodeErrorZPtr {
12821                         result: Box::into_raw(Box::new(o)),
12822                 },
12823                 result_ok: true,
12824         }
12825 }
12826 #[no_mangle]
12827 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
12828 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
12829         CResult_TxSignaturesDecodeErrorZ {
12830                 contents: CResult_TxSignaturesDecodeErrorZPtr {
12831                         err: Box::into_raw(Box::new(e)),
12832                 },
12833                 result_ok: false,
12834         }
12835 }
12836 /// Checks if the given object is currently in the success state
12837 #[no_mangle]
12838 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
12839         o.result_ok
12840 }
12841 #[no_mangle]
12842 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
12843 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
12844 impl Drop for CResult_TxSignaturesDecodeErrorZ {
12845         fn drop(&mut self) {
12846                 if self.result_ok {
12847                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12848                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12849                         }
12850                 } else {
12851                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12852                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12853                         }
12854                 }
12855         }
12856 }
12857 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
12858         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12859                 let contents = if o.result_ok {
12860                         let result = unsafe { o.contents.result };
12861                         unsafe { o.contents.result = core::ptr::null_mut() };
12862                         CResult_TxSignaturesDecodeErrorZPtr { result }
12863                 } else {
12864                         let err = unsafe { o.contents.err };
12865                         unsafe { o.contents.err = core::ptr::null_mut(); }
12866                         CResult_TxSignaturesDecodeErrorZPtr { err }
12867                 };
12868                 Self {
12869                         contents,
12870                         result_ok: o.result_ok,
12871                 }
12872         }
12873 }
12874 impl Clone for CResult_TxSignaturesDecodeErrorZ {
12875         fn clone(&self) -> Self {
12876                 if self.result_ok {
12877                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
12878                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
12879                         } }
12880                 } else {
12881                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
12882                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12883                         } }
12884                 }
12885         }
12886 }
12887 #[no_mangle]
12888 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
12889 /// but with all dynamically-allocated buffers duplicated in new buffers.
12890 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
12891 #[repr(C)]
12892 /// The contents of CResult_TxInitRbfDecodeErrorZ
12893 pub union CResult_TxInitRbfDecodeErrorZPtr {
12894         /// A pointer to the contents in the success state.
12895         /// Reading from this pointer when `result_ok` is not set is undefined.
12896         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
12897         /// A pointer to the contents in the error state.
12898         /// Reading from this pointer when `result_ok` is set is undefined.
12899         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12900 }
12901 #[repr(C)]
12902 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
12903 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
12904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12905 pub struct CResult_TxInitRbfDecodeErrorZ {
12906         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
12907         /// `err` or `result` depending on the state of `result_ok`.
12908         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
12909         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
12910         pub result_ok: bool,
12911 }
12912 #[no_mangle]
12913 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
12914 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
12915         CResult_TxInitRbfDecodeErrorZ {
12916                 contents: CResult_TxInitRbfDecodeErrorZPtr {
12917                         result: Box::into_raw(Box::new(o)),
12918                 },
12919                 result_ok: true,
12920         }
12921 }
12922 #[no_mangle]
12923 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
12924 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
12925         CResult_TxInitRbfDecodeErrorZ {
12926                 contents: CResult_TxInitRbfDecodeErrorZPtr {
12927                         err: Box::into_raw(Box::new(e)),
12928                 },
12929                 result_ok: false,
12930         }
12931 }
12932 /// Checks if the given object is currently in the success state
12933 #[no_mangle]
12934 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
12935         o.result_ok
12936 }
12937 #[no_mangle]
12938 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
12939 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
12940 impl Drop for CResult_TxInitRbfDecodeErrorZ {
12941         fn drop(&mut self) {
12942                 if self.result_ok {
12943                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12944                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12945                         }
12946                 } else {
12947                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12948                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12949                         }
12950                 }
12951         }
12952 }
12953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
12954         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
12955                 let contents = if o.result_ok {
12956                         let result = unsafe { o.contents.result };
12957                         unsafe { o.contents.result = core::ptr::null_mut() };
12958                         CResult_TxInitRbfDecodeErrorZPtr { result }
12959                 } else {
12960                         let err = unsafe { o.contents.err };
12961                         unsafe { o.contents.err = core::ptr::null_mut(); }
12962                         CResult_TxInitRbfDecodeErrorZPtr { err }
12963                 };
12964                 Self {
12965                         contents,
12966                         result_ok: o.result_ok,
12967                 }
12968         }
12969 }
12970 impl Clone for CResult_TxInitRbfDecodeErrorZ {
12971         fn clone(&self) -> Self {
12972                 if self.result_ok {
12973                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
12974                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
12975                         } }
12976                 } else {
12977                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
12978                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12979                         } }
12980                 }
12981         }
12982 }
12983 #[no_mangle]
12984 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
12985 /// but with all dynamically-allocated buffers duplicated in new buffers.
12986 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
12987 #[repr(C)]
12988 /// The contents of CResult_TxAckRbfDecodeErrorZ
12989 pub union CResult_TxAckRbfDecodeErrorZPtr {
12990         /// A pointer to the contents in the success state.
12991         /// Reading from this pointer when `result_ok` is not set is undefined.
12992         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
12993         /// A pointer to the contents in the error state.
12994         /// Reading from this pointer when `result_ok` is set is undefined.
12995         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12996 }
12997 #[repr(C)]
12998 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
12999 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
13000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13001 pub struct CResult_TxAckRbfDecodeErrorZ {
13002         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
13003         /// `err` or `result` depending on the state of `result_ok`.
13004         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
13005         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
13006         pub result_ok: bool,
13007 }
13008 #[no_mangle]
13009 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
13010 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
13011         CResult_TxAckRbfDecodeErrorZ {
13012                 contents: CResult_TxAckRbfDecodeErrorZPtr {
13013                         result: Box::into_raw(Box::new(o)),
13014                 },
13015                 result_ok: true,
13016         }
13017 }
13018 #[no_mangle]
13019 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
13020 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
13021         CResult_TxAckRbfDecodeErrorZ {
13022                 contents: CResult_TxAckRbfDecodeErrorZPtr {
13023                         err: Box::into_raw(Box::new(e)),
13024                 },
13025                 result_ok: false,
13026         }
13027 }
13028 /// Checks if the given object is currently in the success state
13029 #[no_mangle]
13030 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
13031         o.result_ok
13032 }
13033 #[no_mangle]
13034 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
13035 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
13036 impl Drop for CResult_TxAckRbfDecodeErrorZ {
13037         fn drop(&mut self) {
13038                 if self.result_ok {
13039                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13040                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13041                         }
13042                 } else {
13043                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13044                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13045                         }
13046                 }
13047         }
13048 }
13049 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
13050         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
13051                 let contents = if o.result_ok {
13052                         let result = unsafe { o.contents.result };
13053                         unsafe { o.contents.result = core::ptr::null_mut() };
13054                         CResult_TxAckRbfDecodeErrorZPtr { result }
13055                 } else {
13056                         let err = unsafe { o.contents.err };
13057                         unsafe { o.contents.err = core::ptr::null_mut(); }
13058                         CResult_TxAckRbfDecodeErrorZPtr { err }
13059                 };
13060                 Self {
13061                         contents,
13062                         result_ok: o.result_ok,
13063                 }
13064         }
13065 }
13066 impl Clone for CResult_TxAckRbfDecodeErrorZ {
13067         fn clone(&self) -> Self {
13068                 if self.result_ok {
13069                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
13070                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
13071                         } }
13072                 } else {
13073                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
13074                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13075                         } }
13076                 }
13077         }
13078 }
13079 #[no_mangle]
13080 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
13081 /// but with all dynamically-allocated buffers duplicated in new buffers.
13082 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
13083 #[repr(C)]
13084 /// The contents of CResult_TxAbortDecodeErrorZ
13085 pub union CResult_TxAbortDecodeErrorZPtr {
13086         /// A pointer to the contents in the success state.
13087         /// Reading from this pointer when `result_ok` is not set is undefined.
13088         pub result: *mut crate::lightning::ln::msgs::TxAbort,
13089         /// A pointer to the contents in the error state.
13090         /// Reading from this pointer when `result_ok` is set is undefined.
13091         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13092 }
13093 #[repr(C)]
13094 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
13095 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
13096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13097 pub struct CResult_TxAbortDecodeErrorZ {
13098         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
13099         /// `err` or `result` depending on the state of `result_ok`.
13100         pub contents: CResult_TxAbortDecodeErrorZPtr,
13101         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
13102         pub result_ok: bool,
13103 }
13104 #[no_mangle]
13105 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
13106 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
13107         CResult_TxAbortDecodeErrorZ {
13108                 contents: CResult_TxAbortDecodeErrorZPtr {
13109                         result: Box::into_raw(Box::new(o)),
13110                 },
13111                 result_ok: true,
13112         }
13113 }
13114 #[no_mangle]
13115 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
13116 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
13117         CResult_TxAbortDecodeErrorZ {
13118                 contents: CResult_TxAbortDecodeErrorZPtr {
13119                         err: Box::into_raw(Box::new(e)),
13120                 },
13121                 result_ok: false,
13122         }
13123 }
13124 /// Checks if the given object is currently in the success state
13125 #[no_mangle]
13126 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
13127         o.result_ok
13128 }
13129 #[no_mangle]
13130 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
13131 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
13132 impl Drop for CResult_TxAbortDecodeErrorZ {
13133         fn drop(&mut self) {
13134                 if self.result_ok {
13135                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13136                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13137                         }
13138                 } else {
13139                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13140                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13141                         }
13142                 }
13143         }
13144 }
13145 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
13146         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
13147                 let contents = if o.result_ok {
13148                         let result = unsafe { o.contents.result };
13149                         unsafe { o.contents.result = core::ptr::null_mut() };
13150                         CResult_TxAbortDecodeErrorZPtr { result }
13151                 } else {
13152                         let err = unsafe { o.contents.err };
13153                         unsafe { o.contents.err = core::ptr::null_mut(); }
13154                         CResult_TxAbortDecodeErrorZPtr { err }
13155                 };
13156                 Self {
13157                         contents,
13158                         result_ok: o.result_ok,
13159                 }
13160         }
13161 }
13162 impl Clone for CResult_TxAbortDecodeErrorZ {
13163         fn clone(&self) -> Self {
13164                 if self.result_ok {
13165                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
13166                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
13167                         } }
13168                 } else {
13169                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
13170                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13171                         } }
13172                 }
13173         }
13174 }
13175 #[no_mangle]
13176 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
13177 /// but with all dynamically-allocated buffers duplicated in new buffers.
13178 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
13179 #[repr(C)]
13180 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13181 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13182         /// A pointer to the contents in the success state.
13183         /// Reading from this pointer when `result_ok` is not set is undefined.
13184         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13185         /// A pointer to the contents in the error state.
13186         /// Reading from this pointer when `result_ok` is set is undefined.
13187         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13188 }
13189 #[repr(C)]
13190 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13191 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13192 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13193 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13194         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13195         /// `err` or `result` depending on the state of `result_ok`.
13196         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13197         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13198         pub result_ok: bool,
13199 }
13200 #[no_mangle]
13201 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13202 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13203         CResult_AnnouncementSignaturesDecodeErrorZ {
13204                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13205                         result: Box::into_raw(Box::new(o)),
13206                 },
13207                 result_ok: true,
13208         }
13209 }
13210 #[no_mangle]
13211 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13212 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13213         CResult_AnnouncementSignaturesDecodeErrorZ {
13214                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13215                         err: Box::into_raw(Box::new(e)),
13216                 },
13217                 result_ok: false,
13218         }
13219 }
13220 /// Checks if the given object is currently in the success state
13221 #[no_mangle]
13222 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13223         o.result_ok
13224 }
13225 #[no_mangle]
13226 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13227 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13228 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13229         fn drop(&mut self) {
13230                 if self.result_ok {
13231                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13232                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13233                         }
13234                 } else {
13235                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13236                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13237                         }
13238                 }
13239         }
13240 }
13241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13242         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13243                 let contents = if o.result_ok {
13244                         let result = unsafe { o.contents.result };
13245                         unsafe { o.contents.result = core::ptr::null_mut() };
13246                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13247                 } else {
13248                         let err = unsafe { o.contents.err };
13249                         unsafe { o.contents.err = core::ptr::null_mut(); }
13250                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13251                 };
13252                 Self {
13253                         contents,
13254                         result_ok: o.result_ok,
13255                 }
13256         }
13257 }
13258 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13259         fn clone(&self) -> Self {
13260                 if self.result_ok {
13261                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13262                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13263                         } }
13264                 } else {
13265                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13266                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13267                         } }
13268                 }
13269         }
13270 }
13271 #[no_mangle]
13272 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13273 /// but with all dynamically-allocated buffers duplicated in new buffers.
13274 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13275 #[repr(C)]
13276 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13277 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13278         /// A pointer to the contents in the success state.
13279         /// Reading from this pointer when `result_ok` is not set is undefined.
13280         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13281         /// A pointer to the contents in the error state.
13282         /// Reading from this pointer when `result_ok` is set is undefined.
13283         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13284 }
13285 #[repr(C)]
13286 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13287 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13289 pub struct CResult_ChannelReestablishDecodeErrorZ {
13290         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13291         /// `err` or `result` depending on the state of `result_ok`.
13292         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13293         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13294         pub result_ok: bool,
13295 }
13296 #[no_mangle]
13297 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13298 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13299         CResult_ChannelReestablishDecodeErrorZ {
13300                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13301                         result: Box::into_raw(Box::new(o)),
13302                 },
13303                 result_ok: true,
13304         }
13305 }
13306 #[no_mangle]
13307 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13308 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13309         CResult_ChannelReestablishDecodeErrorZ {
13310                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13311                         err: Box::into_raw(Box::new(e)),
13312                 },
13313                 result_ok: false,
13314         }
13315 }
13316 /// Checks if the given object is currently in the success state
13317 #[no_mangle]
13318 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13319         o.result_ok
13320 }
13321 #[no_mangle]
13322 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13323 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13324 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13325         fn drop(&mut self) {
13326                 if self.result_ok {
13327                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13328                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13329                         }
13330                 } else {
13331                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13332                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13333                         }
13334                 }
13335         }
13336 }
13337 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13338         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13339                 let contents = if o.result_ok {
13340                         let result = unsafe { o.contents.result };
13341                         unsafe { o.contents.result = core::ptr::null_mut() };
13342                         CResult_ChannelReestablishDecodeErrorZPtr { result }
13343                 } else {
13344                         let err = unsafe { o.contents.err };
13345                         unsafe { o.contents.err = core::ptr::null_mut(); }
13346                         CResult_ChannelReestablishDecodeErrorZPtr { err }
13347                 };
13348                 Self {
13349                         contents,
13350                         result_ok: o.result_ok,
13351                 }
13352         }
13353 }
13354 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13355         fn clone(&self) -> Self {
13356                 if self.result_ok {
13357                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13358                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13359                         } }
13360                 } else {
13361                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13362                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13363                         } }
13364                 }
13365         }
13366 }
13367 #[no_mangle]
13368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13369 /// but with all dynamically-allocated buffers duplicated in new buffers.
13370 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13371 #[repr(C)]
13372 /// The contents of CResult_ClosingSignedDecodeErrorZ
13373 pub union CResult_ClosingSignedDecodeErrorZPtr {
13374         /// A pointer to the contents in the success state.
13375         /// Reading from this pointer when `result_ok` is not set is undefined.
13376         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13377         /// A pointer to the contents in the error state.
13378         /// Reading from this pointer when `result_ok` is set is undefined.
13379         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13380 }
13381 #[repr(C)]
13382 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13383 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13385 pub struct CResult_ClosingSignedDecodeErrorZ {
13386         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13387         /// `err` or `result` depending on the state of `result_ok`.
13388         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13389         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13390         pub result_ok: bool,
13391 }
13392 #[no_mangle]
13393 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13394 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13395         CResult_ClosingSignedDecodeErrorZ {
13396                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13397                         result: Box::into_raw(Box::new(o)),
13398                 },
13399                 result_ok: true,
13400         }
13401 }
13402 #[no_mangle]
13403 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13404 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13405         CResult_ClosingSignedDecodeErrorZ {
13406                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13407                         err: Box::into_raw(Box::new(e)),
13408                 },
13409                 result_ok: false,
13410         }
13411 }
13412 /// Checks if the given object is currently in the success state
13413 #[no_mangle]
13414 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13415         o.result_ok
13416 }
13417 #[no_mangle]
13418 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13419 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13420 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13421         fn drop(&mut self) {
13422                 if self.result_ok {
13423                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13424                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13425                         }
13426                 } else {
13427                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13428                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13429                         }
13430                 }
13431         }
13432 }
13433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13434         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13435                 let contents = if o.result_ok {
13436                         let result = unsafe { o.contents.result };
13437                         unsafe { o.contents.result = core::ptr::null_mut() };
13438                         CResult_ClosingSignedDecodeErrorZPtr { result }
13439                 } else {
13440                         let err = unsafe { o.contents.err };
13441                         unsafe { o.contents.err = core::ptr::null_mut(); }
13442                         CResult_ClosingSignedDecodeErrorZPtr { err }
13443                 };
13444                 Self {
13445                         contents,
13446                         result_ok: o.result_ok,
13447                 }
13448         }
13449 }
13450 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13451         fn clone(&self) -> Self {
13452                 if self.result_ok {
13453                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13454                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13455                         } }
13456                 } else {
13457                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13458                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13459                         } }
13460                 }
13461         }
13462 }
13463 #[no_mangle]
13464 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13465 /// but with all dynamically-allocated buffers duplicated in new buffers.
13466 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13467 #[repr(C)]
13468 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13469 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13470         /// A pointer to the contents in the success state.
13471         /// Reading from this pointer when `result_ok` is not set is undefined.
13472         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13473         /// A pointer to the contents in the error state.
13474         /// Reading from this pointer when `result_ok` is set is undefined.
13475         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13476 }
13477 #[repr(C)]
13478 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13479 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13480 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13481 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13482         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13483         /// `err` or `result` depending on the state of `result_ok`.
13484         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13485         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13486         pub result_ok: bool,
13487 }
13488 #[no_mangle]
13489 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13490 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13491         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13492                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13493                         result: Box::into_raw(Box::new(o)),
13494                 },
13495                 result_ok: true,
13496         }
13497 }
13498 #[no_mangle]
13499 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13500 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13501         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13502                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13503                         err: Box::into_raw(Box::new(e)),
13504                 },
13505                 result_ok: false,
13506         }
13507 }
13508 /// Checks if the given object is currently in the success state
13509 #[no_mangle]
13510 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13511         o.result_ok
13512 }
13513 #[no_mangle]
13514 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13515 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13516 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13517         fn drop(&mut self) {
13518                 if self.result_ok {
13519                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13520                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13521                         }
13522                 } else {
13523                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13524                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13525                         }
13526                 }
13527         }
13528 }
13529 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13530         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13531                 let contents = if o.result_ok {
13532                         let result = unsafe { o.contents.result };
13533                         unsafe { o.contents.result = core::ptr::null_mut() };
13534                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13535                 } else {
13536                         let err = unsafe { o.contents.err };
13537                         unsafe { o.contents.err = core::ptr::null_mut(); }
13538                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13539                 };
13540                 Self {
13541                         contents,
13542                         result_ok: o.result_ok,
13543                 }
13544         }
13545 }
13546 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13547         fn clone(&self) -> Self {
13548                 if self.result_ok {
13549                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13550                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13551                         } }
13552                 } else {
13553                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13554                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13555                         } }
13556                 }
13557         }
13558 }
13559 #[no_mangle]
13560 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13561 /// but with all dynamically-allocated buffers duplicated in new buffers.
13562 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13563 #[repr(C)]
13564 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13565 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13566         /// A pointer to the contents in the success state.
13567         /// Reading from this pointer when `result_ok` is not set is undefined.
13568         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13569         /// A pointer to the contents in the error state.
13570         /// Reading from this pointer when `result_ok` is set is undefined.
13571         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13572 }
13573 #[repr(C)]
13574 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13575 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13576 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13577 pub struct CResult_CommitmentSignedDecodeErrorZ {
13578         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13579         /// `err` or `result` depending on the state of `result_ok`.
13580         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13581         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13582         pub result_ok: bool,
13583 }
13584 #[no_mangle]
13585 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13586 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13587         CResult_CommitmentSignedDecodeErrorZ {
13588                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13589                         result: Box::into_raw(Box::new(o)),
13590                 },
13591                 result_ok: true,
13592         }
13593 }
13594 #[no_mangle]
13595 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13596 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13597         CResult_CommitmentSignedDecodeErrorZ {
13598                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13599                         err: Box::into_raw(Box::new(e)),
13600                 },
13601                 result_ok: false,
13602         }
13603 }
13604 /// Checks if the given object is currently in the success state
13605 #[no_mangle]
13606 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13607         o.result_ok
13608 }
13609 #[no_mangle]
13610 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13611 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13612 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13613         fn drop(&mut self) {
13614                 if self.result_ok {
13615                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13616                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13617                         }
13618                 } else {
13619                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13620                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13621                         }
13622                 }
13623         }
13624 }
13625 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13626         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13627                 let contents = if o.result_ok {
13628                         let result = unsafe { o.contents.result };
13629                         unsafe { o.contents.result = core::ptr::null_mut() };
13630                         CResult_CommitmentSignedDecodeErrorZPtr { result }
13631                 } else {
13632                         let err = unsafe { o.contents.err };
13633                         unsafe { o.contents.err = core::ptr::null_mut(); }
13634                         CResult_CommitmentSignedDecodeErrorZPtr { err }
13635                 };
13636                 Self {
13637                         contents,
13638                         result_ok: o.result_ok,
13639                 }
13640         }
13641 }
13642 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13643         fn clone(&self) -> Self {
13644                 if self.result_ok {
13645                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13646                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13647                         } }
13648                 } else {
13649                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13650                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13651                         } }
13652                 }
13653         }
13654 }
13655 #[no_mangle]
13656 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13657 /// but with all dynamically-allocated buffers duplicated in new buffers.
13658 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13659 #[repr(C)]
13660 /// The contents of CResult_FundingCreatedDecodeErrorZ
13661 pub union CResult_FundingCreatedDecodeErrorZPtr {
13662         /// A pointer to the contents in the success state.
13663         /// Reading from this pointer when `result_ok` is not set is undefined.
13664         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13665         /// A pointer to the contents in the error state.
13666         /// Reading from this pointer when `result_ok` is set is undefined.
13667         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13668 }
13669 #[repr(C)]
13670 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13671 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13673 pub struct CResult_FundingCreatedDecodeErrorZ {
13674         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13675         /// `err` or `result` depending on the state of `result_ok`.
13676         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13677         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13678         pub result_ok: bool,
13679 }
13680 #[no_mangle]
13681 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13682 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13683         CResult_FundingCreatedDecodeErrorZ {
13684                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13685                         result: Box::into_raw(Box::new(o)),
13686                 },
13687                 result_ok: true,
13688         }
13689 }
13690 #[no_mangle]
13691 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13693         CResult_FundingCreatedDecodeErrorZ {
13694                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13695                         err: Box::into_raw(Box::new(e)),
13696                 },
13697                 result_ok: false,
13698         }
13699 }
13700 /// Checks if the given object is currently in the success state
13701 #[no_mangle]
13702 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13703         o.result_ok
13704 }
13705 #[no_mangle]
13706 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13707 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13708 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13709         fn drop(&mut self) {
13710                 if self.result_ok {
13711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13713                         }
13714                 } else {
13715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13717                         }
13718                 }
13719         }
13720 }
13721 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13722         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13723                 let contents = if o.result_ok {
13724                         let result = unsafe { o.contents.result };
13725                         unsafe { o.contents.result = core::ptr::null_mut() };
13726                         CResult_FundingCreatedDecodeErrorZPtr { result }
13727                 } else {
13728                         let err = unsafe { o.contents.err };
13729                         unsafe { o.contents.err = core::ptr::null_mut(); }
13730                         CResult_FundingCreatedDecodeErrorZPtr { err }
13731                 };
13732                 Self {
13733                         contents,
13734                         result_ok: o.result_ok,
13735                 }
13736         }
13737 }
13738 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13739         fn clone(&self) -> Self {
13740                 if self.result_ok {
13741                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13742                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13743                         } }
13744                 } else {
13745                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13746                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13747                         } }
13748                 }
13749         }
13750 }
13751 #[no_mangle]
13752 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13753 /// but with all dynamically-allocated buffers duplicated in new buffers.
13754 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13755 #[repr(C)]
13756 /// The contents of CResult_FundingSignedDecodeErrorZ
13757 pub union CResult_FundingSignedDecodeErrorZPtr {
13758         /// A pointer to the contents in the success state.
13759         /// Reading from this pointer when `result_ok` is not set is undefined.
13760         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13761         /// A pointer to the contents in the error state.
13762         /// Reading from this pointer when `result_ok` is set is undefined.
13763         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13764 }
13765 #[repr(C)]
13766 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13767 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13769 pub struct CResult_FundingSignedDecodeErrorZ {
13770         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13771         /// `err` or `result` depending on the state of `result_ok`.
13772         pub contents: CResult_FundingSignedDecodeErrorZPtr,
13773         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13774         pub result_ok: bool,
13775 }
13776 #[no_mangle]
13777 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13778 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13779         CResult_FundingSignedDecodeErrorZ {
13780                 contents: CResult_FundingSignedDecodeErrorZPtr {
13781                         result: Box::into_raw(Box::new(o)),
13782                 },
13783                 result_ok: true,
13784         }
13785 }
13786 #[no_mangle]
13787 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13788 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13789         CResult_FundingSignedDecodeErrorZ {
13790                 contents: CResult_FundingSignedDecodeErrorZPtr {
13791                         err: Box::into_raw(Box::new(e)),
13792                 },
13793                 result_ok: false,
13794         }
13795 }
13796 /// Checks if the given object is currently in the success state
13797 #[no_mangle]
13798 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13799         o.result_ok
13800 }
13801 #[no_mangle]
13802 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13803 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13804 impl Drop for CResult_FundingSignedDecodeErrorZ {
13805         fn drop(&mut self) {
13806                 if self.result_ok {
13807                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13808                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13809                         }
13810                 } else {
13811                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13812                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13813                         }
13814                 }
13815         }
13816 }
13817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13819                 let contents = if o.result_ok {
13820                         let result = unsafe { o.contents.result };
13821                         unsafe { o.contents.result = core::ptr::null_mut() };
13822                         CResult_FundingSignedDecodeErrorZPtr { result }
13823                 } else {
13824                         let err = unsafe { o.contents.err };
13825                         unsafe { o.contents.err = core::ptr::null_mut(); }
13826                         CResult_FundingSignedDecodeErrorZPtr { err }
13827                 };
13828                 Self {
13829                         contents,
13830                         result_ok: o.result_ok,
13831                 }
13832         }
13833 }
13834 impl Clone for CResult_FundingSignedDecodeErrorZ {
13835         fn clone(&self) -> Self {
13836                 if self.result_ok {
13837                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13838                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13839                         } }
13840                 } else {
13841                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13842                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13843                         } }
13844                 }
13845         }
13846 }
13847 #[no_mangle]
13848 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13849 /// but with all dynamically-allocated buffers duplicated in new buffers.
13850 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13851 #[repr(C)]
13852 /// The contents of CResult_ChannelReadyDecodeErrorZ
13853 pub union CResult_ChannelReadyDecodeErrorZPtr {
13854         /// A pointer to the contents in the success state.
13855         /// Reading from this pointer when `result_ok` is not set is undefined.
13856         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13857         /// A pointer to the contents in the error state.
13858         /// Reading from this pointer when `result_ok` is set is undefined.
13859         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13860 }
13861 #[repr(C)]
13862 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13863 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13865 pub struct CResult_ChannelReadyDecodeErrorZ {
13866         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13867         /// `err` or `result` depending on the state of `result_ok`.
13868         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13869         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13870         pub result_ok: bool,
13871 }
13872 #[no_mangle]
13873 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13874 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13875         CResult_ChannelReadyDecodeErrorZ {
13876                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13877                         result: Box::into_raw(Box::new(o)),
13878                 },
13879                 result_ok: true,
13880         }
13881 }
13882 #[no_mangle]
13883 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13884 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13885         CResult_ChannelReadyDecodeErrorZ {
13886                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13887                         err: Box::into_raw(Box::new(e)),
13888                 },
13889                 result_ok: false,
13890         }
13891 }
13892 /// Checks if the given object is currently in the success state
13893 #[no_mangle]
13894 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13895         o.result_ok
13896 }
13897 #[no_mangle]
13898 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13899 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13900 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13901         fn drop(&mut self) {
13902                 if self.result_ok {
13903                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13904                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13905                         }
13906                 } else {
13907                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13908                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13909                         }
13910                 }
13911         }
13912 }
13913 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13914         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13915                 let contents = if o.result_ok {
13916                         let result = unsafe { o.contents.result };
13917                         unsafe { o.contents.result = core::ptr::null_mut() };
13918                         CResult_ChannelReadyDecodeErrorZPtr { result }
13919                 } else {
13920                         let err = unsafe { o.contents.err };
13921                         unsafe { o.contents.err = core::ptr::null_mut(); }
13922                         CResult_ChannelReadyDecodeErrorZPtr { err }
13923                 };
13924                 Self {
13925                         contents,
13926                         result_ok: o.result_ok,
13927                 }
13928         }
13929 }
13930 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13931         fn clone(&self) -> Self {
13932                 if self.result_ok {
13933                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13934                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13935                         } }
13936                 } else {
13937                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13938                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13939                         } }
13940                 }
13941         }
13942 }
13943 #[no_mangle]
13944 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13945 /// but with all dynamically-allocated buffers duplicated in new buffers.
13946 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13947 #[repr(C)]
13948 /// The contents of CResult_InitDecodeErrorZ
13949 pub union CResult_InitDecodeErrorZPtr {
13950         /// A pointer to the contents in the success state.
13951         /// Reading from this pointer when `result_ok` is not set is undefined.
13952         pub result: *mut crate::lightning::ln::msgs::Init,
13953         /// A pointer to the contents in the error state.
13954         /// Reading from this pointer when `result_ok` is set is undefined.
13955         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13956 }
13957 #[repr(C)]
13958 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13959 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13961 pub struct CResult_InitDecodeErrorZ {
13962         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13963         /// `err` or `result` depending on the state of `result_ok`.
13964         pub contents: CResult_InitDecodeErrorZPtr,
13965         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13966         pub result_ok: bool,
13967 }
13968 #[no_mangle]
13969 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13970 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13971         CResult_InitDecodeErrorZ {
13972                 contents: CResult_InitDecodeErrorZPtr {
13973                         result: Box::into_raw(Box::new(o)),
13974                 },
13975                 result_ok: true,
13976         }
13977 }
13978 #[no_mangle]
13979 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13980 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13981         CResult_InitDecodeErrorZ {
13982                 contents: CResult_InitDecodeErrorZPtr {
13983                         err: Box::into_raw(Box::new(e)),
13984                 },
13985                 result_ok: false,
13986         }
13987 }
13988 /// Checks if the given object is currently in the success state
13989 #[no_mangle]
13990 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13991         o.result_ok
13992 }
13993 #[no_mangle]
13994 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13995 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13996 impl Drop for CResult_InitDecodeErrorZ {
13997         fn drop(&mut self) {
13998                 if self.result_ok {
13999                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14000                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14001                         }
14002                 } else {
14003                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14004                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14005                         }
14006                 }
14007         }
14008 }
14009 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14010         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14011                 let contents = if o.result_ok {
14012                         let result = unsafe { o.contents.result };
14013                         unsafe { o.contents.result = core::ptr::null_mut() };
14014                         CResult_InitDecodeErrorZPtr { result }
14015                 } else {
14016                         let err = unsafe { o.contents.err };
14017                         unsafe { o.contents.err = core::ptr::null_mut(); }
14018                         CResult_InitDecodeErrorZPtr { err }
14019                 };
14020                 Self {
14021                         contents,
14022                         result_ok: o.result_ok,
14023                 }
14024         }
14025 }
14026 impl Clone for CResult_InitDecodeErrorZ {
14027         fn clone(&self) -> Self {
14028                 if self.result_ok {
14029                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14030                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14031                         } }
14032                 } else {
14033                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14034                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14035                         } }
14036                 }
14037         }
14038 }
14039 #[no_mangle]
14040 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14041 /// but with all dynamically-allocated buffers duplicated in new buffers.
14042 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14043 #[repr(C)]
14044 /// The contents of CResult_OpenChannelDecodeErrorZ
14045 pub union CResult_OpenChannelDecodeErrorZPtr {
14046         /// A pointer to the contents in the success state.
14047         /// Reading from this pointer when `result_ok` is not set is undefined.
14048         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14049         /// A pointer to the contents in the error state.
14050         /// Reading from this pointer when `result_ok` is set is undefined.
14051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14052 }
14053 #[repr(C)]
14054 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14055 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14057 pub struct CResult_OpenChannelDecodeErrorZ {
14058         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14059         /// `err` or `result` depending on the state of `result_ok`.
14060         pub contents: CResult_OpenChannelDecodeErrorZPtr,
14061         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14062         pub result_ok: bool,
14063 }
14064 #[no_mangle]
14065 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14066 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14067         CResult_OpenChannelDecodeErrorZ {
14068                 contents: CResult_OpenChannelDecodeErrorZPtr {
14069                         result: Box::into_raw(Box::new(o)),
14070                 },
14071                 result_ok: true,
14072         }
14073 }
14074 #[no_mangle]
14075 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14076 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14077         CResult_OpenChannelDecodeErrorZ {
14078                 contents: CResult_OpenChannelDecodeErrorZPtr {
14079                         err: Box::into_raw(Box::new(e)),
14080                 },
14081                 result_ok: false,
14082         }
14083 }
14084 /// Checks if the given object is currently in the success state
14085 #[no_mangle]
14086 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14087         o.result_ok
14088 }
14089 #[no_mangle]
14090 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14091 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14092 impl Drop for CResult_OpenChannelDecodeErrorZ {
14093         fn drop(&mut self) {
14094                 if self.result_ok {
14095                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14096                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14097                         }
14098                 } else {
14099                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14100                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14101                         }
14102                 }
14103         }
14104 }
14105 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14106         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14107                 let contents = if o.result_ok {
14108                         let result = unsafe { o.contents.result };
14109                         unsafe { o.contents.result = core::ptr::null_mut() };
14110                         CResult_OpenChannelDecodeErrorZPtr { result }
14111                 } else {
14112                         let err = unsafe { o.contents.err };
14113                         unsafe { o.contents.err = core::ptr::null_mut(); }
14114                         CResult_OpenChannelDecodeErrorZPtr { err }
14115                 };
14116                 Self {
14117                         contents,
14118                         result_ok: o.result_ok,
14119                 }
14120         }
14121 }
14122 impl Clone for CResult_OpenChannelDecodeErrorZ {
14123         fn clone(&self) -> Self {
14124                 if self.result_ok {
14125                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14126                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14127                         } }
14128                 } else {
14129                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14130                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14131                         } }
14132                 }
14133         }
14134 }
14135 #[no_mangle]
14136 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14137 /// but with all dynamically-allocated buffers duplicated in new buffers.
14138 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14139 #[repr(C)]
14140 /// The contents of CResult_OpenChannelV2DecodeErrorZ
14141 pub union CResult_OpenChannelV2DecodeErrorZPtr {
14142         /// A pointer to the contents in the success state.
14143         /// Reading from this pointer when `result_ok` is not set is undefined.
14144         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
14145         /// A pointer to the contents in the error state.
14146         /// Reading from this pointer when `result_ok` is set is undefined.
14147         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14148 }
14149 #[repr(C)]
14150 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
14151 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
14152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14153 pub struct CResult_OpenChannelV2DecodeErrorZ {
14154         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
14155         /// `err` or `result` depending on the state of `result_ok`.
14156         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
14157         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
14158         pub result_ok: bool,
14159 }
14160 #[no_mangle]
14161 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
14162 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
14163         CResult_OpenChannelV2DecodeErrorZ {
14164                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
14165                         result: Box::into_raw(Box::new(o)),
14166                 },
14167                 result_ok: true,
14168         }
14169 }
14170 #[no_mangle]
14171 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
14172 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
14173         CResult_OpenChannelV2DecodeErrorZ {
14174                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
14175                         err: Box::into_raw(Box::new(e)),
14176                 },
14177                 result_ok: false,
14178         }
14179 }
14180 /// Checks if the given object is currently in the success state
14181 #[no_mangle]
14182 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
14183         o.result_ok
14184 }
14185 #[no_mangle]
14186 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
14187 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
14188 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
14189         fn drop(&mut self) {
14190                 if self.result_ok {
14191                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14192                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14193                         }
14194                 } else {
14195                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14196                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14197                         }
14198                 }
14199         }
14200 }
14201 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
14202         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
14203                 let contents = if o.result_ok {
14204                         let result = unsafe { o.contents.result };
14205                         unsafe { o.contents.result = core::ptr::null_mut() };
14206                         CResult_OpenChannelV2DecodeErrorZPtr { result }
14207                 } else {
14208                         let err = unsafe { o.contents.err };
14209                         unsafe { o.contents.err = core::ptr::null_mut(); }
14210                         CResult_OpenChannelV2DecodeErrorZPtr { err }
14211                 };
14212                 Self {
14213                         contents,
14214                         result_ok: o.result_ok,
14215                 }
14216         }
14217 }
14218 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
14219         fn clone(&self) -> Self {
14220                 if self.result_ok {
14221                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
14222                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
14223                         } }
14224                 } else {
14225                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
14226                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14227                         } }
14228                 }
14229         }
14230 }
14231 #[no_mangle]
14232 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
14233 /// but with all dynamically-allocated buffers duplicated in new buffers.
14234 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
14235 #[repr(C)]
14236 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14237 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14238         /// A pointer to the contents in the success state.
14239         /// Reading from this pointer when `result_ok` is not set is undefined.
14240         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14241         /// A pointer to the contents in the error state.
14242         /// Reading from this pointer when `result_ok` is set is undefined.
14243         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14244 }
14245 #[repr(C)]
14246 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14247 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14249 pub struct CResult_RevokeAndACKDecodeErrorZ {
14250         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14251         /// `err` or `result` depending on the state of `result_ok`.
14252         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14253         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14254         pub result_ok: bool,
14255 }
14256 #[no_mangle]
14257 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14258 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14259         CResult_RevokeAndACKDecodeErrorZ {
14260                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14261                         result: Box::into_raw(Box::new(o)),
14262                 },
14263                 result_ok: true,
14264         }
14265 }
14266 #[no_mangle]
14267 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14268 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14269         CResult_RevokeAndACKDecodeErrorZ {
14270                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14271                         err: Box::into_raw(Box::new(e)),
14272                 },
14273                 result_ok: false,
14274         }
14275 }
14276 /// Checks if the given object is currently in the success state
14277 #[no_mangle]
14278 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14279         o.result_ok
14280 }
14281 #[no_mangle]
14282 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14283 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14284 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14285         fn drop(&mut self) {
14286                 if self.result_ok {
14287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14289                         }
14290                 } else {
14291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14293                         }
14294                 }
14295         }
14296 }
14297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14299                 let contents = if o.result_ok {
14300                         let result = unsafe { o.contents.result };
14301                         unsafe { o.contents.result = core::ptr::null_mut() };
14302                         CResult_RevokeAndACKDecodeErrorZPtr { result }
14303                 } else {
14304                         let err = unsafe { o.contents.err };
14305                         unsafe { o.contents.err = core::ptr::null_mut(); }
14306                         CResult_RevokeAndACKDecodeErrorZPtr { err }
14307                 };
14308                 Self {
14309                         contents,
14310                         result_ok: o.result_ok,
14311                 }
14312         }
14313 }
14314 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14315         fn clone(&self) -> Self {
14316                 if self.result_ok {
14317                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14318                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14319                         } }
14320                 } else {
14321                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14322                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14323                         } }
14324                 }
14325         }
14326 }
14327 #[no_mangle]
14328 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14329 /// but with all dynamically-allocated buffers duplicated in new buffers.
14330 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14331 #[repr(C)]
14332 /// The contents of CResult_ShutdownDecodeErrorZ
14333 pub union CResult_ShutdownDecodeErrorZPtr {
14334         /// A pointer to the contents in the success state.
14335         /// Reading from this pointer when `result_ok` is not set is undefined.
14336         pub result: *mut crate::lightning::ln::msgs::Shutdown,
14337         /// A pointer to the contents in the error state.
14338         /// Reading from this pointer when `result_ok` is set is undefined.
14339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14340 }
14341 #[repr(C)]
14342 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14343 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14345 pub struct CResult_ShutdownDecodeErrorZ {
14346         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14347         /// `err` or `result` depending on the state of `result_ok`.
14348         pub contents: CResult_ShutdownDecodeErrorZPtr,
14349         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14350         pub result_ok: bool,
14351 }
14352 #[no_mangle]
14353 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14354 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14355         CResult_ShutdownDecodeErrorZ {
14356                 contents: CResult_ShutdownDecodeErrorZPtr {
14357                         result: Box::into_raw(Box::new(o)),
14358                 },
14359                 result_ok: true,
14360         }
14361 }
14362 #[no_mangle]
14363 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14364 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14365         CResult_ShutdownDecodeErrorZ {
14366                 contents: CResult_ShutdownDecodeErrorZPtr {
14367                         err: Box::into_raw(Box::new(e)),
14368                 },
14369                 result_ok: false,
14370         }
14371 }
14372 /// Checks if the given object is currently in the success state
14373 #[no_mangle]
14374 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14375         o.result_ok
14376 }
14377 #[no_mangle]
14378 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14379 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14380 impl Drop for CResult_ShutdownDecodeErrorZ {
14381         fn drop(&mut self) {
14382                 if self.result_ok {
14383                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14384                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14385                         }
14386                 } else {
14387                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14388                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14389                         }
14390                 }
14391         }
14392 }
14393 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14394         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14395                 let contents = if o.result_ok {
14396                         let result = unsafe { o.contents.result };
14397                         unsafe { o.contents.result = core::ptr::null_mut() };
14398                         CResult_ShutdownDecodeErrorZPtr { result }
14399                 } else {
14400                         let err = unsafe { o.contents.err };
14401                         unsafe { o.contents.err = core::ptr::null_mut(); }
14402                         CResult_ShutdownDecodeErrorZPtr { err }
14403                 };
14404                 Self {
14405                         contents,
14406                         result_ok: o.result_ok,
14407                 }
14408         }
14409 }
14410 impl Clone for CResult_ShutdownDecodeErrorZ {
14411         fn clone(&self) -> Self {
14412                 if self.result_ok {
14413                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14414                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14415                         } }
14416                 } else {
14417                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14418                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14419                         } }
14420                 }
14421         }
14422 }
14423 #[no_mangle]
14424 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14425 /// but with all dynamically-allocated buffers duplicated in new buffers.
14426 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14427 #[repr(C)]
14428 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14429 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14430         /// A pointer to the contents in the success state.
14431         /// Reading from this pointer when `result_ok` is not set is undefined.
14432         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14433         /// A pointer to the contents in the error state.
14434         /// Reading from this pointer when `result_ok` is set is undefined.
14435         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14436 }
14437 #[repr(C)]
14438 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14439 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14441 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14442         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14443         /// `err` or `result` depending on the state of `result_ok`.
14444         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14445         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14446         pub result_ok: bool,
14447 }
14448 #[no_mangle]
14449 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14450 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14451         CResult_UpdateFailHTLCDecodeErrorZ {
14452                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14453                         result: Box::into_raw(Box::new(o)),
14454                 },
14455                 result_ok: true,
14456         }
14457 }
14458 #[no_mangle]
14459 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14460 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14461         CResult_UpdateFailHTLCDecodeErrorZ {
14462                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14463                         err: Box::into_raw(Box::new(e)),
14464                 },
14465                 result_ok: false,
14466         }
14467 }
14468 /// Checks if the given object is currently in the success state
14469 #[no_mangle]
14470 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14471         o.result_ok
14472 }
14473 #[no_mangle]
14474 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14475 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14476 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14477         fn drop(&mut self) {
14478                 if self.result_ok {
14479                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14480                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14481                         }
14482                 } else {
14483                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14484                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14485                         }
14486                 }
14487         }
14488 }
14489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14490         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14491                 let contents = if o.result_ok {
14492                         let result = unsafe { o.contents.result };
14493                         unsafe { o.contents.result = core::ptr::null_mut() };
14494                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14495                 } else {
14496                         let err = unsafe { o.contents.err };
14497                         unsafe { o.contents.err = core::ptr::null_mut(); }
14498                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14499                 };
14500                 Self {
14501                         contents,
14502                         result_ok: o.result_ok,
14503                 }
14504         }
14505 }
14506 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14507         fn clone(&self) -> Self {
14508                 if self.result_ok {
14509                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14510                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14511                         } }
14512                 } else {
14513                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14514                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14515                         } }
14516                 }
14517         }
14518 }
14519 #[no_mangle]
14520 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14521 /// but with all dynamically-allocated buffers duplicated in new buffers.
14522 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14523 #[repr(C)]
14524 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14525 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14526         /// A pointer to the contents in the success state.
14527         /// Reading from this pointer when `result_ok` is not set is undefined.
14528         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14529         /// A pointer to the contents in the error state.
14530         /// Reading from this pointer when `result_ok` is set is undefined.
14531         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14532 }
14533 #[repr(C)]
14534 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14535 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14537 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14538         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14539         /// `err` or `result` depending on the state of `result_ok`.
14540         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14541         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14542         pub result_ok: bool,
14543 }
14544 #[no_mangle]
14545 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14546 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14547         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14548                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14549                         result: Box::into_raw(Box::new(o)),
14550                 },
14551                 result_ok: true,
14552         }
14553 }
14554 #[no_mangle]
14555 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14556 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14557         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14558                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14559                         err: Box::into_raw(Box::new(e)),
14560                 },
14561                 result_ok: false,
14562         }
14563 }
14564 /// Checks if the given object is currently in the success state
14565 #[no_mangle]
14566 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14567         o.result_ok
14568 }
14569 #[no_mangle]
14570 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14571 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14572 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14573         fn drop(&mut self) {
14574                 if self.result_ok {
14575                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14576                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14577                         }
14578                 } else {
14579                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14580                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14581                         }
14582                 }
14583         }
14584 }
14585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14586         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14587                 let contents = if o.result_ok {
14588                         let result = unsafe { o.contents.result };
14589                         unsafe { o.contents.result = core::ptr::null_mut() };
14590                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14591                 } else {
14592                         let err = unsafe { o.contents.err };
14593                         unsafe { o.contents.err = core::ptr::null_mut(); }
14594                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14595                 };
14596                 Self {
14597                         contents,
14598                         result_ok: o.result_ok,
14599                 }
14600         }
14601 }
14602 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14603         fn clone(&self) -> Self {
14604                 if self.result_ok {
14605                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14606                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14607                         } }
14608                 } else {
14609                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14610                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14611                         } }
14612                 }
14613         }
14614 }
14615 #[no_mangle]
14616 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14617 /// but with all dynamically-allocated buffers duplicated in new buffers.
14618 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14619 #[repr(C)]
14620 /// The contents of CResult_UpdateFeeDecodeErrorZ
14621 pub union CResult_UpdateFeeDecodeErrorZPtr {
14622         /// A pointer to the contents in the success state.
14623         /// Reading from this pointer when `result_ok` is not set is undefined.
14624         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14625         /// A pointer to the contents in the error state.
14626         /// Reading from this pointer when `result_ok` is set is undefined.
14627         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14628 }
14629 #[repr(C)]
14630 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14631 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14633 pub struct CResult_UpdateFeeDecodeErrorZ {
14634         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14635         /// `err` or `result` depending on the state of `result_ok`.
14636         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14637         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14638         pub result_ok: bool,
14639 }
14640 #[no_mangle]
14641 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14642 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14643         CResult_UpdateFeeDecodeErrorZ {
14644                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14645                         result: Box::into_raw(Box::new(o)),
14646                 },
14647                 result_ok: true,
14648         }
14649 }
14650 #[no_mangle]
14651 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14652 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14653         CResult_UpdateFeeDecodeErrorZ {
14654                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14655                         err: Box::into_raw(Box::new(e)),
14656                 },
14657                 result_ok: false,
14658         }
14659 }
14660 /// Checks if the given object is currently in the success state
14661 #[no_mangle]
14662 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14663         o.result_ok
14664 }
14665 #[no_mangle]
14666 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14667 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14668 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14669         fn drop(&mut self) {
14670                 if self.result_ok {
14671                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14672                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14673                         }
14674                 } else {
14675                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14676                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14677                         }
14678                 }
14679         }
14680 }
14681 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14682         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14683                 let contents = if o.result_ok {
14684                         let result = unsafe { o.contents.result };
14685                         unsafe { o.contents.result = core::ptr::null_mut() };
14686                         CResult_UpdateFeeDecodeErrorZPtr { result }
14687                 } else {
14688                         let err = unsafe { o.contents.err };
14689                         unsafe { o.contents.err = core::ptr::null_mut(); }
14690                         CResult_UpdateFeeDecodeErrorZPtr { err }
14691                 };
14692                 Self {
14693                         contents,
14694                         result_ok: o.result_ok,
14695                 }
14696         }
14697 }
14698 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14699         fn clone(&self) -> Self {
14700                 if self.result_ok {
14701                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14702                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14703                         } }
14704                 } else {
14705                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14706                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14707                         } }
14708                 }
14709         }
14710 }
14711 #[no_mangle]
14712 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14713 /// but with all dynamically-allocated buffers duplicated in new buffers.
14714 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14715 #[repr(C)]
14716 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14717 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14718         /// A pointer to the contents in the success state.
14719         /// Reading from this pointer when `result_ok` is not set is undefined.
14720         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14721         /// A pointer to the contents in the error state.
14722         /// Reading from this pointer when `result_ok` is set is undefined.
14723         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14724 }
14725 #[repr(C)]
14726 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14727 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14729 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14730         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14731         /// `err` or `result` depending on the state of `result_ok`.
14732         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14733         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14734         pub result_ok: bool,
14735 }
14736 #[no_mangle]
14737 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14738 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14739         CResult_UpdateFulfillHTLCDecodeErrorZ {
14740                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14741                         result: Box::into_raw(Box::new(o)),
14742                 },
14743                 result_ok: true,
14744         }
14745 }
14746 #[no_mangle]
14747 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14748 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14749         CResult_UpdateFulfillHTLCDecodeErrorZ {
14750                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14751                         err: Box::into_raw(Box::new(e)),
14752                 },
14753                 result_ok: false,
14754         }
14755 }
14756 /// Checks if the given object is currently in the success state
14757 #[no_mangle]
14758 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14759         o.result_ok
14760 }
14761 #[no_mangle]
14762 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14763 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14764 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14765         fn drop(&mut self) {
14766                 if self.result_ok {
14767                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14768                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14769                         }
14770                 } else {
14771                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14772                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14773                         }
14774                 }
14775         }
14776 }
14777 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14778         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14779                 let contents = if o.result_ok {
14780                         let result = unsafe { o.contents.result };
14781                         unsafe { o.contents.result = core::ptr::null_mut() };
14782                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14783                 } else {
14784                         let err = unsafe { o.contents.err };
14785                         unsafe { o.contents.err = core::ptr::null_mut(); }
14786                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14787                 };
14788                 Self {
14789                         contents,
14790                         result_ok: o.result_ok,
14791                 }
14792         }
14793 }
14794 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14795         fn clone(&self) -> Self {
14796                 if self.result_ok {
14797                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14798                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14799                         } }
14800                 } else {
14801                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14802                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14803                         } }
14804                 }
14805         }
14806 }
14807 #[no_mangle]
14808 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14809 /// but with all dynamically-allocated buffers duplicated in new buffers.
14810 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14811 #[repr(C)]
14812 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14813 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14814         /// A pointer to the contents in the success state.
14815         /// Reading from this pointer when `result_ok` is not set is undefined.
14816         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14817         /// A pointer to the contents in the error state.
14818         /// Reading from this pointer when `result_ok` is set is undefined.
14819         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14820 }
14821 #[repr(C)]
14822 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14823 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14825 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14826         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14827         /// `err` or `result` depending on the state of `result_ok`.
14828         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14829         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14830         pub result_ok: bool,
14831 }
14832 #[no_mangle]
14833 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14834 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14835         CResult_UpdateAddHTLCDecodeErrorZ {
14836                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14837                         result: Box::into_raw(Box::new(o)),
14838                 },
14839                 result_ok: true,
14840         }
14841 }
14842 #[no_mangle]
14843 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14844 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14845         CResult_UpdateAddHTLCDecodeErrorZ {
14846                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14847                         err: Box::into_raw(Box::new(e)),
14848                 },
14849                 result_ok: false,
14850         }
14851 }
14852 /// Checks if the given object is currently in the success state
14853 #[no_mangle]
14854 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14855         o.result_ok
14856 }
14857 #[no_mangle]
14858 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14859 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14860 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14861         fn drop(&mut self) {
14862                 if self.result_ok {
14863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14865                         }
14866                 } else {
14867                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14868                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14869                         }
14870                 }
14871         }
14872 }
14873 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14874         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14875                 let contents = if o.result_ok {
14876                         let result = unsafe { o.contents.result };
14877                         unsafe { o.contents.result = core::ptr::null_mut() };
14878                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14879                 } else {
14880                         let err = unsafe { o.contents.err };
14881                         unsafe { o.contents.err = core::ptr::null_mut(); }
14882                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14883                 };
14884                 Self {
14885                         contents,
14886                         result_ok: o.result_ok,
14887                 }
14888         }
14889 }
14890 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14891         fn clone(&self) -> Self {
14892                 if self.result_ok {
14893                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14894                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14895                         } }
14896                 } else {
14897                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14898                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14899                         } }
14900                 }
14901         }
14902 }
14903 #[no_mangle]
14904 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14905 /// but with all dynamically-allocated buffers duplicated in new buffers.
14906 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14907 #[repr(C)]
14908 /// The contents of CResult_OnionMessageDecodeErrorZ
14909 pub union CResult_OnionMessageDecodeErrorZPtr {
14910         /// A pointer to the contents in the success state.
14911         /// Reading from this pointer when `result_ok` is not set is undefined.
14912         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14913         /// A pointer to the contents in the error state.
14914         /// Reading from this pointer when `result_ok` is set is undefined.
14915         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14916 }
14917 #[repr(C)]
14918 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14919 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14921 pub struct CResult_OnionMessageDecodeErrorZ {
14922         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14923         /// `err` or `result` depending on the state of `result_ok`.
14924         pub contents: CResult_OnionMessageDecodeErrorZPtr,
14925         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14926         pub result_ok: bool,
14927 }
14928 #[no_mangle]
14929 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14930 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14931         CResult_OnionMessageDecodeErrorZ {
14932                 contents: CResult_OnionMessageDecodeErrorZPtr {
14933                         result: Box::into_raw(Box::new(o)),
14934                 },
14935                 result_ok: true,
14936         }
14937 }
14938 #[no_mangle]
14939 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14940 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14941         CResult_OnionMessageDecodeErrorZ {
14942                 contents: CResult_OnionMessageDecodeErrorZPtr {
14943                         err: Box::into_raw(Box::new(e)),
14944                 },
14945                 result_ok: false,
14946         }
14947 }
14948 /// Checks if the given object is currently in the success state
14949 #[no_mangle]
14950 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14951         o.result_ok
14952 }
14953 #[no_mangle]
14954 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14955 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14956 impl Drop for CResult_OnionMessageDecodeErrorZ {
14957         fn drop(&mut self) {
14958                 if self.result_ok {
14959                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14960                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14961                         }
14962                 } else {
14963                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14964                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14965                         }
14966                 }
14967         }
14968 }
14969 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14970         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14971                 let contents = if o.result_ok {
14972                         let result = unsafe { o.contents.result };
14973                         unsafe { o.contents.result = core::ptr::null_mut() };
14974                         CResult_OnionMessageDecodeErrorZPtr { result }
14975                 } else {
14976                         let err = unsafe { o.contents.err };
14977                         unsafe { o.contents.err = core::ptr::null_mut(); }
14978                         CResult_OnionMessageDecodeErrorZPtr { err }
14979                 };
14980                 Self {
14981                         contents,
14982                         result_ok: o.result_ok,
14983                 }
14984         }
14985 }
14986 impl Clone for CResult_OnionMessageDecodeErrorZ {
14987         fn clone(&self) -> Self {
14988                 if self.result_ok {
14989                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14990                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14991                         } }
14992                 } else {
14993                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14994                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14995                         } }
14996                 }
14997         }
14998 }
14999 #[no_mangle]
15000 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15001 /// but with all dynamically-allocated buffers duplicated in new buffers.
15002 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15003 #[repr(C)]
15004 /// The contents of CResult_PingDecodeErrorZ
15005 pub union CResult_PingDecodeErrorZPtr {
15006         /// A pointer to the contents in the success state.
15007         /// Reading from this pointer when `result_ok` is not set is undefined.
15008         pub result: *mut crate::lightning::ln::msgs::Ping,
15009         /// A pointer to the contents in the error state.
15010         /// Reading from this pointer when `result_ok` is set is undefined.
15011         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15012 }
15013 #[repr(C)]
15014 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15015 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15016 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15017 pub struct CResult_PingDecodeErrorZ {
15018         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15019         /// `err` or `result` depending on the state of `result_ok`.
15020         pub contents: CResult_PingDecodeErrorZPtr,
15021         /// Whether this CResult_PingDecodeErrorZ represents a success state.
15022         pub result_ok: bool,
15023 }
15024 #[no_mangle]
15025 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15026 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15027         CResult_PingDecodeErrorZ {
15028                 contents: CResult_PingDecodeErrorZPtr {
15029                         result: Box::into_raw(Box::new(o)),
15030                 },
15031                 result_ok: true,
15032         }
15033 }
15034 #[no_mangle]
15035 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15036 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15037         CResult_PingDecodeErrorZ {
15038                 contents: CResult_PingDecodeErrorZPtr {
15039                         err: Box::into_raw(Box::new(e)),
15040                 },
15041                 result_ok: false,
15042         }
15043 }
15044 /// Checks if the given object is currently in the success state
15045 #[no_mangle]
15046 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15047         o.result_ok
15048 }
15049 #[no_mangle]
15050 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15051 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15052 impl Drop for CResult_PingDecodeErrorZ {
15053         fn drop(&mut self) {
15054                 if self.result_ok {
15055                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15056                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15057                         }
15058                 } else {
15059                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15060                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15061                         }
15062                 }
15063         }
15064 }
15065 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15066         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15067                 let contents = if o.result_ok {
15068                         let result = unsafe { o.contents.result };
15069                         unsafe { o.contents.result = core::ptr::null_mut() };
15070                         CResult_PingDecodeErrorZPtr { result }
15071                 } else {
15072                         let err = unsafe { o.contents.err };
15073                         unsafe { o.contents.err = core::ptr::null_mut(); }
15074                         CResult_PingDecodeErrorZPtr { err }
15075                 };
15076                 Self {
15077                         contents,
15078                         result_ok: o.result_ok,
15079                 }
15080         }
15081 }
15082 impl Clone for CResult_PingDecodeErrorZ {
15083         fn clone(&self) -> Self {
15084                 if self.result_ok {
15085                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15086                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15087                         } }
15088                 } else {
15089                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15090                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15091                         } }
15092                 }
15093         }
15094 }
15095 #[no_mangle]
15096 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15097 /// but with all dynamically-allocated buffers duplicated in new buffers.
15098 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15099 #[repr(C)]
15100 /// The contents of CResult_PongDecodeErrorZ
15101 pub union CResult_PongDecodeErrorZPtr {
15102         /// A pointer to the contents in the success state.
15103         /// Reading from this pointer when `result_ok` is not set is undefined.
15104         pub result: *mut crate::lightning::ln::msgs::Pong,
15105         /// A pointer to the contents in the error state.
15106         /// Reading from this pointer when `result_ok` is set is undefined.
15107         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15108 }
15109 #[repr(C)]
15110 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15111 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15113 pub struct CResult_PongDecodeErrorZ {
15114         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15115         /// `err` or `result` depending on the state of `result_ok`.
15116         pub contents: CResult_PongDecodeErrorZPtr,
15117         /// Whether this CResult_PongDecodeErrorZ represents a success state.
15118         pub result_ok: bool,
15119 }
15120 #[no_mangle]
15121 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15122 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15123         CResult_PongDecodeErrorZ {
15124                 contents: CResult_PongDecodeErrorZPtr {
15125                         result: Box::into_raw(Box::new(o)),
15126                 },
15127                 result_ok: true,
15128         }
15129 }
15130 #[no_mangle]
15131 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15132 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15133         CResult_PongDecodeErrorZ {
15134                 contents: CResult_PongDecodeErrorZPtr {
15135                         err: Box::into_raw(Box::new(e)),
15136                 },
15137                 result_ok: false,
15138         }
15139 }
15140 /// Checks if the given object is currently in the success state
15141 #[no_mangle]
15142 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15143         o.result_ok
15144 }
15145 #[no_mangle]
15146 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15147 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15148 impl Drop for CResult_PongDecodeErrorZ {
15149         fn drop(&mut self) {
15150                 if self.result_ok {
15151                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15152                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15153                         }
15154                 } else {
15155                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15156                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15157                         }
15158                 }
15159         }
15160 }
15161 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15162         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15163                 let contents = if o.result_ok {
15164                         let result = unsafe { o.contents.result };
15165                         unsafe { o.contents.result = core::ptr::null_mut() };
15166                         CResult_PongDecodeErrorZPtr { result }
15167                 } else {
15168                         let err = unsafe { o.contents.err };
15169                         unsafe { o.contents.err = core::ptr::null_mut(); }
15170                         CResult_PongDecodeErrorZPtr { err }
15171                 };
15172                 Self {
15173                         contents,
15174                         result_ok: o.result_ok,
15175                 }
15176         }
15177 }
15178 impl Clone for CResult_PongDecodeErrorZ {
15179         fn clone(&self) -> Self {
15180                 if self.result_ok {
15181                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15182                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15183                         } }
15184                 } else {
15185                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15186                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15187                         } }
15188                 }
15189         }
15190 }
15191 #[no_mangle]
15192 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15193 /// but with all dynamically-allocated buffers duplicated in new buffers.
15194 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15195 #[repr(C)]
15196 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15197 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15198         /// A pointer to the contents in the success state.
15199         /// Reading from this pointer when `result_ok` is not set is undefined.
15200         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15201         /// A pointer to the contents in the error state.
15202         /// Reading from this pointer when `result_ok` is set is undefined.
15203         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15204 }
15205 #[repr(C)]
15206 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15207 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15209 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15210         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15211         /// `err` or `result` depending on the state of `result_ok`.
15212         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15213         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15214         pub result_ok: bool,
15215 }
15216 #[no_mangle]
15217 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15218 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15219         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15220                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15221                         result: Box::into_raw(Box::new(o)),
15222                 },
15223                 result_ok: true,
15224         }
15225 }
15226 #[no_mangle]
15227 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15228 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15229         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15230                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15231                         err: Box::into_raw(Box::new(e)),
15232                 },
15233                 result_ok: false,
15234         }
15235 }
15236 /// Checks if the given object is currently in the success state
15237 #[no_mangle]
15238 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15239         o.result_ok
15240 }
15241 #[no_mangle]
15242 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15243 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15244 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15245         fn drop(&mut self) {
15246                 if self.result_ok {
15247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15249                         }
15250                 } else {
15251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15253                         }
15254                 }
15255         }
15256 }
15257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15259                 let contents = if o.result_ok {
15260                         let result = unsafe { o.contents.result };
15261                         unsafe { o.contents.result = core::ptr::null_mut() };
15262                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15263                 } else {
15264                         let err = unsafe { o.contents.err };
15265                         unsafe { o.contents.err = core::ptr::null_mut(); }
15266                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15267                 };
15268                 Self {
15269                         contents,
15270                         result_ok: o.result_ok,
15271                 }
15272         }
15273 }
15274 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15275         fn clone(&self) -> Self {
15276                 if self.result_ok {
15277                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15278                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15279                         } }
15280                 } else {
15281                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15282                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15283                         } }
15284                 }
15285         }
15286 }
15287 #[no_mangle]
15288 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15289 /// but with all dynamically-allocated buffers duplicated in new buffers.
15290 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15291 #[repr(C)]
15292 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15293 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15294         /// A pointer to the contents in the success state.
15295         /// Reading from this pointer when `result_ok` is not set is undefined.
15296         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15297         /// A pointer to the contents in the error state.
15298         /// Reading from this pointer when `result_ok` is set is undefined.
15299         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15300 }
15301 #[repr(C)]
15302 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15303 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15305 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15306         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15307         /// `err` or `result` depending on the state of `result_ok`.
15308         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15309         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15310         pub result_ok: bool,
15311 }
15312 #[no_mangle]
15313 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15314 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15315         CResult_ChannelAnnouncementDecodeErrorZ {
15316                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15317                         result: Box::into_raw(Box::new(o)),
15318                 },
15319                 result_ok: true,
15320         }
15321 }
15322 #[no_mangle]
15323 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15324 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15325         CResult_ChannelAnnouncementDecodeErrorZ {
15326                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15327                         err: Box::into_raw(Box::new(e)),
15328                 },
15329                 result_ok: false,
15330         }
15331 }
15332 /// Checks if the given object is currently in the success state
15333 #[no_mangle]
15334 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15335         o.result_ok
15336 }
15337 #[no_mangle]
15338 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15339 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15340 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15341         fn drop(&mut self) {
15342                 if self.result_ok {
15343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15345                         }
15346                 } else {
15347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15349                         }
15350                 }
15351         }
15352 }
15353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15354         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15355                 let contents = if o.result_ok {
15356                         let result = unsafe { o.contents.result };
15357                         unsafe { o.contents.result = core::ptr::null_mut() };
15358                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15359                 } else {
15360                         let err = unsafe { o.contents.err };
15361                         unsafe { o.contents.err = core::ptr::null_mut(); }
15362                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15363                 };
15364                 Self {
15365                         contents,
15366                         result_ok: o.result_ok,
15367                 }
15368         }
15369 }
15370 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15371         fn clone(&self) -> Self {
15372                 if self.result_ok {
15373                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15374                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15375                         } }
15376                 } else {
15377                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15379                         } }
15380                 }
15381         }
15382 }
15383 #[no_mangle]
15384 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15385 /// but with all dynamically-allocated buffers duplicated in new buffers.
15386 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15387 #[repr(C)]
15388 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15389 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15390         /// A pointer to the contents in the success state.
15391         /// Reading from this pointer when `result_ok` is not set is undefined.
15392         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15393         /// A pointer to the contents in the error state.
15394         /// Reading from this pointer when `result_ok` is set is undefined.
15395         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15396 }
15397 #[repr(C)]
15398 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15399 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15401 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15402         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15403         /// `err` or `result` depending on the state of `result_ok`.
15404         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15405         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15406         pub result_ok: bool,
15407 }
15408 #[no_mangle]
15409 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15410 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15411         CResult_UnsignedChannelUpdateDecodeErrorZ {
15412                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15413                         result: Box::into_raw(Box::new(o)),
15414                 },
15415                 result_ok: true,
15416         }
15417 }
15418 #[no_mangle]
15419 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15420 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15421         CResult_UnsignedChannelUpdateDecodeErrorZ {
15422                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15423                         err: Box::into_raw(Box::new(e)),
15424                 },
15425                 result_ok: false,
15426         }
15427 }
15428 /// Checks if the given object is currently in the success state
15429 #[no_mangle]
15430 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15431         o.result_ok
15432 }
15433 #[no_mangle]
15434 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15435 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15436 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15437         fn drop(&mut self) {
15438                 if self.result_ok {
15439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15441                         }
15442                 } else {
15443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15445                         }
15446                 }
15447         }
15448 }
15449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15450         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15451                 let contents = if o.result_ok {
15452                         let result = unsafe { o.contents.result };
15453                         unsafe { o.contents.result = core::ptr::null_mut() };
15454                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15455                 } else {
15456                         let err = unsafe { o.contents.err };
15457                         unsafe { o.contents.err = core::ptr::null_mut(); }
15458                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15459                 };
15460                 Self {
15461                         contents,
15462                         result_ok: o.result_ok,
15463                 }
15464         }
15465 }
15466 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15467         fn clone(&self) -> Self {
15468                 if self.result_ok {
15469                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15470                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15471                         } }
15472                 } else {
15473                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15474                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15475                         } }
15476                 }
15477         }
15478 }
15479 #[no_mangle]
15480 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15481 /// but with all dynamically-allocated buffers duplicated in new buffers.
15482 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15483 #[repr(C)]
15484 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15485 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15486         /// A pointer to the contents in the success state.
15487         /// Reading from this pointer when `result_ok` is not set is undefined.
15488         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15489         /// A pointer to the contents in the error state.
15490         /// Reading from this pointer when `result_ok` is set is undefined.
15491         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15492 }
15493 #[repr(C)]
15494 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15495 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15497 pub struct CResult_ChannelUpdateDecodeErrorZ {
15498         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15499         /// `err` or `result` depending on the state of `result_ok`.
15500         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15501         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15502         pub result_ok: bool,
15503 }
15504 #[no_mangle]
15505 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15506 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15507         CResult_ChannelUpdateDecodeErrorZ {
15508                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15509                         result: Box::into_raw(Box::new(o)),
15510                 },
15511                 result_ok: true,
15512         }
15513 }
15514 #[no_mangle]
15515 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15516 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15517         CResult_ChannelUpdateDecodeErrorZ {
15518                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15519                         err: Box::into_raw(Box::new(e)),
15520                 },
15521                 result_ok: false,
15522         }
15523 }
15524 /// Checks if the given object is currently in the success state
15525 #[no_mangle]
15526 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15527         o.result_ok
15528 }
15529 #[no_mangle]
15530 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15531 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15532 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15533         fn drop(&mut self) {
15534                 if self.result_ok {
15535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15537                         }
15538                 } else {
15539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15541                         }
15542                 }
15543         }
15544 }
15545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15547                 let contents = if o.result_ok {
15548                         let result = unsafe { o.contents.result };
15549                         unsafe { o.contents.result = core::ptr::null_mut() };
15550                         CResult_ChannelUpdateDecodeErrorZPtr { result }
15551                 } else {
15552                         let err = unsafe { o.contents.err };
15553                         unsafe { o.contents.err = core::ptr::null_mut(); }
15554                         CResult_ChannelUpdateDecodeErrorZPtr { err }
15555                 };
15556                 Self {
15557                         contents,
15558                         result_ok: o.result_ok,
15559                 }
15560         }
15561 }
15562 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15563         fn clone(&self) -> Self {
15564                 if self.result_ok {
15565                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15566                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15567                         } }
15568                 } else {
15569                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15571                         } }
15572                 }
15573         }
15574 }
15575 #[no_mangle]
15576 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15577 /// but with all dynamically-allocated buffers duplicated in new buffers.
15578 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15579 #[repr(C)]
15580 /// The contents of CResult_ErrorMessageDecodeErrorZ
15581 pub union CResult_ErrorMessageDecodeErrorZPtr {
15582         /// A pointer to the contents in the success state.
15583         /// Reading from this pointer when `result_ok` is not set is undefined.
15584         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15585         /// A pointer to the contents in the error state.
15586         /// Reading from this pointer when `result_ok` is set is undefined.
15587         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15588 }
15589 #[repr(C)]
15590 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15591 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15593 pub struct CResult_ErrorMessageDecodeErrorZ {
15594         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15595         /// `err` or `result` depending on the state of `result_ok`.
15596         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15597         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15598         pub result_ok: bool,
15599 }
15600 #[no_mangle]
15601 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15602 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15603         CResult_ErrorMessageDecodeErrorZ {
15604                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15605                         result: Box::into_raw(Box::new(o)),
15606                 },
15607                 result_ok: true,
15608         }
15609 }
15610 #[no_mangle]
15611 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15612 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15613         CResult_ErrorMessageDecodeErrorZ {
15614                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15615                         err: Box::into_raw(Box::new(e)),
15616                 },
15617                 result_ok: false,
15618         }
15619 }
15620 /// Checks if the given object is currently in the success state
15621 #[no_mangle]
15622 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15623         o.result_ok
15624 }
15625 #[no_mangle]
15626 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15627 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15628 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15629         fn drop(&mut self) {
15630                 if self.result_ok {
15631                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15632                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15633                         }
15634                 } else {
15635                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15636                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15637                         }
15638                 }
15639         }
15640 }
15641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15642         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15643                 let contents = if o.result_ok {
15644                         let result = unsafe { o.contents.result };
15645                         unsafe { o.contents.result = core::ptr::null_mut() };
15646                         CResult_ErrorMessageDecodeErrorZPtr { result }
15647                 } else {
15648                         let err = unsafe { o.contents.err };
15649                         unsafe { o.contents.err = core::ptr::null_mut(); }
15650                         CResult_ErrorMessageDecodeErrorZPtr { err }
15651                 };
15652                 Self {
15653                         contents,
15654                         result_ok: o.result_ok,
15655                 }
15656         }
15657 }
15658 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15659         fn clone(&self) -> Self {
15660                 if self.result_ok {
15661                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15662                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15663                         } }
15664                 } else {
15665                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15666                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15667                         } }
15668                 }
15669         }
15670 }
15671 #[no_mangle]
15672 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15673 /// but with all dynamically-allocated buffers duplicated in new buffers.
15674 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15675 #[repr(C)]
15676 /// The contents of CResult_WarningMessageDecodeErrorZ
15677 pub union CResult_WarningMessageDecodeErrorZPtr {
15678         /// A pointer to the contents in the success state.
15679         /// Reading from this pointer when `result_ok` is not set is undefined.
15680         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15681         /// A pointer to the contents in the error state.
15682         /// Reading from this pointer when `result_ok` is set is undefined.
15683         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15684 }
15685 #[repr(C)]
15686 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15687 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15689 pub struct CResult_WarningMessageDecodeErrorZ {
15690         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15691         /// `err` or `result` depending on the state of `result_ok`.
15692         pub contents: CResult_WarningMessageDecodeErrorZPtr,
15693         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15694         pub result_ok: bool,
15695 }
15696 #[no_mangle]
15697 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15698 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15699         CResult_WarningMessageDecodeErrorZ {
15700                 contents: CResult_WarningMessageDecodeErrorZPtr {
15701                         result: Box::into_raw(Box::new(o)),
15702                 },
15703                 result_ok: true,
15704         }
15705 }
15706 #[no_mangle]
15707 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15708 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15709         CResult_WarningMessageDecodeErrorZ {
15710                 contents: CResult_WarningMessageDecodeErrorZPtr {
15711                         err: Box::into_raw(Box::new(e)),
15712                 },
15713                 result_ok: false,
15714         }
15715 }
15716 /// Checks if the given object is currently in the success state
15717 #[no_mangle]
15718 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15719         o.result_ok
15720 }
15721 #[no_mangle]
15722 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15723 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15724 impl Drop for CResult_WarningMessageDecodeErrorZ {
15725         fn drop(&mut self) {
15726                 if self.result_ok {
15727                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15728                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15729                         }
15730                 } else {
15731                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15732                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15733                         }
15734                 }
15735         }
15736 }
15737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15738         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15739                 let contents = if o.result_ok {
15740                         let result = unsafe { o.contents.result };
15741                         unsafe { o.contents.result = core::ptr::null_mut() };
15742                         CResult_WarningMessageDecodeErrorZPtr { result }
15743                 } else {
15744                         let err = unsafe { o.contents.err };
15745                         unsafe { o.contents.err = core::ptr::null_mut(); }
15746                         CResult_WarningMessageDecodeErrorZPtr { err }
15747                 };
15748                 Self {
15749                         contents,
15750                         result_ok: o.result_ok,
15751                 }
15752         }
15753 }
15754 impl Clone for CResult_WarningMessageDecodeErrorZ {
15755         fn clone(&self) -> Self {
15756                 if self.result_ok {
15757                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15758                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15759                         } }
15760                 } else {
15761                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15762                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15763                         } }
15764                 }
15765         }
15766 }
15767 #[no_mangle]
15768 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15769 /// but with all dynamically-allocated buffers duplicated in new buffers.
15770 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15771 #[repr(C)]
15772 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15773 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15774         /// A pointer to the contents in the success state.
15775         /// Reading from this pointer when `result_ok` is not set is undefined.
15776         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15777         /// A pointer to the contents in the error state.
15778         /// Reading from this pointer when `result_ok` is set is undefined.
15779         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15780 }
15781 #[repr(C)]
15782 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15783 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15785 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15786         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15787         /// `err` or `result` depending on the state of `result_ok`.
15788         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15789         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15790         pub result_ok: bool,
15791 }
15792 #[no_mangle]
15793 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15794 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15795         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15796                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15797                         result: Box::into_raw(Box::new(o)),
15798                 },
15799                 result_ok: true,
15800         }
15801 }
15802 #[no_mangle]
15803 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15804 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15805         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15806                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15807                         err: Box::into_raw(Box::new(e)),
15808                 },
15809                 result_ok: false,
15810         }
15811 }
15812 /// Checks if the given object is currently in the success state
15813 #[no_mangle]
15814 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15815         o.result_ok
15816 }
15817 #[no_mangle]
15818 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15819 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15820 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15821         fn drop(&mut self) {
15822                 if self.result_ok {
15823                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15824                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15825                         }
15826                 } else {
15827                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15828                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15829                         }
15830                 }
15831         }
15832 }
15833 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15834         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15835                 let contents = if o.result_ok {
15836                         let result = unsafe { o.contents.result };
15837                         unsafe { o.contents.result = core::ptr::null_mut() };
15838                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15839                 } else {
15840                         let err = unsafe { o.contents.err };
15841                         unsafe { o.contents.err = core::ptr::null_mut(); }
15842                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15843                 };
15844                 Self {
15845                         contents,
15846                         result_ok: o.result_ok,
15847                 }
15848         }
15849 }
15850 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15851         fn clone(&self) -> Self {
15852                 if self.result_ok {
15853                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15854                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15855                         } }
15856                 } else {
15857                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15858                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15859                         } }
15860                 }
15861         }
15862 }
15863 #[no_mangle]
15864 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15865 /// but with all dynamically-allocated buffers duplicated in new buffers.
15866 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15867 #[repr(C)]
15868 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15869 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15870         /// A pointer to the contents in the success state.
15871         /// Reading from this pointer when `result_ok` is not set is undefined.
15872         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15873         /// A pointer to the contents in the error state.
15874         /// Reading from this pointer when `result_ok` is set is undefined.
15875         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15876 }
15877 #[repr(C)]
15878 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15879 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15881 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15882         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15883         /// `err` or `result` depending on the state of `result_ok`.
15884         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15885         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15886         pub result_ok: bool,
15887 }
15888 #[no_mangle]
15889 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15890 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15891         CResult_NodeAnnouncementDecodeErrorZ {
15892                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15893                         result: Box::into_raw(Box::new(o)),
15894                 },
15895                 result_ok: true,
15896         }
15897 }
15898 #[no_mangle]
15899 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15900 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15901         CResult_NodeAnnouncementDecodeErrorZ {
15902                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15903                         err: Box::into_raw(Box::new(e)),
15904                 },
15905                 result_ok: false,
15906         }
15907 }
15908 /// Checks if the given object is currently in the success state
15909 #[no_mangle]
15910 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15911         o.result_ok
15912 }
15913 #[no_mangle]
15914 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15915 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15916 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15917         fn drop(&mut self) {
15918                 if self.result_ok {
15919                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15920                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15921                         }
15922                 } else {
15923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15925                         }
15926                 }
15927         }
15928 }
15929 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15930         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15931                 let contents = if o.result_ok {
15932                         let result = unsafe { o.contents.result };
15933                         unsafe { o.contents.result = core::ptr::null_mut() };
15934                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
15935                 } else {
15936                         let err = unsafe { o.contents.err };
15937                         unsafe { o.contents.err = core::ptr::null_mut(); }
15938                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
15939                 };
15940                 Self {
15941                         contents,
15942                         result_ok: o.result_ok,
15943                 }
15944         }
15945 }
15946 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15947         fn clone(&self) -> Self {
15948                 if self.result_ok {
15949                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15950                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15951                         } }
15952                 } else {
15953                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15954                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15955                         } }
15956                 }
15957         }
15958 }
15959 #[no_mangle]
15960 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15961 /// but with all dynamically-allocated buffers duplicated in new buffers.
15962 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15963 #[repr(C)]
15964 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15965 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15966         /// A pointer to the contents in the success state.
15967         /// Reading from this pointer when `result_ok` is not set is undefined.
15968         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15969         /// A pointer to the contents in the error state.
15970         /// Reading from this pointer when `result_ok` is set is undefined.
15971         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15972 }
15973 #[repr(C)]
15974 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15975 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15977 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15978         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15979         /// `err` or `result` depending on the state of `result_ok`.
15980         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15981         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15982         pub result_ok: bool,
15983 }
15984 #[no_mangle]
15985 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15986 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15987         CResult_QueryShortChannelIdsDecodeErrorZ {
15988                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15989                         result: Box::into_raw(Box::new(o)),
15990                 },
15991                 result_ok: true,
15992         }
15993 }
15994 #[no_mangle]
15995 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15996 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15997         CResult_QueryShortChannelIdsDecodeErrorZ {
15998                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15999                         err: Box::into_raw(Box::new(e)),
16000                 },
16001                 result_ok: false,
16002         }
16003 }
16004 /// Checks if the given object is currently in the success state
16005 #[no_mangle]
16006 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16007         o.result_ok
16008 }
16009 #[no_mangle]
16010 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16011 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16012 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16013         fn drop(&mut self) {
16014                 if self.result_ok {
16015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16017                         }
16018                 } else {
16019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16021                         }
16022                 }
16023         }
16024 }
16025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16026         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16027                 let contents = if o.result_ok {
16028                         let result = unsafe { o.contents.result };
16029                         unsafe { o.contents.result = core::ptr::null_mut() };
16030                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16031                 } else {
16032                         let err = unsafe { o.contents.err };
16033                         unsafe { o.contents.err = core::ptr::null_mut(); }
16034                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16035                 };
16036                 Self {
16037                         contents,
16038                         result_ok: o.result_ok,
16039                 }
16040         }
16041 }
16042 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16043         fn clone(&self) -> Self {
16044                 if self.result_ok {
16045                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16046                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16047                         } }
16048                 } else {
16049                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16050                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16051                         } }
16052                 }
16053         }
16054 }
16055 #[no_mangle]
16056 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16057 /// but with all dynamically-allocated buffers duplicated in new buffers.
16058 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16059 #[repr(C)]
16060 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16061 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16062         /// A pointer to the contents in the success state.
16063         /// Reading from this pointer when `result_ok` is not set is undefined.
16064         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16065         /// A pointer to the contents in the error state.
16066         /// Reading from this pointer when `result_ok` is set is undefined.
16067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16068 }
16069 #[repr(C)]
16070 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16071 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16073 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16074         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16075         /// `err` or `result` depending on the state of `result_ok`.
16076         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16077         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16078         pub result_ok: bool,
16079 }
16080 #[no_mangle]
16081 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16082 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16083         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16084                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16085                         result: Box::into_raw(Box::new(o)),
16086                 },
16087                 result_ok: true,
16088         }
16089 }
16090 #[no_mangle]
16091 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16092 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16093         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16094                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16095                         err: Box::into_raw(Box::new(e)),
16096                 },
16097                 result_ok: false,
16098         }
16099 }
16100 /// Checks if the given object is currently in the success state
16101 #[no_mangle]
16102 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16103         o.result_ok
16104 }
16105 #[no_mangle]
16106 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16107 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16108 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16109         fn drop(&mut self) {
16110                 if self.result_ok {
16111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16113                         }
16114                 } else {
16115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16117                         }
16118                 }
16119         }
16120 }
16121 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16122         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16123                 let contents = if o.result_ok {
16124                         let result = unsafe { o.contents.result };
16125                         unsafe { o.contents.result = core::ptr::null_mut() };
16126                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16127                 } else {
16128                         let err = unsafe { o.contents.err };
16129                         unsafe { o.contents.err = core::ptr::null_mut(); }
16130                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16131                 };
16132                 Self {
16133                         contents,
16134                         result_ok: o.result_ok,
16135                 }
16136         }
16137 }
16138 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16139         fn clone(&self) -> Self {
16140                 if self.result_ok {
16141                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16142                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16143                         } }
16144                 } else {
16145                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16146                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16147                         } }
16148                 }
16149         }
16150 }
16151 #[no_mangle]
16152 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16153 /// but with all dynamically-allocated buffers duplicated in new buffers.
16154 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16155 #[repr(C)]
16156 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16157 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16158         /// A pointer to the contents in the success state.
16159         /// Reading from this pointer when `result_ok` is not set is undefined.
16160         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16161         /// A pointer to the contents in the error state.
16162         /// Reading from this pointer when `result_ok` is set is undefined.
16163         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16164 }
16165 #[repr(C)]
16166 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16167 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16169 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16170         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16171         /// `err` or `result` depending on the state of `result_ok`.
16172         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16173         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16174         pub result_ok: bool,
16175 }
16176 #[no_mangle]
16177 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16178 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16179         CResult_QueryChannelRangeDecodeErrorZ {
16180                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16181                         result: Box::into_raw(Box::new(o)),
16182                 },
16183                 result_ok: true,
16184         }
16185 }
16186 #[no_mangle]
16187 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16188 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16189         CResult_QueryChannelRangeDecodeErrorZ {
16190                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16191                         err: Box::into_raw(Box::new(e)),
16192                 },
16193                 result_ok: false,
16194         }
16195 }
16196 /// Checks if the given object is currently in the success state
16197 #[no_mangle]
16198 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16199         o.result_ok
16200 }
16201 #[no_mangle]
16202 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16203 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16204 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16205         fn drop(&mut self) {
16206                 if self.result_ok {
16207                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16208                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16209                         }
16210                 } else {
16211                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16212                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16213                         }
16214                 }
16215         }
16216 }
16217 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16218         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16219                 let contents = if o.result_ok {
16220                         let result = unsafe { o.contents.result };
16221                         unsafe { o.contents.result = core::ptr::null_mut() };
16222                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
16223                 } else {
16224                         let err = unsafe { o.contents.err };
16225                         unsafe { o.contents.err = core::ptr::null_mut(); }
16226                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
16227                 };
16228                 Self {
16229                         contents,
16230                         result_ok: o.result_ok,
16231                 }
16232         }
16233 }
16234 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16235         fn clone(&self) -> Self {
16236                 if self.result_ok {
16237                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16238                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16239                         } }
16240                 } else {
16241                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16242                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16243                         } }
16244                 }
16245         }
16246 }
16247 #[no_mangle]
16248 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16249 /// but with all dynamically-allocated buffers duplicated in new buffers.
16250 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16251 #[repr(C)]
16252 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16253 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16254         /// A pointer to the contents in the success state.
16255         /// Reading from this pointer when `result_ok` is not set is undefined.
16256         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16257         /// A pointer to the contents in the error state.
16258         /// Reading from this pointer when `result_ok` is set is undefined.
16259         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16260 }
16261 #[repr(C)]
16262 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16263 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16265 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16266         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16267         /// `err` or `result` depending on the state of `result_ok`.
16268         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16269         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16270         pub result_ok: bool,
16271 }
16272 #[no_mangle]
16273 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16274 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16275         CResult_ReplyChannelRangeDecodeErrorZ {
16276                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16277                         result: Box::into_raw(Box::new(o)),
16278                 },
16279                 result_ok: true,
16280         }
16281 }
16282 #[no_mangle]
16283 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16284 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16285         CResult_ReplyChannelRangeDecodeErrorZ {
16286                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16287                         err: Box::into_raw(Box::new(e)),
16288                 },
16289                 result_ok: false,
16290         }
16291 }
16292 /// Checks if the given object is currently in the success state
16293 #[no_mangle]
16294 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16295         o.result_ok
16296 }
16297 #[no_mangle]
16298 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16299 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16300 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16301         fn drop(&mut self) {
16302                 if self.result_ok {
16303                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16304                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16305                         }
16306                 } else {
16307                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16308                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16309                         }
16310                 }
16311         }
16312 }
16313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16314         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16315                 let contents = if o.result_ok {
16316                         let result = unsafe { o.contents.result };
16317                         unsafe { o.contents.result = core::ptr::null_mut() };
16318                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16319                 } else {
16320                         let err = unsafe { o.contents.err };
16321                         unsafe { o.contents.err = core::ptr::null_mut(); }
16322                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16323                 };
16324                 Self {
16325                         contents,
16326                         result_ok: o.result_ok,
16327                 }
16328         }
16329 }
16330 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16331         fn clone(&self) -> Self {
16332                 if self.result_ok {
16333                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16334                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16335                         } }
16336                 } else {
16337                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16338                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16339                         } }
16340                 }
16341         }
16342 }
16343 #[no_mangle]
16344 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16345 /// but with all dynamically-allocated buffers duplicated in new buffers.
16346 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16347 #[repr(C)]
16348 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16349 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16350         /// A pointer to the contents in the success state.
16351         /// Reading from this pointer when `result_ok` is not set is undefined.
16352         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16353         /// A pointer to the contents in the error state.
16354         /// Reading from this pointer when `result_ok` is set is undefined.
16355         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16356 }
16357 #[repr(C)]
16358 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16359 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16361 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16362         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16363         /// `err` or `result` depending on the state of `result_ok`.
16364         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16365         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16366         pub result_ok: bool,
16367 }
16368 #[no_mangle]
16369 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16370 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16371         CResult_GossipTimestampFilterDecodeErrorZ {
16372                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16373                         result: Box::into_raw(Box::new(o)),
16374                 },
16375                 result_ok: true,
16376         }
16377 }
16378 #[no_mangle]
16379 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16380 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16381         CResult_GossipTimestampFilterDecodeErrorZ {
16382                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16383                         err: Box::into_raw(Box::new(e)),
16384                 },
16385                 result_ok: false,
16386         }
16387 }
16388 /// Checks if the given object is currently in the success state
16389 #[no_mangle]
16390 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16391         o.result_ok
16392 }
16393 #[no_mangle]
16394 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16395 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16396 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16397         fn drop(&mut self) {
16398                 if self.result_ok {
16399                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16400                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16401                         }
16402                 } else {
16403                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16404                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16405                         }
16406                 }
16407         }
16408 }
16409 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16410         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16411                 let contents = if o.result_ok {
16412                         let result = unsafe { o.contents.result };
16413                         unsafe { o.contents.result = core::ptr::null_mut() };
16414                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16415                 } else {
16416                         let err = unsafe { o.contents.err };
16417                         unsafe { o.contents.err = core::ptr::null_mut(); }
16418                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16419                 };
16420                 Self {
16421                         contents,
16422                         result_ok: o.result_ok,
16423                 }
16424         }
16425 }
16426 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16427         fn clone(&self) -> Self {
16428                 if self.result_ok {
16429                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16430                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16431                         } }
16432                 } else {
16433                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16434                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16435                         } }
16436                 }
16437         }
16438 }
16439 #[no_mangle]
16440 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16441 /// but with all dynamically-allocated buffers duplicated in new buffers.
16442 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16443 #[repr(C)]
16444 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16445 /// This corresponds to std::vector in C++
16446 pub struct CVec_PhantomRouteHintsZ {
16447         /// The elements in the array.
16448         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16449         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16450         /// The number of elements pointed to by `data`.
16451         pub datalen: usize
16452 }
16453 impl CVec_PhantomRouteHintsZ {
16454         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16455                 if self.datalen == 0 { return Vec::new(); }
16456                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16457                 self.data = core::ptr::null_mut();
16458                 self.datalen = 0;
16459                 ret
16460         }
16461         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16462                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16463         }
16464 }
16465 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16466         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16467                 let datalen = v.len();
16468                 let data = Box::into_raw(v.into_boxed_slice());
16469                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16470         }
16471 }
16472 #[no_mangle]
16473 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16474 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16475 impl Drop for CVec_PhantomRouteHintsZ {
16476         fn drop(&mut self) {
16477                 if self.datalen == 0 { return; }
16478                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16479         }
16480 }
16481 impl Clone for CVec_PhantomRouteHintsZ {
16482         fn clone(&self) -> Self {
16483                 let mut res = Vec::new();
16484                 if self.datalen == 0 { return Self::from(res); }
16485                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16486                 Self::from(res)
16487         }
16488 }
16489 #[repr(C)]
16490 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
16491 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16492         /// A pointer to the contents in the success state.
16493         /// Reading from this pointer when `result_ok` is not set is undefined.
16494         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
16495         /// A pointer to the contents in the error state.
16496         /// Reading from this pointer when `result_ok` is set is undefined.
16497         pub err: *mut crate::lightning_invoice::SignOrCreationError,
16498 }
16499 #[repr(C)]
16500 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16501 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16503 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
16504         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
16505         /// `err` or `result` depending on the state of `result_ok`.
16506         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
16507         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
16508         pub result_ok: bool,
16509 }
16510 #[no_mangle]
16511 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
16512 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
16513         CResult_Bolt11InvoiceSignOrCreationErrorZ {
16514                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16515                         result: Box::into_raw(Box::new(o)),
16516                 },
16517                 result_ok: true,
16518         }
16519 }
16520 #[no_mangle]
16521 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
16522 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
16523         CResult_Bolt11InvoiceSignOrCreationErrorZ {
16524                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16525                         err: Box::into_raw(Box::new(e)),
16526                 },
16527                 result_ok: false,
16528         }
16529 }
16530 /// Checks if the given object is currently in the success state
16531 #[no_mangle]
16532 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
16533         o.result_ok
16534 }
16535 #[no_mangle]
16536 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
16537 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
16538 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16539         fn drop(&mut self) {
16540                 if self.result_ok {
16541                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16542                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16543                         }
16544                 } else {
16545                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16546                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16547                         }
16548                 }
16549         }
16550 }
16551 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16553                 let contents = if o.result_ok {
16554                         let result = unsafe { o.contents.result };
16555                         unsafe { o.contents.result = core::ptr::null_mut() };
16556                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
16557                 } else {
16558                         let err = unsafe { o.contents.err };
16559                         unsafe { o.contents.err = core::ptr::null_mut(); }
16560                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
16561                 };
16562                 Self {
16563                         contents,
16564                         result_ok: o.result_ok,
16565                 }
16566         }
16567 }
16568 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16569         fn clone(&self) -> Self {
16570                 if self.result_ok {
16571                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16572                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
16573                         } }
16574                 } else {
16575                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16576                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16577                         } }
16578                 }
16579         }
16580 }
16581 #[no_mangle]
16582 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
16583 /// but with all dynamically-allocated buffers duplicated in new buffers.
16584 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16585 #[repr(C)]
16586 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
16587 /// This corresponds to std::vector in C++
16588 pub struct CVec_FutureZ {
16589         /// The elements in the array.
16590         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16591         pub data: *mut crate::lightning::util::wakers::Future,
16592         /// The number of elements pointed to by `data`.
16593         pub datalen: usize
16594 }
16595 impl CVec_FutureZ {
16596         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
16597                 if self.datalen == 0 { return Vec::new(); }
16598                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16599                 self.data = core::ptr::null_mut();
16600                 self.datalen = 0;
16601                 ret
16602         }
16603         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
16604                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16605         }
16606 }
16607 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
16608         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
16609                 let datalen = v.len();
16610                 let data = Box::into_raw(v.into_boxed_slice());
16611                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16612         }
16613 }
16614 #[no_mangle]
16615 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16616 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
16617 impl Drop for CVec_FutureZ {
16618         fn drop(&mut self) {
16619                 if self.datalen == 0 { return; }
16620                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16621         }
16622 }
16623 impl Clone for CVec_FutureZ {
16624         fn clone(&self) -> Self {
16625                 let mut res = Vec::new();
16626                 if self.datalen == 0 { return Self::from(res); }
16627                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16628                 Self::from(res)
16629         }
16630 }
16631 #[repr(C)]
16632 /// The contents of CResult_OffersMessageDecodeErrorZ
16633 pub union CResult_OffersMessageDecodeErrorZPtr {
16634         /// A pointer to the contents in the success state.
16635         /// Reading from this pointer when `result_ok` is not set is undefined.
16636         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
16637         /// A pointer to the contents in the error state.
16638         /// Reading from this pointer when `result_ok` is set is undefined.
16639         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16640 }
16641 #[repr(C)]
16642 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
16643 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16644 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16645 pub struct CResult_OffersMessageDecodeErrorZ {
16646         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
16647         /// `err` or `result` depending on the state of `result_ok`.
16648         pub contents: CResult_OffersMessageDecodeErrorZPtr,
16649         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
16650         pub result_ok: bool,
16651 }
16652 #[no_mangle]
16653 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
16654 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
16655         CResult_OffersMessageDecodeErrorZ {
16656                 contents: CResult_OffersMessageDecodeErrorZPtr {
16657                         result: Box::into_raw(Box::new(o)),
16658                 },
16659                 result_ok: true,
16660         }
16661 }
16662 #[no_mangle]
16663 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
16664 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
16665         CResult_OffersMessageDecodeErrorZ {
16666                 contents: CResult_OffersMessageDecodeErrorZPtr {
16667                         err: Box::into_raw(Box::new(e)),
16668                 },
16669                 result_ok: false,
16670         }
16671 }
16672 /// Checks if the given object is currently in the success state
16673 #[no_mangle]
16674 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
16675         o.result_ok
16676 }
16677 #[no_mangle]
16678 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
16679 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
16680 impl Drop for CResult_OffersMessageDecodeErrorZ {
16681         fn drop(&mut self) {
16682                 if self.result_ok {
16683                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16684                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16685                         }
16686                 } else {
16687                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16688                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16689                         }
16690                 }
16691         }
16692 }
16693 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
16694         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16695                 let contents = if o.result_ok {
16696                         let result = unsafe { o.contents.result };
16697                         unsafe { o.contents.result = core::ptr::null_mut() };
16698                         CResult_OffersMessageDecodeErrorZPtr { result }
16699                 } else {
16700                         let err = unsafe { o.contents.err };
16701                         unsafe { o.contents.err = core::ptr::null_mut(); }
16702                         CResult_OffersMessageDecodeErrorZPtr { err }
16703                 };
16704                 Self {
16705                         contents,
16706                         result_ok: o.result_ok,
16707                 }
16708         }
16709 }
16710 impl Clone for CResult_OffersMessageDecodeErrorZ {
16711         fn clone(&self) -> Self {
16712                 if self.result_ok {
16713                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
16714                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
16715                         } }
16716                 } else {
16717                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
16718                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16719                         } }
16720                 }
16721         }
16722 }
16723 #[no_mangle]
16724 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
16725 /// but with all dynamically-allocated buffers duplicated in new buffers.
16726 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
16727 #[repr(C)]
16728 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
16729 pub enum COption_HTLCClaimZ {
16730         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
16731         Some(crate::lightning::ln::chan_utils::HTLCClaim),
16732         /// When we're in this state, this COption_HTLCClaimZ contains nothing
16733         None
16734 }
16735 impl COption_HTLCClaimZ {
16736         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16737                 if let Self::None = self { false } else { true }
16738         }
16739         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16740                 !self.is_some()
16741         }
16742         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
16743                 if let Self::Some(v) = self { v } else { unreachable!() }
16744         }
16745 }
16746 #[no_mangle]
16747 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
16748 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
16749         COption_HTLCClaimZ::Some(o)
16750 }
16751 #[no_mangle]
16752 /// Constructs a new COption_HTLCClaimZ containing nothing
16753 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
16754         COption_HTLCClaimZ::None
16755 }
16756 #[no_mangle]
16757 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
16758 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
16759 #[repr(C)]
16760 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
16761 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16762         /// A pointer to the contents in the success state.
16763         /// Reading from this pointer when `result_ok` is not set is undefined.
16764         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
16765         /// A pointer to the contents in the error state.
16766         /// Reading from this pointer when `result_ok` is set is undefined.
16767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16768 }
16769 #[repr(C)]
16770 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
16771 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
16772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16773 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16774         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
16775         /// `err` or `result` depending on the state of `result_ok`.
16776         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
16777         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
16778         pub result_ok: bool,
16779 }
16780 #[no_mangle]
16781 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
16782 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16783         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16784                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16785                         result: Box::into_raw(Box::new(o)),
16786                 },
16787                 result_ok: true,
16788         }
16789 }
16790 #[no_mangle]
16791 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
16792 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16793         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16794                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16795                         err: Box::into_raw(Box::new(e)),
16796                 },
16797                 result_ok: false,
16798         }
16799 }
16800 /// Checks if the given object is currently in the success state
16801 #[no_mangle]
16802 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
16803         o.result_ok
16804 }
16805 #[no_mangle]
16806 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
16807 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
16808 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16809         fn drop(&mut self) {
16810                 if self.result_ok {
16811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16813                         }
16814                 } else {
16815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16817                         }
16818                 }
16819         }
16820 }
16821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
16823                 let contents = if o.result_ok {
16824                         let result = unsafe { o.contents.result };
16825                         unsafe { o.contents.result = core::ptr::null_mut() };
16826                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
16827                 } else {
16828                         let err = unsafe { o.contents.err };
16829                         unsafe { o.contents.err = core::ptr::null_mut(); }
16830                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
16831                 };
16832                 Self {
16833                         contents,
16834                         result_ok: o.result_ok,
16835                 }
16836         }
16837 }
16838 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16839         fn clone(&self) -> Self {
16840                 if self.result_ok {
16841                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16842                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
16843                         } }
16844                 } else {
16845                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16847                         } }
16848                 }
16849         }
16850 }
16851 #[no_mangle]
16852 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
16853 /// but with all dynamically-allocated buffers duplicated in new buffers.
16854 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
16855 #[repr(C)]
16856 /// The contents of CResult_TxCreationKeysDecodeErrorZ
16857 pub union CResult_TxCreationKeysDecodeErrorZPtr {
16858         /// A pointer to the contents in the success state.
16859         /// Reading from this pointer when `result_ok` is not set is undefined.
16860         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
16861         /// A pointer to the contents in the error state.
16862         /// Reading from this pointer when `result_ok` is set is undefined.
16863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16864 }
16865 #[repr(C)]
16866 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
16867 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16869 pub struct CResult_TxCreationKeysDecodeErrorZ {
16870         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
16871         /// `err` or `result` depending on the state of `result_ok`.
16872         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
16873         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
16874         pub result_ok: bool,
16875 }
16876 #[no_mangle]
16877 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
16878 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
16879         CResult_TxCreationKeysDecodeErrorZ {
16880                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
16881                         result: Box::into_raw(Box::new(o)),
16882                 },
16883                 result_ok: true,
16884         }
16885 }
16886 #[no_mangle]
16887 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
16888 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
16889         CResult_TxCreationKeysDecodeErrorZ {
16890                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
16891                         err: Box::into_raw(Box::new(e)),
16892                 },
16893                 result_ok: false,
16894         }
16895 }
16896 /// Checks if the given object is currently in the success state
16897 #[no_mangle]
16898 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
16899         o.result_ok
16900 }
16901 #[no_mangle]
16902 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
16903 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
16904 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
16905         fn drop(&mut self) {
16906                 if self.result_ok {
16907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16909                         }
16910                 } else {
16911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16913                         }
16914                 }
16915         }
16916 }
16917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
16918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
16919                 let contents = if o.result_ok {
16920                         let result = unsafe { o.contents.result };
16921                         unsafe { o.contents.result = core::ptr::null_mut() };
16922                         CResult_TxCreationKeysDecodeErrorZPtr { result }
16923                 } else {
16924                         let err = unsafe { o.contents.err };
16925                         unsafe { o.contents.err = core::ptr::null_mut(); }
16926                         CResult_TxCreationKeysDecodeErrorZPtr { err }
16927                 };
16928                 Self {
16929                         contents,
16930                         result_ok: o.result_ok,
16931                 }
16932         }
16933 }
16934 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
16935         fn clone(&self) -> Self {
16936                 if self.result_ok {
16937                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
16938                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
16939                         } }
16940                 } else {
16941                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
16942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16943                         } }
16944                 }
16945         }
16946 }
16947 #[no_mangle]
16948 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
16949 /// but with all dynamically-allocated buffers duplicated in new buffers.
16950 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
16951 #[repr(C)]
16952 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
16953 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
16954         /// A pointer to the contents in the success state.
16955         /// Reading from this pointer when `result_ok` is not set is undefined.
16956         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
16957         /// A pointer to the contents in the error state.
16958         /// Reading from this pointer when `result_ok` is set is undefined.
16959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16960 }
16961 #[repr(C)]
16962 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
16963 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16965 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
16966         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
16967         /// `err` or `result` depending on the state of `result_ok`.
16968         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
16969         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
16970         pub result_ok: bool,
16971 }
16972 #[no_mangle]
16973 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
16974 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
16975         CResult_ChannelPublicKeysDecodeErrorZ {
16976                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
16977                         result: Box::into_raw(Box::new(o)),
16978                 },
16979                 result_ok: true,
16980         }
16981 }
16982 #[no_mangle]
16983 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
16984 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
16985         CResult_ChannelPublicKeysDecodeErrorZ {
16986                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
16987                         err: Box::into_raw(Box::new(e)),
16988                 },
16989                 result_ok: false,
16990         }
16991 }
16992 /// Checks if the given object is currently in the success state
16993 #[no_mangle]
16994 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
16995         o.result_ok
16996 }
16997 #[no_mangle]
16998 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
16999 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
17000 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
17001         fn drop(&mut self) {
17002                 if self.result_ok {
17003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17005                         }
17006                 } else {
17007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17009                         }
17010                 }
17011         }
17012 }
17013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
17014         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
17015                 let contents = if o.result_ok {
17016                         let result = unsafe { o.contents.result };
17017                         unsafe { o.contents.result = core::ptr::null_mut() };
17018                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
17019                 } else {
17020                         let err = unsafe { o.contents.err };
17021                         unsafe { o.contents.err = core::ptr::null_mut(); }
17022                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
17023                 };
17024                 Self {
17025                         contents,
17026                         result_ok: o.result_ok,
17027                 }
17028         }
17029 }
17030 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
17031         fn clone(&self) -> Self {
17032                 if self.result_ok {
17033                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
17034                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
17035                         } }
17036                 } else {
17037                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
17038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17039                         } }
17040                 }
17041         }
17042 }
17043 #[no_mangle]
17044 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
17045 /// but with all dynamically-allocated buffers duplicated in new buffers.
17046 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
17047 #[repr(C)]
17048 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
17049 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17050         /// A pointer to the contents in the success state.
17051         /// Reading from this pointer when `result_ok` is not set is undefined.
17052         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
17053         /// A pointer to the contents in the error state.
17054         /// Reading from this pointer when `result_ok` is set is undefined.
17055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17056 }
17057 #[repr(C)]
17058 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
17059 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
17060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17061 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
17062         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
17063         /// `err` or `result` depending on the state of `result_ok`.
17064         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
17065         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
17066         pub result_ok: bool,
17067 }
17068 #[no_mangle]
17069 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
17070 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
17071         CResult_HTLCOutputInCommitmentDecodeErrorZ {
17072                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17073                         result: Box::into_raw(Box::new(o)),
17074                 },
17075                 result_ok: true,
17076         }
17077 }
17078 #[no_mangle]
17079 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
17080 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
17081         CResult_HTLCOutputInCommitmentDecodeErrorZ {
17082                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17083                         err: Box::into_raw(Box::new(e)),
17084                 },
17085                 result_ok: false,
17086         }
17087 }
17088 /// Checks if the given object is currently in the success state
17089 #[no_mangle]
17090 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
17091         o.result_ok
17092 }
17093 #[no_mangle]
17094 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
17095 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
17096 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17097         fn drop(&mut self) {
17098                 if self.result_ok {
17099                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17100                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17101                         }
17102                 } else {
17103                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17104                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17105                         }
17106                 }
17107         }
17108 }
17109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17110         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
17111                 let contents = if o.result_ok {
17112                         let result = unsafe { o.contents.result };
17113                         unsafe { o.contents.result = core::ptr::null_mut() };
17114                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
17115                 } else {
17116                         let err = unsafe { o.contents.err };
17117                         unsafe { o.contents.err = core::ptr::null_mut(); }
17118                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
17119                 };
17120                 Self {
17121                         contents,
17122                         result_ok: o.result_ok,
17123                 }
17124         }
17125 }
17126 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17127         fn clone(&self) -> Self {
17128                 if self.result_ok {
17129                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17130                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
17131                         } }
17132                 } else {
17133                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17134                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17135                         } }
17136                 }
17137         }
17138 }
17139 #[no_mangle]
17140 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
17141 /// but with all dynamically-allocated buffers duplicated in new buffers.
17142 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
17143 #[repr(C)]
17144 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
17145 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17146         /// A pointer to the contents in the success state.
17147         /// Reading from this pointer when `result_ok` is not set is undefined.
17148         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
17149         /// A pointer to the contents in the error state.
17150         /// Reading from this pointer when `result_ok` is set is undefined.
17151         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17152 }
17153 #[repr(C)]
17154 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
17155 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
17156 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17157 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17158         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
17159         /// `err` or `result` depending on the state of `result_ok`.
17160         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
17161         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
17162         pub result_ok: bool,
17163 }
17164 #[no_mangle]
17165 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
17166 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17167         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17168                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17169                         result: Box::into_raw(Box::new(o)),
17170                 },
17171                 result_ok: true,
17172         }
17173 }
17174 #[no_mangle]
17175 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
17176 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17177         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17178                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17179                         err: Box::into_raw(Box::new(e)),
17180                 },
17181                 result_ok: false,
17182         }
17183 }
17184 /// Checks if the given object is currently in the success state
17185 #[no_mangle]
17186 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
17187         o.result_ok
17188 }
17189 #[no_mangle]
17190 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
17191 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
17192 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17193         fn drop(&mut self) {
17194                 if self.result_ok {
17195                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17196                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17197                         }
17198                 } else {
17199                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17200                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17201                         }
17202                 }
17203         }
17204 }
17205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17206         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
17207                 let contents = if o.result_ok {
17208                         let result = unsafe { o.contents.result };
17209                         unsafe { o.contents.result = core::ptr::null_mut() };
17210                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
17211                 } else {
17212                         let err = unsafe { o.contents.err };
17213                         unsafe { o.contents.err = core::ptr::null_mut(); }
17214                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
17215                 };
17216                 Self {
17217                         contents,
17218                         result_ok: o.result_ok,
17219                 }
17220         }
17221 }
17222 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17223         fn clone(&self) -> Self {
17224                 if self.result_ok {
17225                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17226                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
17227                         } }
17228                 } else {
17229                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17230                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17231                         } }
17232                 }
17233         }
17234 }
17235 #[no_mangle]
17236 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
17237 /// but with all dynamically-allocated buffers duplicated in new buffers.
17238 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
17239 #[repr(C)]
17240 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
17241 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
17242         /// A pointer to the contents in the success state.
17243         /// Reading from this pointer when `result_ok` is not set is undefined.
17244         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
17245         /// A pointer to the contents in the error state.
17246         /// Reading from this pointer when `result_ok` is set is undefined.
17247         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17248 }
17249 #[repr(C)]
17250 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
17251 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
17252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17253 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
17254         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
17255         /// `err` or `result` depending on the state of `result_ok`.
17256         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
17257         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
17258         pub result_ok: bool,
17259 }
17260 #[no_mangle]
17261 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
17262 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
17263         CResult_ChannelTransactionParametersDecodeErrorZ {
17264                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17265                         result: Box::into_raw(Box::new(o)),
17266                 },
17267                 result_ok: true,
17268         }
17269 }
17270 #[no_mangle]
17271 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
17272 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
17273         CResult_ChannelTransactionParametersDecodeErrorZ {
17274                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17275                         err: Box::into_raw(Box::new(e)),
17276                 },
17277                 result_ok: false,
17278         }
17279 }
17280 /// Checks if the given object is currently in the success state
17281 #[no_mangle]
17282 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
17283         o.result_ok
17284 }
17285 #[no_mangle]
17286 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
17287 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
17288 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
17289         fn drop(&mut self) {
17290                 if self.result_ok {
17291                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17292                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17293                         }
17294                 } else {
17295                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17296                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17297                         }
17298                 }
17299         }
17300 }
17301 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
17302         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
17303                 let contents = if o.result_ok {
17304                         let result = unsafe { o.contents.result };
17305                         unsafe { o.contents.result = core::ptr::null_mut() };
17306                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
17307                 } else {
17308                         let err = unsafe { o.contents.err };
17309                         unsafe { o.contents.err = core::ptr::null_mut(); }
17310                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
17311                 };
17312                 Self {
17313                         contents,
17314                         result_ok: o.result_ok,
17315                 }
17316         }
17317 }
17318 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
17319         fn clone(&self) -> Self {
17320                 if self.result_ok {
17321                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17322                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
17323                         } }
17324                 } else {
17325                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17326                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17327                         } }
17328                 }
17329         }
17330 }
17331 #[no_mangle]
17332 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
17333 /// but with all dynamically-allocated buffers duplicated in new buffers.
17334 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
17335 #[repr(C)]
17336 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
17337 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17338         /// A pointer to the contents in the success state.
17339         /// Reading from this pointer when `result_ok` is not set is undefined.
17340         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
17341         /// A pointer to the contents in the error state.
17342         /// Reading from this pointer when `result_ok` is set is undefined.
17343         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17344 }
17345 #[repr(C)]
17346 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17347 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17349 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
17350         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
17351         /// `err` or `result` depending on the state of `result_ok`.
17352         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
17353         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
17354         pub result_ok: bool,
17355 }
17356 #[no_mangle]
17357 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
17358 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
17359         CResult_HolderCommitmentTransactionDecodeErrorZ {
17360                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17361                         result: Box::into_raw(Box::new(o)),
17362                 },
17363                 result_ok: true,
17364         }
17365 }
17366 #[no_mangle]
17367 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
17368 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
17369         CResult_HolderCommitmentTransactionDecodeErrorZ {
17370                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17371                         err: Box::into_raw(Box::new(e)),
17372                 },
17373                 result_ok: false,
17374         }
17375 }
17376 /// Checks if the given object is currently in the success state
17377 #[no_mangle]
17378 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
17379         o.result_ok
17380 }
17381 #[no_mangle]
17382 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
17383 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
17384 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
17385         fn drop(&mut self) {
17386                 if self.result_ok {
17387                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17388                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17389                         }
17390                 } else {
17391                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17392                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17393                         }
17394                 }
17395         }
17396 }
17397 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
17398         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17399                 let contents = if o.result_ok {
17400                         let result = unsafe { o.contents.result };
17401                         unsafe { o.contents.result = core::ptr::null_mut() };
17402                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
17403                 } else {
17404                         let err = unsafe { o.contents.err };
17405                         unsafe { o.contents.err = core::ptr::null_mut(); }
17406                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
17407                 };
17408                 Self {
17409                         contents,
17410                         result_ok: o.result_ok,
17411                 }
17412         }
17413 }
17414 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
17415         fn clone(&self) -> Self {
17416                 if self.result_ok {
17417                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17418                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17419                         } }
17420                 } else {
17421                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17422                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17423                         } }
17424                 }
17425         }
17426 }
17427 #[no_mangle]
17428 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
17429 /// but with all dynamically-allocated buffers duplicated in new buffers.
17430 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17431 #[repr(C)]
17432 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
17433 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17434         /// A pointer to the contents in the success state.
17435         /// Reading from this pointer when `result_ok` is not set is undefined.
17436         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
17437         /// A pointer to the contents in the error state.
17438         /// Reading from this pointer when `result_ok` is set is undefined.
17439         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17440 }
17441 #[repr(C)]
17442 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17443 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17445 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
17446         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
17447         /// `err` or `result` depending on the state of `result_ok`.
17448         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
17449         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
17450         pub result_ok: bool,
17451 }
17452 #[no_mangle]
17453 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
17454 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
17455         CResult_BuiltCommitmentTransactionDecodeErrorZ {
17456                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17457                         result: Box::into_raw(Box::new(o)),
17458                 },
17459                 result_ok: true,
17460         }
17461 }
17462 #[no_mangle]
17463 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
17464 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
17465         CResult_BuiltCommitmentTransactionDecodeErrorZ {
17466                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17467                         err: Box::into_raw(Box::new(e)),
17468                 },
17469                 result_ok: false,
17470         }
17471 }
17472 /// Checks if the given object is currently in the success state
17473 #[no_mangle]
17474 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
17475         o.result_ok
17476 }
17477 #[no_mangle]
17478 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
17479 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
17480 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17481         fn drop(&mut self) {
17482                 if self.result_ok {
17483                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17484                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17485                         }
17486                 } else {
17487                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17488                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17489                         }
17490                 }
17491         }
17492 }
17493 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17494         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17495                 let contents = if o.result_ok {
17496                         let result = unsafe { o.contents.result };
17497                         unsafe { o.contents.result = core::ptr::null_mut() };
17498                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
17499                 } else {
17500                         let err = unsafe { o.contents.err };
17501                         unsafe { o.contents.err = core::ptr::null_mut(); }
17502                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
17503                 };
17504                 Self {
17505                         contents,
17506                         result_ok: o.result_ok,
17507                 }
17508         }
17509 }
17510 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17511         fn clone(&self) -> Self {
17512                 if self.result_ok {
17513                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17514                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17515                         } }
17516                 } else {
17517                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17518                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17519                         } }
17520                 }
17521         }
17522 }
17523 #[no_mangle]
17524 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
17525 /// but with all dynamically-allocated buffers duplicated in new buffers.
17526 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17527 #[repr(C)]
17528 /// The contents of CResult_TrustedClosingTransactionNoneZ
17529 pub union CResult_TrustedClosingTransactionNoneZPtr {
17530         /// A pointer to the contents in the success state.
17531         /// Reading from this pointer when `result_ok` is not set is undefined.
17532         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
17533         /// Note that this value is always NULL, as there are no contents in the Err variant
17534         pub err: *mut core::ffi::c_void,
17535 }
17536 #[repr(C)]
17537 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
17538 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
17539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17540 pub struct CResult_TrustedClosingTransactionNoneZ {
17541         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
17542         /// `err` or `result` depending on the state of `result_ok`.
17543         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
17544         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
17545         pub result_ok: bool,
17546 }
17547 #[no_mangle]
17548 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
17549 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
17550         CResult_TrustedClosingTransactionNoneZ {
17551                 contents: CResult_TrustedClosingTransactionNoneZPtr {
17552                         result: Box::into_raw(Box::new(o)),
17553                 },
17554                 result_ok: true,
17555         }
17556 }
17557 #[no_mangle]
17558 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
17559 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
17560         CResult_TrustedClosingTransactionNoneZ {
17561                 contents: CResult_TrustedClosingTransactionNoneZPtr {
17562                         err: core::ptr::null_mut(),
17563                 },
17564                 result_ok: false,
17565         }
17566 }
17567 /// Checks if the given object is currently in the success state
17568 #[no_mangle]
17569 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
17570         o.result_ok
17571 }
17572 #[no_mangle]
17573 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
17574 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
17575 impl Drop for CResult_TrustedClosingTransactionNoneZ {
17576         fn drop(&mut self) {
17577                 if self.result_ok {
17578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17580                         }
17581                 } else {
17582                 }
17583         }
17584 }
17585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
17586         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
17587                 let contents = if o.result_ok {
17588                         let result = unsafe { o.contents.result };
17589                         unsafe { o.contents.result = core::ptr::null_mut() };
17590                         CResult_TrustedClosingTransactionNoneZPtr { result }
17591                 } else {
17592                         let _ = unsafe { Box::from_raw(o.contents.err) };
17593                         o.contents.err = core::ptr::null_mut();
17594                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
17595                 };
17596                 Self {
17597                         contents,
17598                         result_ok: o.result_ok,
17599                 }
17600         }
17601 }
17602 #[repr(C)]
17603 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
17604 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
17605         /// A pointer to the contents in the success state.
17606         /// Reading from this pointer when `result_ok` is not set is undefined.
17607         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
17608         /// A pointer to the contents in the error state.
17609         /// Reading from this pointer when `result_ok` is set is undefined.
17610         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17611 }
17612 #[repr(C)]
17613 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17614 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17616 pub struct CResult_CommitmentTransactionDecodeErrorZ {
17617         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
17618         /// `err` or `result` depending on the state of `result_ok`.
17619         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
17620         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
17621         pub result_ok: bool,
17622 }
17623 #[no_mangle]
17624 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
17625 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
17626         CResult_CommitmentTransactionDecodeErrorZ {
17627                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17628                         result: Box::into_raw(Box::new(o)),
17629                 },
17630                 result_ok: true,
17631         }
17632 }
17633 #[no_mangle]
17634 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
17635 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
17636         CResult_CommitmentTransactionDecodeErrorZ {
17637                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17638                         err: Box::into_raw(Box::new(e)),
17639                 },
17640                 result_ok: false,
17641         }
17642 }
17643 /// Checks if the given object is currently in the success state
17644 #[no_mangle]
17645 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
17646         o.result_ok
17647 }
17648 #[no_mangle]
17649 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
17650 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
17651 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
17652         fn drop(&mut self) {
17653                 if self.result_ok {
17654                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17655                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17656                         }
17657                 } else {
17658                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17659                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17660                         }
17661                 }
17662         }
17663 }
17664 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
17665         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17666                 let contents = if o.result_ok {
17667                         let result = unsafe { o.contents.result };
17668                         unsafe { o.contents.result = core::ptr::null_mut() };
17669                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
17670                 } else {
17671                         let err = unsafe { o.contents.err };
17672                         unsafe { o.contents.err = core::ptr::null_mut(); }
17673                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
17674                 };
17675                 Self {
17676                         contents,
17677                         result_ok: o.result_ok,
17678                 }
17679         }
17680 }
17681 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
17682         fn clone(&self) -> Self {
17683                 if self.result_ok {
17684                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17685                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17686                         } }
17687                 } else {
17688                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17689                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17690                         } }
17691                 }
17692         }
17693 }
17694 #[no_mangle]
17695 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
17696 /// but with all dynamically-allocated buffers duplicated in new buffers.
17697 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17698 #[repr(C)]
17699 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
17700 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
17701         /// A pointer to the contents in the success state.
17702         /// Reading from this pointer when `result_ok` is not set is undefined.
17703         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
17704         /// Note that this value is always NULL, as there are no contents in the Err variant
17705         pub err: *mut core::ffi::c_void,
17706 }
17707 #[repr(C)]
17708 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
17709 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
17710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17711 pub struct CResult_TrustedCommitmentTransactionNoneZ {
17712         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
17713         /// `err` or `result` depending on the state of `result_ok`.
17714         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
17715         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
17716         pub result_ok: bool,
17717 }
17718 #[no_mangle]
17719 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
17720 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
17721         CResult_TrustedCommitmentTransactionNoneZ {
17722                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
17723                         result: Box::into_raw(Box::new(o)),
17724                 },
17725                 result_ok: true,
17726         }
17727 }
17728 #[no_mangle]
17729 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
17730 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
17731         CResult_TrustedCommitmentTransactionNoneZ {
17732                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
17733                         err: core::ptr::null_mut(),
17734                 },
17735                 result_ok: false,
17736         }
17737 }
17738 /// Checks if the given object is currently in the success state
17739 #[no_mangle]
17740 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
17741         o.result_ok
17742 }
17743 #[no_mangle]
17744 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
17745 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
17746 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
17747         fn drop(&mut self) {
17748                 if self.result_ok {
17749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17751                         }
17752                 } else {
17753                 }
17754         }
17755 }
17756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
17757         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
17758                 let contents = if o.result_ok {
17759                         let result = unsafe { o.contents.result };
17760                         unsafe { o.contents.result = core::ptr::null_mut() };
17761                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
17762                 } else {
17763                         let _ = unsafe { Box::from_raw(o.contents.err) };
17764                         o.contents.err = core::ptr::null_mut();
17765                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
17766                 };
17767                 Self {
17768                         contents,
17769                         result_ok: o.result_ok,
17770                 }
17771         }
17772 }
17773 #[repr(C)]
17774 /// The contents of CResult_CVec_SignatureZNoneZ
17775 pub union CResult_CVec_SignatureZNoneZPtr {
17776         /// A pointer to the contents in the success state.
17777         /// Reading from this pointer when `result_ok` is not set is undefined.
17778         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
17779         /// Note that this value is always NULL, as there are no contents in the Err variant
17780         pub err: *mut core::ffi::c_void,
17781 }
17782 #[repr(C)]
17783 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
17784 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
17785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17786 pub struct CResult_CVec_SignatureZNoneZ {
17787         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
17788         /// `err` or `result` depending on the state of `result_ok`.
17789         pub contents: CResult_CVec_SignatureZNoneZPtr,
17790         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
17791         pub result_ok: bool,
17792 }
17793 #[no_mangle]
17794 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
17795 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
17796         CResult_CVec_SignatureZNoneZ {
17797                 contents: CResult_CVec_SignatureZNoneZPtr {
17798                         result: Box::into_raw(Box::new(o)),
17799                 },
17800                 result_ok: true,
17801         }
17802 }
17803 #[no_mangle]
17804 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
17805 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
17806         CResult_CVec_SignatureZNoneZ {
17807                 contents: CResult_CVec_SignatureZNoneZPtr {
17808                         err: core::ptr::null_mut(),
17809                 },
17810                 result_ok: false,
17811         }
17812 }
17813 /// Checks if the given object is currently in the success state
17814 #[no_mangle]
17815 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
17816         o.result_ok
17817 }
17818 #[no_mangle]
17819 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
17820 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
17821 impl Drop for CResult_CVec_SignatureZNoneZ {
17822         fn drop(&mut self) {
17823                 if self.result_ok {
17824                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17825                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17826                         }
17827                 } else {
17828                 }
17829         }
17830 }
17831 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
17832         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
17833                 let contents = if o.result_ok {
17834                         let result = unsafe { o.contents.result };
17835                         unsafe { o.contents.result = core::ptr::null_mut() };
17836                         CResult_CVec_SignatureZNoneZPtr { result }
17837                 } else {
17838                         let _ = unsafe { Box::from_raw(o.contents.err) };
17839                         o.contents.err = core::ptr::null_mut();
17840                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
17841                 };
17842                 Self {
17843                         contents,
17844                         result_ok: o.result_ok,
17845                 }
17846         }
17847 }
17848 impl Clone for CResult_CVec_SignatureZNoneZ {
17849         fn clone(&self) -> Self {
17850                 if self.result_ok {
17851                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
17852                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
17853                         } }
17854                 } else {
17855                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
17856                                 err: core::ptr::null_mut()
17857                         } }
17858                 }
17859         }
17860 }
17861 #[no_mangle]
17862 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
17863 /// but with all dynamically-allocated buffers duplicated in new buffers.
17864 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
17865 #[repr(C)]
17866 /// The contents of CResult_ShutdownScriptDecodeErrorZ
17867 pub union CResult_ShutdownScriptDecodeErrorZPtr {
17868         /// A pointer to the contents in the success state.
17869         /// Reading from this pointer when `result_ok` is not set is undefined.
17870         pub result: *mut crate::lightning::ln::script::ShutdownScript,
17871         /// A pointer to the contents in the error state.
17872         /// Reading from this pointer when `result_ok` is set is undefined.
17873         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17874 }
17875 #[repr(C)]
17876 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
17877 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
17878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17879 pub struct CResult_ShutdownScriptDecodeErrorZ {
17880         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
17881         /// `err` or `result` depending on the state of `result_ok`.
17882         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
17883         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
17884         pub result_ok: bool,
17885 }
17886 #[no_mangle]
17887 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
17888 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
17889         CResult_ShutdownScriptDecodeErrorZ {
17890                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
17891                         result: Box::into_raw(Box::new(o)),
17892                 },
17893                 result_ok: true,
17894         }
17895 }
17896 #[no_mangle]
17897 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
17898 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
17899         CResult_ShutdownScriptDecodeErrorZ {
17900                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
17901                         err: Box::into_raw(Box::new(e)),
17902                 },
17903                 result_ok: false,
17904         }
17905 }
17906 /// Checks if the given object is currently in the success state
17907 #[no_mangle]
17908 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
17909         o.result_ok
17910 }
17911 #[no_mangle]
17912 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
17913 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
17914 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
17915         fn drop(&mut self) {
17916                 if self.result_ok {
17917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17919                         }
17920                 } else {
17921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17923                         }
17924                 }
17925         }
17926 }
17927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
17928         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
17929                 let contents = if o.result_ok {
17930                         let result = unsafe { o.contents.result };
17931                         unsafe { o.contents.result = core::ptr::null_mut() };
17932                         CResult_ShutdownScriptDecodeErrorZPtr { result }
17933                 } else {
17934                         let err = unsafe { o.contents.err };
17935                         unsafe { o.contents.err = core::ptr::null_mut(); }
17936                         CResult_ShutdownScriptDecodeErrorZPtr { err }
17937                 };
17938                 Self {
17939                         contents,
17940                         result_ok: o.result_ok,
17941                 }
17942         }
17943 }
17944 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
17945         fn clone(&self) -> Self {
17946                 if self.result_ok {
17947                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
17948                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
17949                         } }
17950                 } else {
17951                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
17952                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17953                         } }
17954                 }
17955         }
17956 }
17957 #[no_mangle]
17958 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
17959 /// but with all dynamically-allocated buffers duplicated in new buffers.
17960 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
17961 #[repr(C)]
17962 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
17963 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17964         /// A pointer to the contents in the success state.
17965         /// Reading from this pointer when `result_ok` is not set is undefined.
17966         pub result: *mut crate::lightning::ln::script::ShutdownScript,
17967         /// A pointer to the contents in the error state.
17968         /// Reading from this pointer when `result_ok` is set is undefined.
17969         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
17970 }
17971 #[repr(C)]
17972 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
17973 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
17974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17975 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
17976         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
17977         /// `err` or `result` depending on the state of `result_ok`.
17978         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
17979         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
17980         pub result_ok: bool,
17981 }
17982 #[no_mangle]
17983 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
17984 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
17985         CResult_ShutdownScriptInvalidShutdownScriptZ {
17986                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17987                         result: Box::into_raw(Box::new(o)),
17988                 },
17989                 result_ok: true,
17990         }
17991 }
17992 #[no_mangle]
17993 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
17994 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
17995         CResult_ShutdownScriptInvalidShutdownScriptZ {
17996                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17997                         err: Box::into_raw(Box::new(e)),
17998                 },
17999                 result_ok: false,
18000         }
18001 }
18002 /// Checks if the given object is currently in the success state
18003 #[no_mangle]
18004 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
18005         o.result_ok
18006 }
18007 #[no_mangle]
18008 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
18009 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
18010 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
18011         fn drop(&mut self) {
18012                 if self.result_ok {
18013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18015                         }
18016                 } else {
18017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18019                         }
18020                 }
18021         }
18022 }
18023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
18024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
18025                 let contents = if o.result_ok {
18026                         let result = unsafe { o.contents.result };
18027                         unsafe { o.contents.result = core::ptr::null_mut() };
18028                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
18029                 } else {
18030                         let err = unsafe { o.contents.err };
18031                         unsafe { o.contents.err = core::ptr::null_mut(); }
18032                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
18033                 };
18034                 Self {
18035                         contents,
18036                         result_ok: o.result_ok,
18037                 }
18038         }
18039 }
18040 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
18041         fn clone(&self) -> Self {
18042                 if self.result_ok {
18043                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
18044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
18045                         } }
18046                 } else {
18047                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
18048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
18049                         } }
18050                 }
18051         }
18052 }
18053 #[no_mangle]
18054 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
18055 /// but with all dynamically-allocated buffers duplicated in new buffers.
18056 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
18057 #[repr(C)]
18058 /// The contents of CResult_PaymentPurposeDecodeErrorZ
18059 pub union CResult_PaymentPurposeDecodeErrorZPtr {
18060         /// A pointer to the contents in the success state.
18061         /// Reading from this pointer when `result_ok` is not set is undefined.
18062         pub result: *mut crate::lightning::events::PaymentPurpose,
18063         /// A pointer to the contents in the error state.
18064         /// Reading from this pointer when `result_ok` is set is undefined.
18065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18066 }
18067 #[repr(C)]
18068 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
18069 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
18070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18071 pub struct CResult_PaymentPurposeDecodeErrorZ {
18072         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
18073         /// `err` or `result` depending on the state of `result_ok`.
18074         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
18075         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
18076         pub result_ok: bool,
18077 }
18078 #[no_mangle]
18079 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
18080 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
18081         CResult_PaymentPurposeDecodeErrorZ {
18082                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
18083                         result: Box::into_raw(Box::new(o)),
18084                 },
18085                 result_ok: true,
18086         }
18087 }
18088 #[no_mangle]
18089 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
18090 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
18091         CResult_PaymentPurposeDecodeErrorZ {
18092                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
18093                         err: Box::into_raw(Box::new(e)),
18094                 },
18095                 result_ok: false,
18096         }
18097 }
18098 /// Checks if the given object is currently in the success state
18099 #[no_mangle]
18100 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
18101         o.result_ok
18102 }
18103 #[no_mangle]
18104 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
18105 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
18106 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
18107         fn drop(&mut self) {
18108                 if self.result_ok {
18109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18111                         }
18112                 } else {
18113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18115                         }
18116                 }
18117         }
18118 }
18119 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
18120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
18121                 let contents = if o.result_ok {
18122                         let result = unsafe { o.contents.result };
18123                         unsafe { o.contents.result = core::ptr::null_mut() };
18124                         CResult_PaymentPurposeDecodeErrorZPtr { result }
18125                 } else {
18126                         let err = unsafe { o.contents.err };
18127                         unsafe { o.contents.err = core::ptr::null_mut(); }
18128                         CResult_PaymentPurposeDecodeErrorZPtr { err }
18129                 };
18130                 Self {
18131                         contents,
18132                         result_ok: o.result_ok,
18133                 }
18134         }
18135 }
18136 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
18137         fn clone(&self) -> Self {
18138                 if self.result_ok {
18139                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
18140                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
18141                         } }
18142                 } else {
18143                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
18144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18145                         } }
18146                 }
18147         }
18148 }
18149 #[no_mangle]
18150 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
18151 /// but with all dynamically-allocated buffers duplicated in new buffers.
18152 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
18153 #[repr(C)]
18154 #[derive(Clone)]
18155 /// An enum which can either contain a crate::lightning::events::PathFailure or not
18156 pub enum COption_PathFailureZ {
18157         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
18158         Some(crate::lightning::events::PathFailure),
18159         /// When we're in this state, this COption_PathFailureZ contains nothing
18160         None
18161 }
18162 impl COption_PathFailureZ {
18163         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18164                 if let Self::None = self { false } else { true }
18165         }
18166         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18167                 !self.is_some()
18168         }
18169         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
18170                 if let Self::Some(v) = self { v } else { unreachable!() }
18171         }
18172 }
18173 #[no_mangle]
18174 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
18175 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
18176         COption_PathFailureZ::Some(o)
18177 }
18178 #[no_mangle]
18179 /// Constructs a new COption_PathFailureZ containing nothing
18180 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
18181         COption_PathFailureZ::None
18182 }
18183 #[no_mangle]
18184 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
18185 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
18186 #[no_mangle]
18187 /// Creates a new COption_PathFailureZ which has the same data as `orig`
18188 /// but with all dynamically-allocated buffers duplicated in new buffers.
18189 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
18190 #[repr(C)]
18191 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
18192 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
18193         /// A pointer to the contents in the success state.
18194         /// Reading from this pointer when `result_ok` is not set is undefined.
18195         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
18196         /// A pointer to the contents in the error state.
18197         /// Reading from this pointer when `result_ok` is set is undefined.
18198         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18199 }
18200 #[repr(C)]
18201 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
18202 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18204 pub struct CResult_COption_PathFailureZDecodeErrorZ {
18205         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
18206         /// `err` or `result` depending on the state of `result_ok`.
18207         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
18208         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
18209         pub result_ok: bool,
18210 }
18211 #[no_mangle]
18212 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
18213 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
18214         CResult_COption_PathFailureZDecodeErrorZ {
18215                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18216                         result: Box::into_raw(Box::new(o)),
18217                 },
18218                 result_ok: true,
18219         }
18220 }
18221 #[no_mangle]
18222 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
18223 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
18224         CResult_COption_PathFailureZDecodeErrorZ {
18225                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18226                         err: Box::into_raw(Box::new(e)),
18227                 },
18228                 result_ok: false,
18229         }
18230 }
18231 /// Checks if the given object is currently in the success state
18232 #[no_mangle]
18233 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
18234         o.result_ok
18235 }
18236 #[no_mangle]
18237 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
18238 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
18239 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
18240         fn drop(&mut self) {
18241                 if self.result_ok {
18242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18244                         }
18245                 } else {
18246                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18247                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18248                         }
18249                 }
18250         }
18251 }
18252 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
18253         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18254                 let contents = if o.result_ok {
18255                         let result = unsafe { o.contents.result };
18256                         unsafe { o.contents.result = core::ptr::null_mut() };
18257                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
18258                 } else {
18259                         let err = unsafe { o.contents.err };
18260                         unsafe { o.contents.err = core::ptr::null_mut(); }
18261                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
18262                 };
18263                 Self {
18264                         contents,
18265                         result_ok: o.result_ok,
18266                 }
18267         }
18268 }
18269 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
18270         fn clone(&self) -> Self {
18271                 if self.result_ok {
18272                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18273                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
18274                         } }
18275                 } else {
18276                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18277                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18278                         } }
18279                 }
18280         }
18281 }
18282 #[no_mangle]
18283 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
18284 /// but with all dynamically-allocated buffers duplicated in new buffers.
18285 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
18286 #[repr(C)]
18287 #[derive(Clone)]
18288 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
18289 pub enum COption_ClosureReasonZ {
18290         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
18291         Some(crate::lightning::events::ClosureReason),
18292         /// When we're in this state, this COption_ClosureReasonZ contains nothing
18293         None
18294 }
18295 impl COption_ClosureReasonZ {
18296         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18297                 if let Self::None = self { false } else { true }
18298         }
18299         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18300                 !self.is_some()
18301         }
18302         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
18303                 if let Self::Some(v) = self { v } else { unreachable!() }
18304         }
18305 }
18306 #[no_mangle]
18307 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
18308 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
18309         COption_ClosureReasonZ::Some(o)
18310 }
18311 #[no_mangle]
18312 /// Constructs a new COption_ClosureReasonZ containing nothing
18313 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
18314         COption_ClosureReasonZ::None
18315 }
18316 #[no_mangle]
18317 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
18318 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
18319 #[no_mangle]
18320 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
18321 /// but with all dynamically-allocated buffers duplicated in new buffers.
18322 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
18323 #[repr(C)]
18324 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
18325 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
18326         /// A pointer to the contents in the success state.
18327         /// Reading from this pointer when `result_ok` is not set is undefined.
18328         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
18329         /// A pointer to the contents in the error state.
18330         /// Reading from this pointer when `result_ok` is set is undefined.
18331         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18332 }
18333 #[repr(C)]
18334 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
18335 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18337 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
18338         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
18339         /// `err` or `result` depending on the state of `result_ok`.
18340         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
18341         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
18342         pub result_ok: bool,
18343 }
18344 #[no_mangle]
18345 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
18346 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
18347         CResult_COption_ClosureReasonZDecodeErrorZ {
18348                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18349                         result: Box::into_raw(Box::new(o)),
18350                 },
18351                 result_ok: true,
18352         }
18353 }
18354 #[no_mangle]
18355 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
18356 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
18357         CResult_COption_ClosureReasonZDecodeErrorZ {
18358                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18359                         err: Box::into_raw(Box::new(e)),
18360                 },
18361                 result_ok: false,
18362         }
18363 }
18364 /// Checks if the given object is currently in the success state
18365 #[no_mangle]
18366 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
18367         o.result_ok
18368 }
18369 #[no_mangle]
18370 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
18371 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
18372 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
18373         fn drop(&mut self) {
18374                 if self.result_ok {
18375                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18376                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18377                         }
18378                 } else {
18379                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18380                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18381                         }
18382                 }
18383         }
18384 }
18385 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
18386         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18387                 let contents = if o.result_ok {
18388                         let result = unsafe { o.contents.result };
18389                         unsafe { o.contents.result = core::ptr::null_mut() };
18390                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
18391                 } else {
18392                         let err = unsafe { o.contents.err };
18393                         unsafe { o.contents.err = core::ptr::null_mut(); }
18394                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
18395                 };
18396                 Self {
18397                         contents,
18398                         result_ok: o.result_ok,
18399                 }
18400         }
18401 }
18402 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
18403         fn clone(&self) -> Self {
18404                 if self.result_ok {
18405                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18406                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
18407                         } }
18408                 } else {
18409                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18410                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18411                         } }
18412                 }
18413         }
18414 }
18415 #[no_mangle]
18416 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
18417 /// but with all dynamically-allocated buffers duplicated in new buffers.
18418 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
18419 #[repr(C)]
18420 #[derive(Clone)]
18421 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
18422 pub enum COption_HTLCDestinationZ {
18423         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
18424         Some(crate::lightning::events::HTLCDestination),
18425         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
18426         None
18427 }
18428 impl COption_HTLCDestinationZ {
18429         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18430                 if let Self::None = self { false } else { true }
18431         }
18432         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18433                 !self.is_some()
18434         }
18435         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
18436                 if let Self::Some(v) = self { v } else { unreachable!() }
18437         }
18438 }
18439 #[no_mangle]
18440 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
18441 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
18442         COption_HTLCDestinationZ::Some(o)
18443 }
18444 #[no_mangle]
18445 /// Constructs a new COption_HTLCDestinationZ containing nothing
18446 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
18447         COption_HTLCDestinationZ::None
18448 }
18449 #[no_mangle]
18450 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
18451 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
18452 #[no_mangle]
18453 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
18454 /// but with all dynamically-allocated buffers duplicated in new buffers.
18455 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
18456 #[repr(C)]
18457 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
18458 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18459         /// A pointer to the contents in the success state.
18460         /// Reading from this pointer when `result_ok` is not set is undefined.
18461         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
18462         /// A pointer to the contents in the error state.
18463         /// Reading from this pointer when `result_ok` is set is undefined.
18464         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18465 }
18466 #[repr(C)]
18467 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
18468 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18470 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
18471         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
18472         /// `err` or `result` depending on the state of `result_ok`.
18473         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
18474         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
18475         pub result_ok: bool,
18476 }
18477 #[no_mangle]
18478 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
18479 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
18480         CResult_COption_HTLCDestinationZDecodeErrorZ {
18481                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18482                         result: Box::into_raw(Box::new(o)),
18483                 },
18484                 result_ok: true,
18485         }
18486 }
18487 #[no_mangle]
18488 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
18489 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
18490         CResult_COption_HTLCDestinationZDecodeErrorZ {
18491                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18492                         err: Box::into_raw(Box::new(e)),
18493                 },
18494                 result_ok: false,
18495         }
18496 }
18497 /// Checks if the given object is currently in the success state
18498 #[no_mangle]
18499 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
18500         o.result_ok
18501 }
18502 #[no_mangle]
18503 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
18504 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
18505 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
18506         fn drop(&mut self) {
18507                 if self.result_ok {
18508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18510                         }
18511                 } else {
18512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18514                         }
18515                 }
18516         }
18517 }
18518 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
18519         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18520                 let contents = if o.result_ok {
18521                         let result = unsafe { o.contents.result };
18522                         unsafe { o.contents.result = core::ptr::null_mut() };
18523                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
18524                 } else {
18525                         let err = unsafe { o.contents.err };
18526                         unsafe { o.contents.err = core::ptr::null_mut(); }
18527                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
18528                 };
18529                 Self {
18530                         contents,
18531                         result_ok: o.result_ok,
18532                 }
18533         }
18534 }
18535 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
18536         fn clone(&self) -> Self {
18537                 if self.result_ok {
18538                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18539                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
18540                         } }
18541                 } else {
18542                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18543                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18544                         } }
18545                 }
18546         }
18547 }
18548 #[no_mangle]
18549 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
18550 /// but with all dynamically-allocated buffers duplicated in new buffers.
18551 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
18552 #[repr(C)]
18553 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
18554 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
18555         /// A pointer to the contents in the success state.
18556         /// Reading from this pointer when `result_ok` is not set is undefined.
18557         pub result: *mut crate::lightning::events::PaymentFailureReason,
18558         /// A pointer to the contents in the error state.
18559         /// Reading from this pointer when `result_ok` is set is undefined.
18560         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18561 }
18562 #[repr(C)]
18563 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
18564 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
18565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18566 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
18567         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
18568         /// `err` or `result` depending on the state of `result_ok`.
18569         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
18570         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
18571         pub result_ok: bool,
18572 }
18573 #[no_mangle]
18574 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
18575 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
18576         CResult_PaymentFailureReasonDecodeErrorZ {
18577                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18578                         result: Box::into_raw(Box::new(o)),
18579                 },
18580                 result_ok: true,
18581         }
18582 }
18583 #[no_mangle]
18584 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
18585 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
18586         CResult_PaymentFailureReasonDecodeErrorZ {
18587                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18588                         err: Box::into_raw(Box::new(e)),
18589                 },
18590                 result_ok: false,
18591         }
18592 }
18593 /// Checks if the given object is currently in the success state
18594 #[no_mangle]
18595 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
18596         o.result_ok
18597 }
18598 #[no_mangle]
18599 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
18600 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
18601 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
18602         fn drop(&mut self) {
18603                 if self.result_ok {
18604                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18605                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18606                         }
18607                 } else {
18608                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18609                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18610                         }
18611                 }
18612         }
18613 }
18614 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
18615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
18616                 let contents = if o.result_ok {
18617                         let result = unsafe { o.contents.result };
18618                         unsafe { o.contents.result = core::ptr::null_mut() };
18619                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
18620                 } else {
18621                         let err = unsafe { o.contents.err };
18622                         unsafe { o.contents.err = core::ptr::null_mut(); }
18623                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
18624                 };
18625                 Self {
18626                         contents,
18627                         result_ok: o.result_ok,
18628                 }
18629         }
18630 }
18631 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
18632         fn clone(&self) -> Self {
18633                 if self.result_ok {
18634                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18635                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
18636                         } }
18637                 } else {
18638                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18639                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18640                         } }
18641                 }
18642         }
18643 }
18644 #[no_mangle]
18645 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
18646 /// but with all dynamically-allocated buffers duplicated in new buffers.
18647 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
18648 #[repr(C)]
18649 #[derive(Clone)]
18650 /// An enum which can either contain a crate::c_types::U128 or not
18651 pub enum COption_u128Z {
18652         /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
18653         Some(crate::c_types::U128),
18654         /// When we're in this state, this COption_u128Z contains nothing
18655         None
18656 }
18657 impl COption_u128Z {
18658         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18659                 if let Self::None = self { false } else { true }
18660         }
18661         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18662                 !self.is_some()
18663         }
18664         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
18665                 if let Self::Some(v) = self { v } else { unreachable!() }
18666         }
18667 }
18668 #[no_mangle]
18669 /// Constructs a new COption_u128Z containing a crate::c_types::U128
18670 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
18671         COption_u128Z::Some(o)
18672 }
18673 #[no_mangle]
18674 /// Constructs a new COption_u128Z containing nothing
18675 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
18676         COption_u128Z::None
18677 }
18678 #[no_mangle]
18679 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
18680 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
18681 #[no_mangle]
18682 /// Creates a new COption_u128Z which has the same data as `orig`
18683 /// but with all dynamically-allocated buffers duplicated in new buffers.
18684 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
18685 #[repr(C)]
18686 #[derive(Clone)]
18687 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
18688 pub enum COption_PaymentIdZ {
18689         /// When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes
18690         Some(crate::c_types::ThirtyTwoBytes),
18691         /// When we're in this state, this COption_PaymentIdZ contains nothing
18692         None
18693 }
18694 impl COption_PaymentIdZ {
18695         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18696                 if let Self::None = self { false } else { true }
18697         }
18698         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18699                 !self.is_some()
18700         }
18701         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
18702                 if let Self::Some(v) = self { v } else { unreachable!() }
18703         }
18704 }
18705 #[no_mangle]
18706 /// Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes
18707 pub extern "C" fn COption_PaymentIdZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentIdZ {
18708         COption_PaymentIdZ::Some(o)
18709 }
18710 #[no_mangle]
18711 /// Constructs a new COption_PaymentIdZ containing nothing
18712 pub extern "C" fn COption_PaymentIdZ_none() -> COption_PaymentIdZ {
18713         COption_PaymentIdZ::None
18714 }
18715 #[no_mangle]
18716 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
18717 pub extern "C" fn COption_PaymentIdZ_free(_res: COption_PaymentIdZ) { }
18718 #[no_mangle]
18719 /// Creates a new COption_PaymentIdZ which has the same data as `orig`
18720 /// but with all dynamically-allocated buffers duplicated in new buffers.
18721 pub extern "C" fn COption_PaymentIdZ_clone(orig: &COption_PaymentIdZ) -> COption_PaymentIdZ { Clone::clone(&orig) }
18722 #[repr(C)]
18723 #[derive(Clone)]
18724 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
18725 pub enum COption_PaymentFailureReasonZ {
18726         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
18727         Some(crate::lightning::events::PaymentFailureReason),
18728         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
18729         None
18730 }
18731 impl COption_PaymentFailureReasonZ {
18732         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18733                 if let Self::None = self { false } else { true }
18734         }
18735         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18736                 !self.is_some()
18737         }
18738         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
18739                 if let Self::Some(v) = self { v } else { unreachable!() }
18740         }
18741 }
18742 #[no_mangle]
18743 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
18744 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
18745         COption_PaymentFailureReasonZ::Some(o)
18746 }
18747 #[no_mangle]
18748 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
18749 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
18750         COption_PaymentFailureReasonZ::None
18751 }
18752 #[no_mangle]
18753 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
18754 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
18755 #[no_mangle]
18756 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
18757 /// but with all dynamically-allocated buffers duplicated in new buffers.
18758 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
18759 #[repr(C)]
18760 #[derive(Clone)]
18761 /// An enum which can either contain a crate::lightning::events::Event or not
18762 pub enum COption_EventZ {
18763         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
18764         Some(crate::lightning::events::Event),
18765         /// When we're in this state, this COption_EventZ contains nothing
18766         None
18767 }
18768 impl COption_EventZ {
18769         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18770                 if let Self::None = self { false } else { true }
18771         }
18772         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18773                 !self.is_some()
18774         }
18775         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
18776                 if let Self::Some(v) = self { v } else { unreachable!() }
18777         }
18778 }
18779 #[no_mangle]
18780 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
18781 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
18782         COption_EventZ::Some(o)
18783 }
18784 #[no_mangle]
18785 /// Constructs a new COption_EventZ containing nothing
18786 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
18787         COption_EventZ::None
18788 }
18789 #[no_mangle]
18790 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
18791 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
18792 #[no_mangle]
18793 /// Creates a new COption_EventZ which has the same data as `orig`
18794 /// but with all dynamically-allocated buffers duplicated in new buffers.
18795 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
18796 #[repr(C)]
18797 /// The contents of CResult_COption_EventZDecodeErrorZ
18798 pub union CResult_COption_EventZDecodeErrorZPtr {
18799         /// A pointer to the contents in the success state.
18800         /// Reading from this pointer when `result_ok` is not set is undefined.
18801         pub result: *mut crate::c_types::derived::COption_EventZ,
18802         /// A pointer to the contents in the error state.
18803         /// Reading from this pointer when `result_ok` is set is undefined.
18804         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18805 }
18806 #[repr(C)]
18807 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
18808 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18810 pub struct CResult_COption_EventZDecodeErrorZ {
18811         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
18812         /// `err` or `result` depending on the state of `result_ok`.
18813         pub contents: CResult_COption_EventZDecodeErrorZPtr,
18814         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
18815         pub result_ok: bool,
18816 }
18817 #[no_mangle]
18818 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
18819 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
18820         CResult_COption_EventZDecodeErrorZ {
18821                 contents: CResult_COption_EventZDecodeErrorZPtr {
18822                         result: Box::into_raw(Box::new(o)),
18823                 },
18824                 result_ok: true,
18825         }
18826 }
18827 #[no_mangle]
18828 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
18829 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
18830         CResult_COption_EventZDecodeErrorZ {
18831                 contents: CResult_COption_EventZDecodeErrorZPtr {
18832                         err: Box::into_raw(Box::new(e)),
18833                 },
18834                 result_ok: false,
18835         }
18836 }
18837 /// Checks if the given object is currently in the success state
18838 #[no_mangle]
18839 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
18840         o.result_ok
18841 }
18842 #[no_mangle]
18843 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
18844 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
18845 impl Drop for CResult_COption_EventZDecodeErrorZ {
18846         fn drop(&mut self) {
18847                 if self.result_ok {
18848                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18849                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18850                         }
18851                 } else {
18852                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18853                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18854                         }
18855                 }
18856         }
18857 }
18858 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
18859         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18860                 let contents = if o.result_ok {
18861                         let result = unsafe { o.contents.result };
18862                         unsafe { o.contents.result = core::ptr::null_mut() };
18863                         CResult_COption_EventZDecodeErrorZPtr { result }
18864                 } else {
18865                         let err = unsafe { o.contents.err };
18866                         unsafe { o.contents.err = core::ptr::null_mut(); }
18867                         CResult_COption_EventZDecodeErrorZPtr { err }
18868                 };
18869                 Self {
18870                         contents,
18871                         result_ok: o.result_ok,
18872                 }
18873         }
18874 }
18875 impl Clone for CResult_COption_EventZDecodeErrorZ {
18876         fn clone(&self) -> Self {
18877                 if self.result_ok {
18878                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
18879                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
18880                         } }
18881                 } else {
18882                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
18883                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18884                         } }
18885                 }
18886         }
18887 }
18888 #[no_mangle]
18889 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
18890 /// but with all dynamically-allocated buffers duplicated in new buffers.
18891 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
18892 #[repr(C)]
18893 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
18894 /// This corresponds to std::vector in C++
18895 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
18896         /// The elements in the array.
18897         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18898         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
18899         /// The number of elements pointed to by `data`.
18900         pub datalen: usize
18901 }
18902 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
18903         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
18904                 if self.datalen == 0 { return Vec::new(); }
18905                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18906                 self.data = core::ptr::null_mut();
18907                 self.datalen = 0;
18908                 ret
18909         }
18910         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
18911                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18912         }
18913 }
18914 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
18915         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
18916                 let datalen = v.len();
18917                 let data = Box::into_raw(v.into_boxed_slice());
18918                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18919         }
18920 }
18921 #[no_mangle]
18922 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18923 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
18924 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
18925         fn drop(&mut self) {
18926                 if self.datalen == 0 { return; }
18927                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18928         }
18929 }
18930 #[repr(C)]
18931 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
18932 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18933         /// A pointer to the contents in the success state.
18934         /// Reading from this pointer when `result_ok` is not set is undefined.
18935         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
18936         /// A pointer to the contents in the error state.
18937         /// Reading from this pointer when `result_ok` is set is undefined.
18938         pub err: *mut crate::c_types::IOError,
18939 }
18940 #[repr(C)]
18941 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
18942 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
18943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18944 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18945         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
18946         /// `err` or `result` depending on the state of `result_ok`.
18947         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
18948         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
18949         pub result_ok: bool,
18950 }
18951 #[no_mangle]
18952 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
18953 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18954         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18955                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18956                         result: Box::into_raw(Box::new(o)),
18957                 },
18958                 result_ok: true,
18959         }
18960 }
18961 #[no_mangle]
18962 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
18963 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18964         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18965                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18966                         err: Box::into_raw(Box::new(e)),
18967                 },
18968                 result_ok: false,
18969         }
18970 }
18971 /// Checks if the given object is currently in the success state
18972 #[no_mangle]
18973 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
18974         o.result_ok
18975 }
18976 #[no_mangle]
18977 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
18978 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
18979 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18980         fn drop(&mut self) {
18981                 if self.result_ok {
18982                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18983                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18984                         }
18985                 } else {
18986                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18987                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18988                         }
18989                 }
18990         }
18991 }
18992 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18993         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
18994                 let contents = if o.result_ok {
18995                         let result = unsafe { o.contents.result };
18996                         unsafe { o.contents.result = core::ptr::null_mut() };
18997                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
18998                 } else {
18999                         let err = unsafe { o.contents.err };
19000                         unsafe { o.contents.err = core::ptr::null_mut(); }
19001                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
19002                 };
19003                 Self {
19004                         contents,
19005                         result_ok: o.result_ok,
19006                 }
19007         }
19008 }
19009 #[repr(C)]
19010 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
19011 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
19012         /// A pointer to the contents in the success state.
19013         /// Reading from this pointer when `result_ok` is not set is undefined.
19014         pub result: *mut crate::lightning_invoice::SiPrefix,
19015         /// A pointer to the contents in the error state.
19016         /// Reading from this pointer when `result_ok` is set is undefined.
19017         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
19018 }
19019 #[repr(C)]
19020 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
19021 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19023 pub struct CResult_SiPrefixBolt11ParseErrorZ {
19024         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
19025         /// `err` or `result` depending on the state of `result_ok`.
19026         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
19027         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
19028         pub result_ok: bool,
19029 }
19030 #[no_mangle]
19031 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
19032 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
19033         CResult_SiPrefixBolt11ParseErrorZ {
19034                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19035                         result: Box::into_raw(Box::new(o)),
19036                 },
19037                 result_ok: true,
19038         }
19039 }
19040 #[no_mangle]
19041 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
19042 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
19043         CResult_SiPrefixBolt11ParseErrorZ {
19044                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19045                         err: Box::into_raw(Box::new(e)),
19046                 },
19047                 result_ok: false,
19048         }
19049 }
19050 /// Checks if the given object is currently in the success state
19051 #[no_mangle]
19052 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
19053         o.result_ok
19054 }
19055 #[no_mangle]
19056 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
19057 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
19058 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
19059         fn drop(&mut self) {
19060                 if self.result_ok {
19061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19063                         }
19064                 } else {
19065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19067                         }
19068                 }
19069         }
19070 }
19071 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
19072         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
19073                 let contents = if o.result_ok {
19074                         let result = unsafe { o.contents.result };
19075                         unsafe { o.contents.result = core::ptr::null_mut() };
19076                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
19077                 } else {
19078                         let err = unsafe { o.contents.err };
19079                         unsafe { o.contents.err = core::ptr::null_mut(); }
19080                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
19081                 };
19082                 Self {
19083                         contents,
19084                         result_ok: o.result_ok,
19085                 }
19086         }
19087 }
19088 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
19089         fn clone(&self) -> Self {
19090                 if self.result_ok {
19091                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19092                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
19093                         } }
19094                 } else {
19095                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19096                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
19097                         } }
19098                 }
19099         }
19100 }
19101 #[no_mangle]
19102 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
19103 /// but with all dynamically-allocated buffers duplicated in new buffers.
19104 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
19105 #[repr(C)]
19106 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
19107 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19108         /// A pointer to the contents in the success state.
19109         /// Reading from this pointer when `result_ok` is not set is undefined.
19110         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19111         /// A pointer to the contents in the error state.
19112         /// Reading from this pointer when `result_ok` is set is undefined.
19113         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
19114 }
19115 #[repr(C)]
19116 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
19117 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
19118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19119 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19120         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
19121         /// `err` or `result` depending on the state of `result_ok`.
19122         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
19123         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
19124         pub result_ok: bool,
19125 }
19126 #[no_mangle]
19127 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
19128 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19129         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19130                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19131                         result: Box::into_raw(Box::new(o)),
19132                 },
19133                 result_ok: true,
19134         }
19135 }
19136 #[no_mangle]
19137 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
19138 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19139         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19140                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19141                         err: Box::into_raw(Box::new(e)),
19142                 },
19143                 result_ok: false,
19144         }
19145 }
19146 /// Checks if the given object is currently in the success state
19147 #[no_mangle]
19148 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
19149         o.result_ok
19150 }
19151 #[no_mangle]
19152 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
19153 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
19154 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19155         fn drop(&mut self) {
19156                 if self.result_ok {
19157                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19158                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19159                         }
19160                 } else {
19161                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19162                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19163                         }
19164                 }
19165         }
19166 }
19167 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19168         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
19169                 let contents = if o.result_ok {
19170                         let result = unsafe { o.contents.result };
19171                         unsafe { o.contents.result = core::ptr::null_mut() };
19172                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
19173                 } else {
19174                         let err = unsafe { o.contents.err };
19175                         unsafe { o.contents.err = core::ptr::null_mut(); }
19176                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
19177                 };
19178                 Self {
19179                         contents,
19180                         result_ok: o.result_ok,
19181                 }
19182         }
19183 }
19184 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19185         fn clone(&self) -> Self {
19186                 if self.result_ok {
19187                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19188                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19189                         } }
19190                 } else {
19191                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19192                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
19193                         } }
19194                 }
19195         }
19196 }
19197 #[no_mangle]
19198 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
19199 /// but with all dynamically-allocated buffers duplicated in new buffers.
19200 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
19201 #[repr(C)]
19202 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
19203 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19204         /// A pointer to the contents in the success state.
19205         /// Reading from this pointer when `result_ok` is not set is undefined.
19206         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
19207         /// A pointer to the contents in the error state.
19208         /// Reading from this pointer when `result_ok` is set is undefined.
19209         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
19210 }
19211 #[repr(C)]
19212 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
19213 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19215 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19216         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
19217         /// `err` or `result` depending on the state of `result_ok`.
19218         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
19219         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
19220         pub result_ok: bool,
19221 }
19222 #[no_mangle]
19223 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
19224 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19225         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19226                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19227                         result: Box::into_raw(Box::new(o)),
19228                 },
19229                 result_ok: true,
19230         }
19231 }
19232 #[no_mangle]
19233 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
19234 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19235         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19236                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19237                         err: Box::into_raw(Box::new(e)),
19238                 },
19239                 result_ok: false,
19240         }
19241 }
19242 /// Checks if the given object is currently in the success state
19243 #[no_mangle]
19244 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
19245         o.result_ok
19246 }
19247 #[no_mangle]
19248 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
19249 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
19250 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19251         fn drop(&mut self) {
19252                 if self.result_ok {
19253                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19254                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19255                         }
19256                 } else {
19257                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19258                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19259                         }
19260                 }
19261         }
19262 }
19263 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19264         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
19265                 let contents = if o.result_ok {
19266                         let result = unsafe { o.contents.result };
19267                         unsafe { o.contents.result = core::ptr::null_mut() };
19268                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
19269                 } else {
19270                         let err = unsafe { o.contents.err };
19271                         unsafe { o.contents.err = core::ptr::null_mut(); }
19272                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
19273                 };
19274                 Self {
19275                         contents,
19276                         result_ok: o.result_ok,
19277                 }
19278         }
19279 }
19280 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19281         fn clone(&self) -> Self {
19282                 if self.result_ok {
19283                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19284                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
19285                         } }
19286                 } else {
19287                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19288                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
19289                         } }
19290                 }
19291         }
19292 }
19293 #[no_mangle]
19294 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
19295 /// but with all dynamically-allocated buffers duplicated in new buffers.
19296 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
19297 #[repr(C)]
19298 /// A tuple of 3 elements. See the individual fields for the types contained.
19299 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19300         /// The element at position 0
19301         pub a: crate::lightning_invoice::RawBolt11Invoice,
19302         /// The element at position 1
19303         pub b: crate::c_types::ThirtyTwoBytes,
19304         /// The element at position 2
19305         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
19306 }
19307 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19308         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
19309                 Self {
19310                         a: tup.0,
19311                         b: tup.1,
19312                         c: tup.2,
19313                 }
19314         }
19315 }
19316 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19317         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
19318                 (self.a, self.b, self.c)
19319         }
19320 }
19321 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19322         fn clone(&self) -> Self {
19323                 Self {
19324                         a: Clone::clone(&self.a),
19325                         b: Clone::clone(&self.b),
19326                         c: Clone::clone(&self.c),
19327                 }
19328         }
19329 }
19330 #[no_mangle]
19331 /// Creates a new tuple which has the same data as `orig`
19332 /// but with all dynamically-allocated buffers duplicated in new buffers.
19333 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
19334 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
19335 #[no_mangle]
19336 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19337         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
19338 }
19339
19340 #[no_mangle]
19341 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
19342 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
19343 #[repr(C)]
19344 /// The contents of CResult_PayeePubKeyErrorZ
19345 pub union CResult_PayeePubKeyErrorZPtr {
19346         /// A pointer to the contents in the success state.
19347         /// Reading from this pointer when `result_ok` is not set is undefined.
19348         pub result: *mut crate::lightning_invoice::PayeePubKey,
19349         /// A pointer to the contents in the error state.
19350         /// Reading from this pointer when `result_ok` is set is undefined.
19351         pub err: *mut crate::c_types::Secp256k1Error,
19352 }
19353 #[repr(C)]
19354 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
19355 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
19356 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19357 pub struct CResult_PayeePubKeyErrorZ {
19358         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
19359         /// `err` or `result` depending on the state of `result_ok`.
19360         pub contents: CResult_PayeePubKeyErrorZPtr,
19361         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
19362         pub result_ok: bool,
19363 }
19364 #[no_mangle]
19365 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
19366 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
19367         CResult_PayeePubKeyErrorZ {
19368                 contents: CResult_PayeePubKeyErrorZPtr {
19369                         result: Box::into_raw(Box::new(o)),
19370                 },
19371                 result_ok: true,
19372         }
19373 }
19374 #[no_mangle]
19375 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
19376 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
19377         CResult_PayeePubKeyErrorZ {
19378                 contents: CResult_PayeePubKeyErrorZPtr {
19379                         err: Box::into_raw(Box::new(e)),
19380                 },
19381                 result_ok: false,
19382         }
19383 }
19384 /// Checks if the given object is currently in the success state
19385 #[no_mangle]
19386 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
19387         o.result_ok
19388 }
19389 #[no_mangle]
19390 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
19391 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
19392 impl Drop for CResult_PayeePubKeyErrorZ {
19393         fn drop(&mut self) {
19394                 if self.result_ok {
19395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19397                         }
19398                 } else {
19399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19401                         }
19402                 }
19403         }
19404 }
19405 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
19406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
19407                 let contents = if o.result_ok {
19408                         let result = unsafe { o.contents.result };
19409                         unsafe { o.contents.result = core::ptr::null_mut() };
19410                         CResult_PayeePubKeyErrorZPtr { result }
19411                 } else {
19412                         let err = unsafe { o.contents.err };
19413                         unsafe { o.contents.err = core::ptr::null_mut(); }
19414                         CResult_PayeePubKeyErrorZPtr { err }
19415                 };
19416                 Self {
19417                         contents,
19418                         result_ok: o.result_ok,
19419                 }
19420         }
19421 }
19422 impl Clone for CResult_PayeePubKeyErrorZ {
19423         fn clone(&self) -> Self {
19424                 if self.result_ok {
19425                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
19426                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
19427                         } }
19428                 } else {
19429                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
19430                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
19431                         } }
19432                 }
19433         }
19434 }
19435 #[no_mangle]
19436 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
19437 /// but with all dynamically-allocated buffers duplicated in new buffers.
19438 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
19439 #[repr(C)]
19440 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
19441 /// This corresponds to std::vector in C++
19442 pub struct CVec_PrivateRouteZ {
19443         /// The elements in the array.
19444         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19445         pub data: *mut crate::lightning_invoice::PrivateRoute,
19446         /// The number of elements pointed to by `data`.
19447         pub datalen: usize
19448 }
19449 impl CVec_PrivateRouteZ {
19450         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
19451                 if self.datalen == 0 { return Vec::new(); }
19452                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19453                 self.data = core::ptr::null_mut();
19454                 self.datalen = 0;
19455                 ret
19456         }
19457         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
19458                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19459         }
19460 }
19461 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
19462         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
19463                 let datalen = v.len();
19464                 let data = Box::into_raw(v.into_boxed_slice());
19465                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19466         }
19467 }
19468 #[no_mangle]
19469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19470 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
19471 impl Drop for CVec_PrivateRouteZ {
19472         fn drop(&mut self) {
19473                 if self.datalen == 0 { return; }
19474                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19475         }
19476 }
19477 impl Clone for CVec_PrivateRouteZ {
19478         fn clone(&self) -> Self {
19479                 let mut res = Vec::new();
19480                 if self.datalen == 0 { return Self::from(res); }
19481                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19482                 Self::from(res)
19483         }
19484 }
19485 #[repr(C)]
19486 /// The contents of CResult_PositiveTimestampCreationErrorZ
19487 pub union CResult_PositiveTimestampCreationErrorZPtr {
19488         /// A pointer to the contents in the success state.
19489         /// Reading from this pointer when `result_ok` is not set is undefined.
19490         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
19491         /// A pointer to the contents in the error state.
19492         /// Reading from this pointer when `result_ok` is set is undefined.
19493         pub err: *mut crate::lightning_invoice::CreationError,
19494 }
19495 #[repr(C)]
19496 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
19497 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
19498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19499 pub struct CResult_PositiveTimestampCreationErrorZ {
19500         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
19501         /// `err` or `result` depending on the state of `result_ok`.
19502         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
19503         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
19504         pub result_ok: bool,
19505 }
19506 #[no_mangle]
19507 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
19508 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
19509         CResult_PositiveTimestampCreationErrorZ {
19510                 contents: CResult_PositiveTimestampCreationErrorZPtr {
19511                         result: Box::into_raw(Box::new(o)),
19512                 },
19513                 result_ok: true,
19514         }
19515 }
19516 #[no_mangle]
19517 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
19518 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
19519         CResult_PositiveTimestampCreationErrorZ {
19520                 contents: CResult_PositiveTimestampCreationErrorZPtr {
19521                         err: Box::into_raw(Box::new(e)),
19522                 },
19523                 result_ok: false,
19524         }
19525 }
19526 /// Checks if the given object is currently in the success state
19527 #[no_mangle]
19528 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
19529         o.result_ok
19530 }
19531 #[no_mangle]
19532 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
19533 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
19534 impl Drop for CResult_PositiveTimestampCreationErrorZ {
19535         fn drop(&mut self) {
19536                 if self.result_ok {
19537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19539                         }
19540                 } else {
19541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19543                         }
19544                 }
19545         }
19546 }
19547 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
19548         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
19549                 let contents = if o.result_ok {
19550                         let result = unsafe { o.contents.result };
19551                         unsafe { o.contents.result = core::ptr::null_mut() };
19552                         CResult_PositiveTimestampCreationErrorZPtr { result }
19553                 } else {
19554                         let err = unsafe { o.contents.err };
19555                         unsafe { o.contents.err = core::ptr::null_mut(); }
19556                         CResult_PositiveTimestampCreationErrorZPtr { err }
19557                 };
19558                 Self {
19559                         contents,
19560                         result_ok: o.result_ok,
19561                 }
19562         }
19563 }
19564 impl Clone for CResult_PositiveTimestampCreationErrorZ {
19565         fn clone(&self) -> Self {
19566                 if self.result_ok {
19567                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
19568                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
19569                         } }
19570                 } else {
19571                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
19572                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
19573                         } }
19574                 }
19575         }
19576 }
19577 #[no_mangle]
19578 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
19579 /// but with all dynamically-allocated buffers duplicated in new buffers.
19580 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
19581 #[repr(C)]
19582 /// The contents of CResult_NoneBolt11SemanticErrorZ
19583 pub union CResult_NoneBolt11SemanticErrorZPtr {
19584         /// Note that this value is always NULL, as there are no contents in the OK variant
19585         pub result: *mut core::ffi::c_void,
19586         /// A pointer to the contents in the error state.
19587         /// Reading from this pointer when `result_ok` is set is undefined.
19588         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
19589 }
19590 #[repr(C)]
19591 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
19592 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19594 pub struct CResult_NoneBolt11SemanticErrorZ {
19595         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
19596         /// `err` or `result` depending on the state of `result_ok`.
19597         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
19598         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
19599         pub result_ok: bool,
19600 }
19601 #[no_mangle]
19602 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
19603 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
19604         CResult_NoneBolt11SemanticErrorZ {
19605                 contents: CResult_NoneBolt11SemanticErrorZPtr {
19606                         result: core::ptr::null_mut(),
19607                 },
19608                 result_ok: true,
19609         }
19610 }
19611 #[no_mangle]
19612 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
19613 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
19614         CResult_NoneBolt11SemanticErrorZ {
19615                 contents: CResult_NoneBolt11SemanticErrorZPtr {
19616                         err: Box::into_raw(Box::new(e)),
19617                 },
19618                 result_ok: false,
19619         }
19620 }
19621 /// Checks if the given object is currently in the success state
19622 #[no_mangle]
19623 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
19624         o.result_ok
19625 }
19626 #[no_mangle]
19627 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
19628 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
19629 impl Drop for CResult_NoneBolt11SemanticErrorZ {
19630         fn drop(&mut self) {
19631                 if self.result_ok {
19632                 } else {
19633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19635                         }
19636                 }
19637         }
19638 }
19639 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
19640         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
19641                 let contents = if o.result_ok {
19642                         let _ = unsafe { Box::from_raw(o.contents.result) };
19643                         o.contents.result = core::ptr::null_mut();
19644                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
19645                 } else {
19646                         let err = unsafe { o.contents.err };
19647                         unsafe { o.contents.err = core::ptr::null_mut(); }
19648                         CResult_NoneBolt11SemanticErrorZPtr { err }
19649                 };
19650                 Self {
19651                         contents,
19652                         result_ok: o.result_ok,
19653                 }
19654         }
19655 }
19656 impl Clone for CResult_NoneBolt11SemanticErrorZ {
19657         fn clone(&self) -> Self {
19658                 if self.result_ok {
19659                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
19660                                 result: core::ptr::null_mut()
19661                         } }
19662                 } else {
19663                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
19664                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
19665                         } }
19666                 }
19667         }
19668 }
19669 #[no_mangle]
19670 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
19671 /// but with all dynamically-allocated buffers duplicated in new buffers.
19672 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
19673 #[repr(C)]
19674 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
19675 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19676         /// A pointer to the contents in the success state.
19677         /// Reading from this pointer when `result_ok` is not set is undefined.
19678         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19679         /// A pointer to the contents in the error state.
19680         /// Reading from this pointer when `result_ok` is set is undefined.
19681         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
19682 }
19683 #[repr(C)]
19684 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
19685 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19687 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19688         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
19689         /// `err` or `result` depending on the state of `result_ok`.
19690         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
19691         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
19692         pub result_ok: bool,
19693 }
19694 #[no_mangle]
19695 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
19696 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19697         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19698                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19699                         result: Box::into_raw(Box::new(o)),
19700                 },
19701                 result_ok: true,
19702         }
19703 }
19704 #[no_mangle]
19705 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
19706 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19707         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19708                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19709                         err: Box::into_raw(Box::new(e)),
19710                 },
19711                 result_ok: false,
19712         }
19713 }
19714 /// Checks if the given object is currently in the success state
19715 #[no_mangle]
19716 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
19717         o.result_ok
19718 }
19719 #[no_mangle]
19720 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
19721 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
19722 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19723         fn drop(&mut self) {
19724                 if self.result_ok {
19725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19727                         }
19728                 } else {
19729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19731                         }
19732                 }
19733         }
19734 }
19735 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
19737                 let contents = if o.result_ok {
19738                         let result = unsafe { o.contents.result };
19739                         unsafe { o.contents.result = core::ptr::null_mut() };
19740                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
19741                 } else {
19742                         let err = unsafe { o.contents.err };
19743                         unsafe { o.contents.err = core::ptr::null_mut(); }
19744                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
19745                 };
19746                 Self {
19747                         contents,
19748                         result_ok: o.result_ok,
19749                 }
19750         }
19751 }
19752 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19753         fn clone(&self) -> Self {
19754                 if self.result_ok {
19755                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19756                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19757                         } }
19758                 } else {
19759                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19760                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
19761                         } }
19762                 }
19763         }
19764 }
19765 #[no_mangle]
19766 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
19767 /// but with all dynamically-allocated buffers duplicated in new buffers.
19768 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
19769 #[repr(C)]
19770 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
19771 /// This corresponds to std::vector in C++
19772 pub struct CVec_AddressZ {
19773         /// The elements in the array.
19774         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19775         pub data: *mut crate::c_types::Str,
19776         /// The number of elements pointed to by `data`.
19777         pub datalen: usize
19778 }
19779 impl CVec_AddressZ {
19780         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
19781                 if self.datalen == 0 { return Vec::new(); }
19782                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19783                 self.data = core::ptr::null_mut();
19784                 self.datalen = 0;
19785                 ret
19786         }
19787         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
19788                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19789         }
19790 }
19791 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
19792         fn from(v: Vec<crate::c_types::Str>) -> Self {
19793                 let datalen = v.len();
19794                 let data = Box::into_raw(v.into_boxed_slice());
19795                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19796         }
19797 }
19798 #[no_mangle]
19799 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19800 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
19801 impl Drop for CVec_AddressZ {
19802         fn drop(&mut self) {
19803                 if self.datalen == 0 { return; }
19804                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19805         }
19806 }
19807 impl Clone for CVec_AddressZ {
19808         fn clone(&self) -> Self {
19809                 let mut res = Vec::new();
19810                 if self.datalen == 0 { return Self::from(res); }
19811                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19812                 Self::from(res)
19813         }
19814 }
19815 #[repr(C)]
19816 /// The contents of CResult_DescriptionCreationErrorZ
19817 pub union CResult_DescriptionCreationErrorZPtr {
19818         /// A pointer to the contents in the success state.
19819         /// Reading from this pointer when `result_ok` is not set is undefined.
19820         pub result: *mut crate::lightning_invoice::Description,
19821         /// A pointer to the contents in the error state.
19822         /// Reading from this pointer when `result_ok` is set is undefined.
19823         pub err: *mut crate::lightning_invoice::CreationError,
19824 }
19825 #[repr(C)]
19826 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
19827 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
19828 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19829 pub struct CResult_DescriptionCreationErrorZ {
19830         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
19831         /// `err` or `result` depending on the state of `result_ok`.
19832         pub contents: CResult_DescriptionCreationErrorZPtr,
19833         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
19834         pub result_ok: bool,
19835 }
19836 #[no_mangle]
19837 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
19838 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
19839         CResult_DescriptionCreationErrorZ {
19840                 contents: CResult_DescriptionCreationErrorZPtr {
19841                         result: Box::into_raw(Box::new(o)),
19842                 },
19843                 result_ok: true,
19844         }
19845 }
19846 #[no_mangle]
19847 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
19848 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
19849         CResult_DescriptionCreationErrorZ {
19850                 contents: CResult_DescriptionCreationErrorZPtr {
19851                         err: Box::into_raw(Box::new(e)),
19852                 },
19853                 result_ok: false,
19854         }
19855 }
19856 /// Checks if the given object is currently in the success state
19857 #[no_mangle]
19858 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
19859         o.result_ok
19860 }
19861 #[no_mangle]
19862 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
19863 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
19864 impl Drop for CResult_DescriptionCreationErrorZ {
19865         fn drop(&mut self) {
19866                 if self.result_ok {
19867                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19868                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19869                         }
19870                 } else {
19871                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19872                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19873                         }
19874                 }
19875         }
19876 }
19877 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
19878         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
19879                 let contents = if o.result_ok {
19880                         let result = unsafe { o.contents.result };
19881                         unsafe { o.contents.result = core::ptr::null_mut() };
19882                         CResult_DescriptionCreationErrorZPtr { result }
19883                 } else {
19884                         let err = unsafe { o.contents.err };
19885                         unsafe { o.contents.err = core::ptr::null_mut(); }
19886                         CResult_DescriptionCreationErrorZPtr { err }
19887                 };
19888                 Self {
19889                         contents,
19890                         result_ok: o.result_ok,
19891                 }
19892         }
19893 }
19894 impl Clone for CResult_DescriptionCreationErrorZ {
19895         fn clone(&self) -> Self {
19896                 if self.result_ok {
19897                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
19898                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
19899                         } }
19900                 } else {
19901                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
19902                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
19903                         } }
19904                 }
19905         }
19906 }
19907 #[no_mangle]
19908 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
19909 /// but with all dynamically-allocated buffers duplicated in new buffers.
19910 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
19911 #[repr(C)]
19912 /// The contents of CResult_PrivateRouteCreationErrorZ
19913 pub union CResult_PrivateRouteCreationErrorZPtr {
19914         /// A pointer to the contents in the success state.
19915         /// Reading from this pointer when `result_ok` is not set is undefined.
19916         pub result: *mut crate::lightning_invoice::PrivateRoute,
19917         /// A pointer to the contents in the error state.
19918         /// Reading from this pointer when `result_ok` is set is undefined.
19919         pub err: *mut crate::lightning_invoice::CreationError,
19920 }
19921 #[repr(C)]
19922 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
19923 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
19924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19925 pub struct CResult_PrivateRouteCreationErrorZ {
19926         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
19927         /// `err` or `result` depending on the state of `result_ok`.
19928         pub contents: CResult_PrivateRouteCreationErrorZPtr,
19929         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
19930         pub result_ok: bool,
19931 }
19932 #[no_mangle]
19933 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
19934 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
19935         CResult_PrivateRouteCreationErrorZ {
19936                 contents: CResult_PrivateRouteCreationErrorZPtr {
19937                         result: Box::into_raw(Box::new(o)),
19938                 },
19939                 result_ok: true,
19940         }
19941 }
19942 #[no_mangle]
19943 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
19944 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
19945         CResult_PrivateRouteCreationErrorZ {
19946                 contents: CResult_PrivateRouteCreationErrorZPtr {
19947                         err: Box::into_raw(Box::new(e)),
19948                 },
19949                 result_ok: false,
19950         }
19951 }
19952 /// Checks if the given object is currently in the success state
19953 #[no_mangle]
19954 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
19955         o.result_ok
19956 }
19957 #[no_mangle]
19958 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
19959 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
19960 impl Drop for CResult_PrivateRouteCreationErrorZ {
19961         fn drop(&mut self) {
19962                 if self.result_ok {
19963                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19964                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19965                         }
19966                 } else {
19967                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19968                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19969                         }
19970                 }
19971         }
19972 }
19973 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
19974         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
19975                 let contents = if o.result_ok {
19976                         let result = unsafe { o.contents.result };
19977                         unsafe { o.contents.result = core::ptr::null_mut() };
19978                         CResult_PrivateRouteCreationErrorZPtr { result }
19979                 } else {
19980                         let err = unsafe { o.contents.err };
19981                         unsafe { o.contents.err = core::ptr::null_mut(); }
19982                         CResult_PrivateRouteCreationErrorZPtr { err }
19983                 };
19984                 Self {
19985                         contents,
19986                         result_ok: o.result_ok,
19987                 }
19988         }
19989 }
19990 impl Clone for CResult_PrivateRouteCreationErrorZ {
19991         fn clone(&self) -> Self {
19992                 if self.result_ok {
19993                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
19994                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
19995                         } }
19996                 } else {
19997                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
19998                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
19999                         } }
20000                 }
20001         }
20002 }
20003 #[no_mangle]
20004 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
20005 /// but with all dynamically-allocated buffers duplicated in new buffers.
20006 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
20007 #[repr(C)]
20008 /// The contents of CResult_OutPointDecodeErrorZ
20009 pub union CResult_OutPointDecodeErrorZPtr {
20010         /// A pointer to the contents in the success state.
20011         /// Reading from this pointer when `result_ok` is not set is undefined.
20012         pub result: *mut crate::lightning::chain::transaction::OutPoint,
20013         /// A pointer to the contents in the error state.
20014         /// Reading from this pointer when `result_ok` is set is undefined.
20015         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20016 }
20017 #[repr(C)]
20018 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
20019 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
20020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20021 pub struct CResult_OutPointDecodeErrorZ {
20022         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
20023         /// `err` or `result` depending on the state of `result_ok`.
20024         pub contents: CResult_OutPointDecodeErrorZPtr,
20025         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
20026         pub result_ok: bool,
20027 }
20028 #[no_mangle]
20029 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
20030 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
20031         CResult_OutPointDecodeErrorZ {
20032                 contents: CResult_OutPointDecodeErrorZPtr {
20033                         result: Box::into_raw(Box::new(o)),
20034                 },
20035                 result_ok: true,
20036         }
20037 }
20038 #[no_mangle]
20039 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
20040 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
20041         CResult_OutPointDecodeErrorZ {
20042                 contents: CResult_OutPointDecodeErrorZPtr {
20043                         err: Box::into_raw(Box::new(e)),
20044                 },
20045                 result_ok: false,
20046         }
20047 }
20048 /// Checks if the given object is currently in the success state
20049 #[no_mangle]
20050 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
20051         o.result_ok
20052 }
20053 #[no_mangle]
20054 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
20055 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
20056 impl Drop for CResult_OutPointDecodeErrorZ {
20057         fn drop(&mut self) {
20058                 if self.result_ok {
20059                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20060                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20061                         }
20062                 } else {
20063                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20064                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20065                         }
20066                 }
20067         }
20068 }
20069 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
20070         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
20071                 let contents = if o.result_ok {
20072                         let result = unsafe { o.contents.result };
20073                         unsafe { o.contents.result = core::ptr::null_mut() };
20074                         CResult_OutPointDecodeErrorZPtr { result }
20075                 } else {
20076                         let err = unsafe { o.contents.err };
20077                         unsafe { o.contents.err = core::ptr::null_mut(); }
20078                         CResult_OutPointDecodeErrorZPtr { err }
20079                 };
20080                 Self {
20081                         contents,
20082                         result_ok: o.result_ok,
20083                 }
20084         }
20085 }
20086 impl Clone for CResult_OutPointDecodeErrorZ {
20087         fn clone(&self) -> Self {
20088                 if self.result_ok {
20089                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
20090                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
20091                         } }
20092                 } else {
20093                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
20094                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20095                         } }
20096                 }
20097         }
20098 }
20099 #[no_mangle]
20100 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
20101 /// but with all dynamically-allocated buffers duplicated in new buffers.
20102 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
20103 #[repr(C)]
20104 /// The contents of CResult_BigSizeDecodeErrorZ
20105 pub union CResult_BigSizeDecodeErrorZPtr {
20106         /// A pointer to the contents in the success state.
20107         /// Reading from this pointer when `result_ok` is not set is undefined.
20108         pub result: *mut crate::lightning::util::ser::BigSize,
20109         /// A pointer to the contents in the error state.
20110         /// Reading from this pointer when `result_ok` is set is undefined.
20111         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20112 }
20113 #[repr(C)]
20114 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
20115 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
20116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20117 pub struct CResult_BigSizeDecodeErrorZ {
20118         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
20119         /// `err` or `result` depending on the state of `result_ok`.
20120         pub contents: CResult_BigSizeDecodeErrorZPtr,
20121         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
20122         pub result_ok: bool,
20123 }
20124 #[no_mangle]
20125 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
20126 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
20127         CResult_BigSizeDecodeErrorZ {
20128                 contents: CResult_BigSizeDecodeErrorZPtr {
20129                         result: Box::into_raw(Box::new(o)),
20130                 },
20131                 result_ok: true,
20132         }
20133 }
20134 #[no_mangle]
20135 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
20136 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
20137         CResult_BigSizeDecodeErrorZ {
20138                 contents: CResult_BigSizeDecodeErrorZPtr {
20139                         err: Box::into_raw(Box::new(e)),
20140                 },
20141                 result_ok: false,
20142         }
20143 }
20144 /// Checks if the given object is currently in the success state
20145 #[no_mangle]
20146 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
20147         o.result_ok
20148 }
20149 #[no_mangle]
20150 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
20151 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
20152 impl Drop for CResult_BigSizeDecodeErrorZ {
20153         fn drop(&mut self) {
20154                 if self.result_ok {
20155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20157                         }
20158                 } else {
20159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20161                         }
20162                 }
20163         }
20164 }
20165 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
20166         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
20167                 let contents = if o.result_ok {
20168                         let result = unsafe { o.contents.result };
20169                         unsafe { o.contents.result = core::ptr::null_mut() };
20170                         CResult_BigSizeDecodeErrorZPtr { result }
20171                 } else {
20172                         let err = unsafe { o.contents.err };
20173                         unsafe { o.contents.err = core::ptr::null_mut(); }
20174                         CResult_BigSizeDecodeErrorZPtr { err }
20175                 };
20176                 Self {
20177                         contents,
20178                         result_ok: o.result_ok,
20179                 }
20180         }
20181 }
20182 impl Clone for CResult_BigSizeDecodeErrorZ {
20183         fn clone(&self) -> Self {
20184                 if self.result_ok {
20185                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
20186                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
20187                         } }
20188                 } else {
20189                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
20190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20191                         } }
20192                 }
20193         }
20194 }
20195 #[no_mangle]
20196 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
20197 /// but with all dynamically-allocated buffers duplicated in new buffers.
20198 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
20199 #[repr(C)]
20200 /// The contents of CResult_HostnameDecodeErrorZ
20201 pub union CResult_HostnameDecodeErrorZPtr {
20202         /// A pointer to the contents in the success state.
20203         /// Reading from this pointer when `result_ok` is not set is undefined.
20204         pub result: *mut crate::lightning::util::ser::Hostname,
20205         /// A pointer to the contents in the error state.
20206         /// Reading from this pointer when `result_ok` is set is undefined.
20207         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20208 }
20209 #[repr(C)]
20210 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
20211 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
20212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20213 pub struct CResult_HostnameDecodeErrorZ {
20214         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
20215         /// `err` or `result` depending on the state of `result_ok`.
20216         pub contents: CResult_HostnameDecodeErrorZPtr,
20217         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
20218         pub result_ok: bool,
20219 }
20220 #[no_mangle]
20221 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
20222 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
20223         CResult_HostnameDecodeErrorZ {
20224                 contents: CResult_HostnameDecodeErrorZPtr {
20225                         result: Box::into_raw(Box::new(o)),
20226                 },
20227                 result_ok: true,
20228         }
20229 }
20230 #[no_mangle]
20231 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
20232 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
20233         CResult_HostnameDecodeErrorZ {
20234                 contents: CResult_HostnameDecodeErrorZPtr {
20235                         err: Box::into_raw(Box::new(e)),
20236                 },
20237                 result_ok: false,
20238         }
20239 }
20240 /// Checks if the given object is currently in the success state
20241 #[no_mangle]
20242 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
20243         o.result_ok
20244 }
20245 #[no_mangle]
20246 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
20247 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
20248 impl Drop for CResult_HostnameDecodeErrorZ {
20249         fn drop(&mut self) {
20250                 if self.result_ok {
20251                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20252                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20253                         }
20254                 } else {
20255                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20256                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20257                         }
20258                 }
20259         }
20260 }
20261 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
20262         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
20263                 let contents = if o.result_ok {
20264                         let result = unsafe { o.contents.result };
20265                         unsafe { o.contents.result = core::ptr::null_mut() };
20266                         CResult_HostnameDecodeErrorZPtr { result }
20267                 } else {
20268                         let err = unsafe { o.contents.err };
20269                         unsafe { o.contents.err = core::ptr::null_mut(); }
20270                         CResult_HostnameDecodeErrorZPtr { err }
20271                 };
20272                 Self {
20273                         contents,
20274                         result_ok: o.result_ok,
20275                 }
20276         }
20277 }
20278 impl Clone for CResult_HostnameDecodeErrorZ {
20279         fn clone(&self) -> Self {
20280                 if self.result_ok {
20281                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
20282                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
20283                         } }
20284                 } else {
20285                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
20286                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20287                         } }
20288                 }
20289         }
20290 }
20291 #[no_mangle]
20292 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
20293 /// but with all dynamically-allocated buffers duplicated in new buffers.
20294 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
20295 #[repr(C)]
20296 /// The contents of CResult_TransactionU16LenLimitedNoneZ
20297 pub union CResult_TransactionU16LenLimitedNoneZPtr {
20298         /// A pointer to the contents in the success state.
20299         /// Reading from this pointer when `result_ok` is not set is undefined.
20300         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
20301         /// Note that this value is always NULL, as there are no contents in the Err variant
20302         pub err: *mut core::ffi::c_void,
20303 }
20304 #[repr(C)]
20305 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
20306 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
20307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20308 pub struct CResult_TransactionU16LenLimitedNoneZ {
20309         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
20310         /// `err` or `result` depending on the state of `result_ok`.
20311         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
20312         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
20313         pub result_ok: bool,
20314 }
20315 #[no_mangle]
20316 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
20317 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
20318         CResult_TransactionU16LenLimitedNoneZ {
20319                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
20320                         result: Box::into_raw(Box::new(o)),
20321                 },
20322                 result_ok: true,
20323         }
20324 }
20325 #[no_mangle]
20326 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
20327 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
20328         CResult_TransactionU16LenLimitedNoneZ {
20329                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
20330                         err: core::ptr::null_mut(),
20331                 },
20332                 result_ok: false,
20333         }
20334 }
20335 /// Checks if the given object is currently in the success state
20336 #[no_mangle]
20337 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
20338         o.result_ok
20339 }
20340 #[no_mangle]
20341 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
20342 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
20343 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
20344         fn drop(&mut self) {
20345                 if self.result_ok {
20346                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20347                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20348                         }
20349                 } else {
20350                 }
20351         }
20352 }
20353 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
20354         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
20355                 let contents = if o.result_ok {
20356                         let result = unsafe { o.contents.result };
20357                         unsafe { o.contents.result = core::ptr::null_mut() };
20358                         CResult_TransactionU16LenLimitedNoneZPtr { result }
20359                 } else {
20360                         let _ = unsafe { Box::from_raw(o.contents.err) };
20361                         o.contents.err = core::ptr::null_mut();
20362                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
20363                 };
20364                 Self {
20365                         contents,
20366                         result_ok: o.result_ok,
20367                 }
20368         }
20369 }
20370 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
20371         fn clone(&self) -> Self {
20372                 if self.result_ok {
20373                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
20374                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
20375                         } }
20376                 } else {
20377                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
20378                                 err: core::ptr::null_mut()
20379                         } }
20380                 }
20381         }
20382 }
20383 #[no_mangle]
20384 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
20385 /// but with all dynamically-allocated buffers duplicated in new buffers.
20386 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
20387 #[repr(C)]
20388 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
20389 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20390         /// A pointer to the contents in the success state.
20391         /// Reading from this pointer when `result_ok` is not set is undefined.
20392         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
20393         /// A pointer to the contents in the error state.
20394         /// Reading from this pointer when `result_ok` is set is undefined.
20395         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20396 }
20397 #[repr(C)]
20398 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
20399 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
20400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20401 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
20402         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
20403         /// `err` or `result` depending on the state of `result_ok`.
20404         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
20405         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
20406         pub result_ok: bool,
20407 }
20408 #[no_mangle]
20409 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
20410 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
20411         CResult_TransactionU16LenLimitedDecodeErrorZ {
20412                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20413                         result: Box::into_raw(Box::new(o)),
20414                 },
20415                 result_ok: true,
20416         }
20417 }
20418 #[no_mangle]
20419 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
20420 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
20421         CResult_TransactionU16LenLimitedDecodeErrorZ {
20422                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20423                         err: Box::into_raw(Box::new(e)),
20424                 },
20425                 result_ok: false,
20426         }
20427 }
20428 /// Checks if the given object is currently in the success state
20429 #[no_mangle]
20430 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
20431         o.result_ok
20432 }
20433 #[no_mangle]
20434 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
20435 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
20436 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
20437         fn drop(&mut self) {
20438                 if self.result_ok {
20439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20441                         }
20442                 } else {
20443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20445                         }
20446                 }
20447         }
20448 }
20449 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
20450         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
20451                 let contents = if o.result_ok {
20452                         let result = unsafe { o.contents.result };
20453                         unsafe { o.contents.result = core::ptr::null_mut() };
20454                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
20455                 } else {
20456                         let err = unsafe { o.contents.err };
20457                         unsafe { o.contents.err = core::ptr::null_mut(); }
20458                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
20459                 };
20460                 Self {
20461                         contents,
20462                         result_ok: o.result_ok,
20463                 }
20464         }
20465 }
20466 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
20467         fn clone(&self) -> Self {
20468                 if self.result_ok {
20469                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20470                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
20471                         } }
20472                 } else {
20473                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20474                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20475                         } }
20476                 }
20477         }
20478 }
20479 #[no_mangle]
20480 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
20481 /// but with all dynamically-allocated buffers duplicated in new buffers.
20482 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
20483 #[repr(C)]
20484 /// The contents of CResult_UntrustedStringDecodeErrorZ
20485 pub union CResult_UntrustedStringDecodeErrorZPtr {
20486         /// A pointer to the contents in the success state.
20487         /// Reading from this pointer when `result_ok` is not set is undefined.
20488         pub result: *mut crate::lightning::util::string::UntrustedString,
20489         /// A pointer to the contents in the error state.
20490         /// Reading from this pointer when `result_ok` is set is undefined.
20491         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20492 }
20493 #[repr(C)]
20494 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
20495 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
20496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20497 pub struct CResult_UntrustedStringDecodeErrorZ {
20498         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
20499         /// `err` or `result` depending on the state of `result_ok`.
20500         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
20501         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
20502         pub result_ok: bool,
20503 }
20504 #[no_mangle]
20505 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
20506 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
20507         CResult_UntrustedStringDecodeErrorZ {
20508                 contents: CResult_UntrustedStringDecodeErrorZPtr {
20509                         result: Box::into_raw(Box::new(o)),
20510                 },
20511                 result_ok: true,
20512         }
20513 }
20514 #[no_mangle]
20515 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
20516 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
20517         CResult_UntrustedStringDecodeErrorZ {
20518                 contents: CResult_UntrustedStringDecodeErrorZPtr {
20519                         err: Box::into_raw(Box::new(e)),
20520                 },
20521                 result_ok: false,
20522         }
20523 }
20524 /// Checks if the given object is currently in the success state
20525 #[no_mangle]
20526 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
20527         o.result_ok
20528 }
20529 #[no_mangle]
20530 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
20531 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
20532 impl Drop for CResult_UntrustedStringDecodeErrorZ {
20533         fn drop(&mut self) {
20534                 if self.result_ok {
20535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20537                         }
20538                 } else {
20539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20541                         }
20542                 }
20543         }
20544 }
20545 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
20546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
20547                 let contents = if o.result_ok {
20548                         let result = unsafe { o.contents.result };
20549                         unsafe { o.contents.result = core::ptr::null_mut() };
20550                         CResult_UntrustedStringDecodeErrorZPtr { result }
20551                 } else {
20552                         let err = unsafe { o.contents.err };
20553                         unsafe { o.contents.err = core::ptr::null_mut(); }
20554                         CResult_UntrustedStringDecodeErrorZPtr { err }
20555                 };
20556                 Self {
20557                         contents,
20558                         result_ok: o.result_ok,
20559                 }
20560         }
20561 }
20562 impl Clone for CResult_UntrustedStringDecodeErrorZ {
20563         fn clone(&self) -> Self {
20564                 if self.result_ok {
20565                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
20566                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
20567                         } }
20568                 } else {
20569                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
20570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20571                         } }
20572                 }
20573         }
20574 }
20575 #[no_mangle]
20576 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
20577 /// but with all dynamically-allocated buffers duplicated in new buffers.
20578 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
20579 #[repr(C)]
20580 /// The contents of CResult_PaymentIdPaymentErrorZ
20581 pub union CResult_PaymentIdPaymentErrorZPtr {
20582         /// A pointer to the contents in the success state.
20583         /// Reading from this pointer when `result_ok` is not set is undefined.
20584         pub result: *mut crate::c_types::ThirtyTwoBytes,
20585         /// A pointer to the contents in the error state.
20586         /// Reading from this pointer when `result_ok` is set is undefined.
20587         pub err: *mut crate::lightning_invoice::payment::PaymentError,
20588 }
20589 #[repr(C)]
20590 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
20591 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
20592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20593 pub struct CResult_PaymentIdPaymentErrorZ {
20594         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
20595         /// `err` or `result` depending on the state of `result_ok`.
20596         pub contents: CResult_PaymentIdPaymentErrorZPtr,
20597         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
20598         pub result_ok: bool,
20599 }
20600 #[no_mangle]
20601 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
20602 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
20603         CResult_PaymentIdPaymentErrorZ {
20604                 contents: CResult_PaymentIdPaymentErrorZPtr {
20605                         result: Box::into_raw(Box::new(o)),
20606                 },
20607                 result_ok: true,
20608         }
20609 }
20610 #[no_mangle]
20611 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
20612 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
20613         CResult_PaymentIdPaymentErrorZ {
20614                 contents: CResult_PaymentIdPaymentErrorZPtr {
20615                         err: Box::into_raw(Box::new(e)),
20616                 },
20617                 result_ok: false,
20618         }
20619 }
20620 /// Checks if the given object is currently in the success state
20621 #[no_mangle]
20622 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
20623         o.result_ok
20624 }
20625 #[no_mangle]
20626 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
20627 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
20628 impl Drop for CResult_PaymentIdPaymentErrorZ {
20629         fn drop(&mut self) {
20630                 if self.result_ok {
20631                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20632                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20633                         }
20634                 } else {
20635                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20636                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20637                         }
20638                 }
20639         }
20640 }
20641 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
20642         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
20643                 let contents = if o.result_ok {
20644                         let result = unsafe { o.contents.result };
20645                         unsafe { o.contents.result = core::ptr::null_mut() };
20646                         CResult_PaymentIdPaymentErrorZPtr { result }
20647                 } else {
20648                         let err = unsafe { o.contents.err };
20649                         unsafe { o.contents.err = core::ptr::null_mut(); }
20650                         CResult_PaymentIdPaymentErrorZPtr { err }
20651                 };
20652                 Self {
20653                         contents,
20654                         result_ok: o.result_ok,
20655                 }
20656         }
20657 }
20658 impl Clone for CResult_PaymentIdPaymentErrorZ {
20659         fn clone(&self) -> Self {
20660                 if self.result_ok {
20661                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
20662                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
20663                         } }
20664                 } else {
20665                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
20666                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
20667                         } }
20668                 }
20669         }
20670 }
20671 #[no_mangle]
20672 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
20673 /// but with all dynamically-allocated buffers duplicated in new buffers.
20674 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
20675 #[repr(C)]
20676 /// The contents of CResult_NonePaymentErrorZ
20677 pub union CResult_NonePaymentErrorZPtr {
20678         /// Note that this value is always NULL, as there are no contents in the OK variant
20679         pub result: *mut core::ffi::c_void,
20680         /// A pointer to the contents in the error state.
20681         /// Reading from this pointer when `result_ok` is set is undefined.
20682         pub err: *mut crate::lightning_invoice::payment::PaymentError,
20683 }
20684 #[repr(C)]
20685 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
20686 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
20687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20688 pub struct CResult_NonePaymentErrorZ {
20689         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
20690         /// `err` or `result` depending on the state of `result_ok`.
20691         pub contents: CResult_NonePaymentErrorZPtr,
20692         /// Whether this CResult_NonePaymentErrorZ represents a success state.
20693         pub result_ok: bool,
20694 }
20695 #[no_mangle]
20696 /// Creates a new CResult_NonePaymentErrorZ in the success state.
20697 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
20698         CResult_NonePaymentErrorZ {
20699                 contents: CResult_NonePaymentErrorZPtr {
20700                         result: core::ptr::null_mut(),
20701                 },
20702                 result_ok: true,
20703         }
20704 }
20705 #[no_mangle]
20706 /// Creates a new CResult_NonePaymentErrorZ in the error state.
20707 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
20708         CResult_NonePaymentErrorZ {
20709                 contents: CResult_NonePaymentErrorZPtr {
20710                         err: Box::into_raw(Box::new(e)),
20711                 },
20712                 result_ok: false,
20713         }
20714 }
20715 /// Checks if the given object is currently in the success state
20716 #[no_mangle]
20717 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
20718         o.result_ok
20719 }
20720 #[no_mangle]
20721 /// Frees any resources used by the CResult_NonePaymentErrorZ.
20722 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
20723 impl Drop for CResult_NonePaymentErrorZ {
20724         fn drop(&mut self) {
20725                 if self.result_ok {
20726                 } else {
20727                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20728                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20729                         }
20730                 }
20731         }
20732 }
20733 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
20734         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
20735                 let contents = if o.result_ok {
20736                         let _ = unsafe { Box::from_raw(o.contents.result) };
20737                         o.contents.result = core::ptr::null_mut();
20738                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
20739                 } else {
20740                         let err = unsafe { o.contents.err };
20741                         unsafe { o.contents.err = core::ptr::null_mut(); }
20742                         CResult_NonePaymentErrorZPtr { err }
20743                 };
20744                 Self {
20745                         contents,
20746                         result_ok: o.result_ok,
20747                 }
20748         }
20749 }
20750 impl Clone for CResult_NonePaymentErrorZ {
20751         fn clone(&self) -> Self {
20752                 if self.result_ok {
20753                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
20754                                 result: core::ptr::null_mut()
20755                         } }
20756                 } else {
20757                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
20758                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
20759                         } }
20760                 }
20761         }
20762 }
20763 #[no_mangle]
20764 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
20765 /// but with all dynamically-allocated buffers duplicated in new buffers.
20766 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
20767 #[repr(C)]
20768 /// The contents of CResult_StringErrorZ
20769 pub union CResult_StringErrorZPtr {
20770         /// A pointer to the contents in the success state.
20771         /// Reading from this pointer when `result_ok` is not set is undefined.
20772         pub result: *mut crate::c_types::Str,
20773         /// A pointer to the contents in the error state.
20774         /// Reading from this pointer when `result_ok` is set is undefined.
20775         pub err: *mut crate::c_types::Secp256k1Error,
20776 }
20777 #[repr(C)]
20778 /// A CResult_StringErrorZ represents the result of a fallible operation,
20779 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
20780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20781 pub struct CResult_StringErrorZ {
20782         /// The contents of this CResult_StringErrorZ, accessible via either
20783         /// `err` or `result` depending on the state of `result_ok`.
20784         pub contents: CResult_StringErrorZPtr,
20785         /// Whether this CResult_StringErrorZ represents a success state.
20786         pub result_ok: bool,
20787 }
20788 #[no_mangle]
20789 /// Creates a new CResult_StringErrorZ in the success state.
20790 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
20791         CResult_StringErrorZ {
20792                 contents: CResult_StringErrorZPtr {
20793                         result: Box::into_raw(Box::new(o)),
20794                 },
20795                 result_ok: true,
20796         }
20797 }
20798 #[no_mangle]
20799 /// Creates a new CResult_StringErrorZ in the error state.
20800 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
20801         CResult_StringErrorZ {
20802                 contents: CResult_StringErrorZPtr {
20803                         err: Box::into_raw(Box::new(e)),
20804                 },
20805                 result_ok: false,
20806         }
20807 }
20808 /// Checks if the given object is currently in the success state
20809 #[no_mangle]
20810 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
20811         o.result_ok
20812 }
20813 #[no_mangle]
20814 /// Frees any resources used by the CResult_StringErrorZ.
20815 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
20816 impl Drop for CResult_StringErrorZ {
20817         fn drop(&mut self) {
20818                 if self.result_ok {
20819                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20820                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20821                         }
20822                 } else {
20823                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20824                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20825                         }
20826                 }
20827         }
20828 }
20829 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
20830         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
20831                 let contents = if o.result_ok {
20832                         let result = unsafe { o.contents.result };
20833                         unsafe { o.contents.result = core::ptr::null_mut() };
20834                         CResult_StringErrorZPtr { result }
20835                 } else {
20836                         let err = unsafe { o.contents.err };
20837                         unsafe { o.contents.err = core::ptr::null_mut(); }
20838                         CResult_StringErrorZPtr { err }
20839                 };
20840                 Self {
20841                         contents,
20842                         result_ok: o.result_ok,
20843                 }
20844         }
20845 }
20846 impl Clone for CResult_StringErrorZ {
20847         fn clone(&self) -> Self {
20848                 if self.result_ok {
20849                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
20850                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
20851                         } }
20852                 } else {
20853                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
20854                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20855                         } }
20856                 }
20857         }
20858 }
20859 #[no_mangle]
20860 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
20861 /// but with all dynamically-allocated buffers duplicated in new buffers.
20862 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
20863 #[repr(C)]
20864 /// The contents of CResult_TxOutUtxoLookupErrorZ
20865 pub union CResult_TxOutUtxoLookupErrorZPtr {
20866         /// A pointer to the contents in the success state.
20867         /// Reading from this pointer when `result_ok` is not set is undefined.
20868         pub result: *mut crate::c_types::TxOut,
20869         /// A pointer to the contents in the error state.
20870         /// Reading from this pointer when `result_ok` is set is undefined.
20871         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
20872 }
20873 #[repr(C)]
20874 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
20875 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
20876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20877 pub struct CResult_TxOutUtxoLookupErrorZ {
20878         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
20879         /// `err` or `result` depending on the state of `result_ok`.
20880         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
20881         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
20882         pub result_ok: bool,
20883 }
20884 #[no_mangle]
20885 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
20886 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
20887         CResult_TxOutUtxoLookupErrorZ {
20888                 contents: CResult_TxOutUtxoLookupErrorZPtr {
20889                         result: Box::into_raw(Box::new(o)),
20890                 },
20891                 result_ok: true,
20892         }
20893 }
20894 #[no_mangle]
20895 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
20896 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
20897         CResult_TxOutUtxoLookupErrorZ {
20898                 contents: CResult_TxOutUtxoLookupErrorZPtr {
20899                         err: Box::into_raw(Box::new(e)),
20900                 },
20901                 result_ok: false,
20902         }
20903 }
20904 /// Checks if the given object is currently in the success state
20905 #[no_mangle]
20906 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
20907         o.result_ok
20908 }
20909 #[no_mangle]
20910 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
20911 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
20912 impl Drop for CResult_TxOutUtxoLookupErrorZ {
20913         fn drop(&mut self) {
20914                 if self.result_ok {
20915                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20916                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20917                         }
20918                 } else {
20919                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20920                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20921                         }
20922                 }
20923         }
20924 }
20925 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
20926         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
20927                 let contents = if o.result_ok {
20928                         let result = unsafe { o.contents.result };
20929                         unsafe { o.contents.result = core::ptr::null_mut() };
20930                         CResult_TxOutUtxoLookupErrorZPtr { result }
20931                 } else {
20932                         let err = unsafe { o.contents.err };
20933                         unsafe { o.contents.err = core::ptr::null_mut(); }
20934                         CResult_TxOutUtxoLookupErrorZPtr { err }
20935                 };
20936                 Self {
20937                         contents,
20938                         result_ok: o.result_ok,
20939                 }
20940         }
20941 }
20942 impl Clone for CResult_TxOutUtxoLookupErrorZ {
20943         fn clone(&self) -> Self {
20944                 if self.result_ok {
20945                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
20946                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
20947                         } }
20948                 } else {
20949                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
20950                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
20951                         } }
20952                 }
20953         }
20954 }
20955 #[no_mangle]
20956 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
20957 /// but with all dynamically-allocated buffers duplicated in new buffers.
20958 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
20959 #[repr(C)]
20960 /// The contents of CResult_OnionMessagePathNoneZ
20961 pub union CResult_OnionMessagePathNoneZPtr {
20962         /// A pointer to the contents in the success state.
20963         /// Reading from this pointer when `result_ok` is not set is undefined.
20964         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
20965         /// Note that this value is always NULL, as there are no contents in the Err variant
20966         pub err: *mut core::ffi::c_void,
20967 }
20968 #[repr(C)]
20969 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
20970 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
20971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20972 pub struct CResult_OnionMessagePathNoneZ {
20973         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
20974         /// `err` or `result` depending on the state of `result_ok`.
20975         pub contents: CResult_OnionMessagePathNoneZPtr,
20976         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
20977         pub result_ok: bool,
20978 }
20979 #[no_mangle]
20980 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
20981 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
20982         CResult_OnionMessagePathNoneZ {
20983                 contents: CResult_OnionMessagePathNoneZPtr {
20984                         result: Box::into_raw(Box::new(o)),
20985                 },
20986                 result_ok: true,
20987         }
20988 }
20989 #[no_mangle]
20990 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
20991 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
20992         CResult_OnionMessagePathNoneZ {
20993                 contents: CResult_OnionMessagePathNoneZPtr {
20994                         err: core::ptr::null_mut(),
20995                 },
20996                 result_ok: false,
20997         }
20998 }
20999 /// Checks if the given object is currently in the success state
21000 #[no_mangle]
21001 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
21002         o.result_ok
21003 }
21004 #[no_mangle]
21005 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
21006 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
21007 impl Drop for CResult_OnionMessagePathNoneZ {
21008         fn drop(&mut self) {
21009                 if self.result_ok {
21010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21012                         }
21013                 } else {
21014                 }
21015         }
21016 }
21017 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
21018         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
21019                 let contents = if o.result_ok {
21020                         let result = unsafe { o.contents.result };
21021                         unsafe { o.contents.result = core::ptr::null_mut() };
21022                         CResult_OnionMessagePathNoneZPtr { result }
21023                 } else {
21024                         let _ = unsafe { Box::from_raw(o.contents.err) };
21025                         o.contents.err = core::ptr::null_mut();
21026                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
21027                 };
21028                 Self {
21029                         contents,
21030                         result_ok: o.result_ok,
21031                 }
21032         }
21033 }
21034 impl Clone for CResult_OnionMessagePathNoneZ {
21035         fn clone(&self) -> Self {
21036                 if self.result_ok {
21037                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
21038                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
21039                         } }
21040                 } else {
21041                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
21042                                 err: core::ptr::null_mut()
21043                         } }
21044                 }
21045         }
21046 }
21047 #[no_mangle]
21048 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
21049 /// but with all dynamically-allocated buffers duplicated in new buffers.
21050 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
21051 #[repr(C)]
21052 /// The contents of CResult_NoneSendErrorZ
21053 pub union CResult_NoneSendErrorZPtr {
21054         /// Note that this value is always NULL, as there are no contents in the OK variant
21055         pub result: *mut core::ffi::c_void,
21056         /// A pointer to the contents in the error state.
21057         /// Reading from this pointer when `result_ok` is set is undefined.
21058         pub err: *mut crate::lightning::onion_message::messenger::SendError,
21059 }
21060 #[repr(C)]
21061 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
21062 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
21063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21064 pub struct CResult_NoneSendErrorZ {
21065         /// The contents of this CResult_NoneSendErrorZ, accessible via either
21066         /// `err` or `result` depending on the state of `result_ok`.
21067         pub contents: CResult_NoneSendErrorZPtr,
21068         /// Whether this CResult_NoneSendErrorZ represents a success state.
21069         pub result_ok: bool,
21070 }
21071 #[no_mangle]
21072 /// Creates a new CResult_NoneSendErrorZ in the success state.
21073 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
21074         CResult_NoneSendErrorZ {
21075                 contents: CResult_NoneSendErrorZPtr {
21076                         result: core::ptr::null_mut(),
21077                 },
21078                 result_ok: true,
21079         }
21080 }
21081 #[no_mangle]
21082 /// Creates a new CResult_NoneSendErrorZ in the error state.
21083 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
21084         CResult_NoneSendErrorZ {
21085                 contents: CResult_NoneSendErrorZPtr {
21086                         err: Box::into_raw(Box::new(e)),
21087                 },
21088                 result_ok: false,
21089         }
21090 }
21091 /// Checks if the given object is currently in the success state
21092 #[no_mangle]
21093 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
21094         o.result_ok
21095 }
21096 #[no_mangle]
21097 /// Frees any resources used by the CResult_NoneSendErrorZ.
21098 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
21099 impl Drop for CResult_NoneSendErrorZ {
21100         fn drop(&mut self) {
21101                 if self.result_ok {
21102                 } else {
21103                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21104                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21105                         }
21106                 }
21107         }
21108 }
21109 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
21110         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
21111                 let contents = if o.result_ok {
21112                         let _ = unsafe { Box::from_raw(o.contents.result) };
21113                         o.contents.result = core::ptr::null_mut();
21114                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
21115                 } else {
21116                         let err = unsafe { o.contents.err };
21117                         unsafe { o.contents.err = core::ptr::null_mut(); }
21118                         CResult_NoneSendErrorZPtr { err }
21119                 };
21120                 Self {
21121                         contents,
21122                         result_ok: o.result_ok,
21123                 }
21124         }
21125 }
21126 #[repr(C)]
21127 /// The contents of CResult_BlindedPathNoneZ
21128 pub union CResult_BlindedPathNoneZPtr {
21129         /// A pointer to the contents in the success state.
21130         /// Reading from this pointer when `result_ok` is not set is undefined.
21131         pub result: *mut crate::lightning::blinded_path::BlindedPath,
21132         /// Note that this value is always NULL, as there are no contents in the Err variant
21133         pub err: *mut core::ffi::c_void,
21134 }
21135 #[repr(C)]
21136 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
21137 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
21138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21139 pub struct CResult_BlindedPathNoneZ {
21140         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
21141         /// `err` or `result` depending on the state of `result_ok`.
21142         pub contents: CResult_BlindedPathNoneZPtr,
21143         /// Whether this CResult_BlindedPathNoneZ represents a success state.
21144         pub result_ok: bool,
21145 }
21146 #[no_mangle]
21147 /// Creates a new CResult_BlindedPathNoneZ in the success state.
21148 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
21149         CResult_BlindedPathNoneZ {
21150                 contents: CResult_BlindedPathNoneZPtr {
21151                         result: Box::into_raw(Box::new(o)),
21152                 },
21153                 result_ok: true,
21154         }
21155 }
21156 #[no_mangle]
21157 /// Creates a new CResult_BlindedPathNoneZ in the error state.
21158 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
21159         CResult_BlindedPathNoneZ {
21160                 contents: CResult_BlindedPathNoneZPtr {
21161                         err: core::ptr::null_mut(),
21162                 },
21163                 result_ok: false,
21164         }
21165 }
21166 /// Checks if the given object is currently in the success state
21167 #[no_mangle]
21168 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
21169         o.result_ok
21170 }
21171 #[no_mangle]
21172 /// Frees any resources used by the CResult_BlindedPathNoneZ.
21173 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
21174 impl Drop for CResult_BlindedPathNoneZ {
21175         fn drop(&mut self) {
21176                 if self.result_ok {
21177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21179                         }
21180                 } else {
21181                 }
21182         }
21183 }
21184 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
21185         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
21186                 let contents = if o.result_ok {
21187                         let result = unsafe { o.contents.result };
21188                         unsafe { o.contents.result = core::ptr::null_mut() };
21189                         CResult_BlindedPathNoneZPtr { result }
21190                 } else {
21191                         let _ = unsafe { Box::from_raw(o.contents.err) };
21192                         o.contents.err = core::ptr::null_mut();
21193                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
21194                 };
21195                 Self {
21196                         contents,
21197                         result_ok: o.result_ok,
21198                 }
21199         }
21200 }
21201 impl Clone for CResult_BlindedPathNoneZ {
21202         fn clone(&self) -> Self {
21203                 if self.result_ok {
21204                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
21205                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
21206                         } }
21207                 } else {
21208                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
21209                                 err: core::ptr::null_mut()
21210                         } }
21211                 }
21212         }
21213 }
21214 #[no_mangle]
21215 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
21216 /// but with all dynamically-allocated buffers duplicated in new buffers.
21217 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
21218 #[repr(C)]
21219 /// The contents of CResult_BlindedPathDecodeErrorZ
21220 pub union CResult_BlindedPathDecodeErrorZPtr {
21221         /// A pointer to the contents in the success state.
21222         /// Reading from this pointer when `result_ok` is not set is undefined.
21223         pub result: *mut crate::lightning::blinded_path::BlindedPath,
21224         /// A pointer to the contents in the error state.
21225         /// Reading from this pointer when `result_ok` is set is undefined.
21226         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21227 }
21228 #[repr(C)]
21229 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
21230 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
21231 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21232 pub struct CResult_BlindedPathDecodeErrorZ {
21233         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
21234         /// `err` or `result` depending on the state of `result_ok`.
21235         pub contents: CResult_BlindedPathDecodeErrorZPtr,
21236         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
21237         pub result_ok: bool,
21238 }
21239 #[no_mangle]
21240 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
21241 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
21242         CResult_BlindedPathDecodeErrorZ {
21243                 contents: CResult_BlindedPathDecodeErrorZPtr {
21244                         result: Box::into_raw(Box::new(o)),
21245                 },
21246                 result_ok: true,
21247         }
21248 }
21249 #[no_mangle]
21250 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
21251 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
21252         CResult_BlindedPathDecodeErrorZ {
21253                 contents: CResult_BlindedPathDecodeErrorZPtr {
21254                         err: Box::into_raw(Box::new(e)),
21255                 },
21256                 result_ok: false,
21257         }
21258 }
21259 /// Checks if the given object is currently in the success state
21260 #[no_mangle]
21261 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
21262         o.result_ok
21263 }
21264 #[no_mangle]
21265 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
21266 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
21267 impl Drop for CResult_BlindedPathDecodeErrorZ {
21268         fn drop(&mut self) {
21269                 if self.result_ok {
21270                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21271                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21272                         }
21273                 } else {
21274                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21275                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21276                         }
21277                 }
21278         }
21279 }
21280 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
21281         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
21282                 let contents = if o.result_ok {
21283                         let result = unsafe { o.contents.result };
21284                         unsafe { o.contents.result = core::ptr::null_mut() };
21285                         CResult_BlindedPathDecodeErrorZPtr { result }
21286                 } else {
21287                         let err = unsafe { o.contents.err };
21288                         unsafe { o.contents.err = core::ptr::null_mut(); }
21289                         CResult_BlindedPathDecodeErrorZPtr { err }
21290                 };
21291                 Self {
21292                         contents,
21293                         result_ok: o.result_ok,
21294                 }
21295         }
21296 }
21297 impl Clone for CResult_BlindedPathDecodeErrorZ {
21298         fn clone(&self) -> Self {
21299                 if self.result_ok {
21300                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
21301                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
21302                         } }
21303                 } else {
21304                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
21305                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21306                         } }
21307                 }
21308         }
21309 }
21310 #[no_mangle]
21311 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
21312 /// but with all dynamically-allocated buffers duplicated in new buffers.
21313 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
21314 #[repr(C)]
21315 /// The contents of CResult_BlindedHopDecodeErrorZ
21316 pub union CResult_BlindedHopDecodeErrorZPtr {
21317         /// A pointer to the contents in the success state.
21318         /// Reading from this pointer when `result_ok` is not set is undefined.
21319         pub result: *mut crate::lightning::blinded_path::BlindedHop,
21320         /// A pointer to the contents in the error state.
21321         /// Reading from this pointer when `result_ok` is set is undefined.
21322         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21323 }
21324 #[repr(C)]
21325 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
21326 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
21327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21328 pub struct CResult_BlindedHopDecodeErrorZ {
21329         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
21330         /// `err` or `result` depending on the state of `result_ok`.
21331         pub contents: CResult_BlindedHopDecodeErrorZPtr,
21332         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
21333         pub result_ok: bool,
21334 }
21335 #[no_mangle]
21336 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
21337 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
21338         CResult_BlindedHopDecodeErrorZ {
21339                 contents: CResult_BlindedHopDecodeErrorZPtr {
21340                         result: Box::into_raw(Box::new(o)),
21341                 },
21342                 result_ok: true,
21343         }
21344 }
21345 #[no_mangle]
21346 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
21347 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
21348         CResult_BlindedHopDecodeErrorZ {
21349                 contents: CResult_BlindedHopDecodeErrorZPtr {
21350                         err: Box::into_raw(Box::new(e)),
21351                 },
21352                 result_ok: false,
21353         }
21354 }
21355 /// Checks if the given object is currently in the success state
21356 #[no_mangle]
21357 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
21358         o.result_ok
21359 }
21360 #[no_mangle]
21361 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
21362 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
21363 impl Drop for CResult_BlindedHopDecodeErrorZ {
21364         fn drop(&mut self) {
21365                 if self.result_ok {
21366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21368                         }
21369                 } else {
21370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21372                         }
21373                 }
21374         }
21375 }
21376 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
21377         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
21378                 let contents = if o.result_ok {
21379                         let result = unsafe { o.contents.result };
21380                         unsafe { o.contents.result = core::ptr::null_mut() };
21381                         CResult_BlindedHopDecodeErrorZPtr { result }
21382                 } else {
21383                         let err = unsafe { o.contents.err };
21384                         unsafe { o.contents.err = core::ptr::null_mut(); }
21385                         CResult_BlindedHopDecodeErrorZPtr { err }
21386                 };
21387                 Self {
21388                         contents,
21389                         result_ok: o.result_ok,
21390                 }
21391         }
21392 }
21393 impl Clone for CResult_BlindedHopDecodeErrorZ {
21394         fn clone(&self) -> Self {
21395                 if self.result_ok {
21396                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
21397                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
21398                         } }
21399                 } else {
21400                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
21401                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21402                         } }
21403                 }
21404         }
21405 }
21406 #[no_mangle]
21407 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
21408 /// but with all dynamically-allocated buffers duplicated in new buffers.
21409 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
21410 #[repr(C)]
21411 /// The contents of CResult_InvoiceErrorDecodeErrorZ
21412 pub union CResult_InvoiceErrorDecodeErrorZPtr {
21413         /// A pointer to the contents in the success state.
21414         /// Reading from this pointer when `result_ok` is not set is undefined.
21415         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
21416         /// A pointer to the contents in the error state.
21417         /// Reading from this pointer when `result_ok` is set is undefined.
21418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21419 }
21420 #[repr(C)]
21421 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
21422 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
21423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21424 pub struct CResult_InvoiceErrorDecodeErrorZ {
21425         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
21426         /// `err` or `result` depending on the state of `result_ok`.
21427         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
21428         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
21429         pub result_ok: bool,
21430 }
21431 #[no_mangle]
21432 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
21433 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
21434         CResult_InvoiceErrorDecodeErrorZ {
21435                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
21436                         result: Box::into_raw(Box::new(o)),
21437                 },
21438                 result_ok: true,
21439         }
21440 }
21441 #[no_mangle]
21442 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
21443 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
21444         CResult_InvoiceErrorDecodeErrorZ {
21445                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
21446                         err: Box::into_raw(Box::new(e)),
21447                 },
21448                 result_ok: false,
21449         }
21450 }
21451 /// Checks if the given object is currently in the success state
21452 #[no_mangle]
21453 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
21454         o.result_ok
21455 }
21456 #[no_mangle]
21457 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
21458 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
21459 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
21460         fn drop(&mut self) {
21461                 if self.result_ok {
21462                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21463                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21464                         }
21465                 } else {
21466                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21467                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21468                         }
21469                 }
21470         }
21471 }
21472 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
21473         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
21474                 let contents = if o.result_ok {
21475                         let result = unsafe { o.contents.result };
21476                         unsafe { o.contents.result = core::ptr::null_mut() };
21477                         CResult_InvoiceErrorDecodeErrorZPtr { result }
21478                 } else {
21479                         let err = unsafe { o.contents.err };
21480                         unsafe { o.contents.err = core::ptr::null_mut(); }
21481                         CResult_InvoiceErrorDecodeErrorZPtr { err }
21482                 };
21483                 Self {
21484                         contents,
21485                         result_ok: o.result_ok,
21486                 }
21487         }
21488 }
21489 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
21490         fn clone(&self) -> Self {
21491                 if self.result_ok {
21492                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
21493                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
21494                         } }
21495                 } else {
21496                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
21497                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21498                         } }
21499                 }
21500         }
21501 }
21502 #[no_mangle]
21503 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
21504 /// but with all dynamically-allocated buffers duplicated in new buffers.
21505 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
21506 #[repr(C)]
21507 /// An enum which can either contain a crate::lightning::chain::Filter or not
21508 pub enum COption_FilterZ {
21509         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
21510         Some(crate::lightning::chain::Filter),
21511         /// When we're in this state, this COption_FilterZ contains nothing
21512         None
21513 }
21514 impl COption_FilterZ {
21515         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21516                 if let Self::None = self { false } else { true }
21517         }
21518         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21519                 !self.is_some()
21520         }
21521         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
21522                 if let Self::Some(v) = self { v } else { unreachable!() }
21523         }
21524 }
21525 #[no_mangle]
21526 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
21527 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
21528         COption_FilterZ::Some(o)
21529 }
21530 #[no_mangle]
21531 /// Constructs a new COption_FilterZ containing nothing
21532 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
21533         COption_FilterZ::None
21534 }
21535 #[no_mangle]
21536 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
21537 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
21538 #[repr(C)]
21539 /// The contents of CResult_LockedChannelMonitorNoneZ
21540 pub union CResult_LockedChannelMonitorNoneZPtr {
21541         /// A pointer to the contents in the success state.
21542         /// Reading from this pointer when `result_ok` is not set is undefined.
21543         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
21544         /// Note that this value is always NULL, as there are no contents in the Err variant
21545         pub err: *mut core::ffi::c_void,
21546 }
21547 #[repr(C)]
21548 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
21549 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
21550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21551 pub struct CResult_LockedChannelMonitorNoneZ {
21552         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
21553         /// `err` or `result` depending on the state of `result_ok`.
21554         pub contents: CResult_LockedChannelMonitorNoneZPtr,
21555         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
21556         pub result_ok: bool,
21557 }
21558 #[no_mangle]
21559 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
21560 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
21561         CResult_LockedChannelMonitorNoneZ {
21562                 contents: CResult_LockedChannelMonitorNoneZPtr {
21563                         result: Box::into_raw(Box::new(o)),
21564                 },
21565                 result_ok: true,
21566         }
21567 }
21568 #[no_mangle]
21569 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
21570 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
21571         CResult_LockedChannelMonitorNoneZ {
21572                 contents: CResult_LockedChannelMonitorNoneZPtr {
21573                         err: core::ptr::null_mut(),
21574                 },
21575                 result_ok: false,
21576         }
21577 }
21578 /// Checks if the given object is currently in the success state
21579 #[no_mangle]
21580 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
21581         o.result_ok
21582 }
21583 #[no_mangle]
21584 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
21585 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
21586 impl Drop for CResult_LockedChannelMonitorNoneZ {
21587         fn drop(&mut self) {
21588                 if self.result_ok {
21589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21591                         }
21592                 } else {
21593                 }
21594         }
21595 }
21596 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
21597         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
21598                 let contents = if o.result_ok {
21599                         let result = unsafe { o.contents.result };
21600                         unsafe { o.contents.result = core::ptr::null_mut() };
21601                         CResult_LockedChannelMonitorNoneZPtr { result }
21602                 } else {
21603                         let _ = unsafe { Box::from_raw(o.contents.err) };
21604                         o.contents.err = core::ptr::null_mut();
21605                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
21606                 };
21607                 Self {
21608                         contents,
21609                         result_ok: o.result_ok,
21610                 }
21611         }
21612 }
21613 #[repr(C)]
21614 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
21615 /// This corresponds to std::vector in C++
21616 pub struct CVec_OutPointZ {
21617         /// The elements in the array.
21618         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21619         pub data: *mut crate::lightning::chain::transaction::OutPoint,
21620         /// The number of elements pointed to by `data`.
21621         pub datalen: usize
21622 }
21623 impl CVec_OutPointZ {
21624         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
21625                 if self.datalen == 0 { return Vec::new(); }
21626                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21627                 self.data = core::ptr::null_mut();
21628                 self.datalen = 0;
21629                 ret
21630         }
21631         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
21632                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21633         }
21634 }
21635 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
21636         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
21637                 let datalen = v.len();
21638                 let data = Box::into_raw(v.into_boxed_slice());
21639                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21640         }
21641 }
21642 #[no_mangle]
21643 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21644 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
21645 impl Drop for CVec_OutPointZ {
21646         fn drop(&mut self) {
21647                 if self.datalen == 0 { return; }
21648                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21649         }
21650 }
21651 impl Clone for CVec_OutPointZ {
21652         fn clone(&self) -> Self {
21653                 let mut res = Vec::new();
21654                 if self.datalen == 0 { return Self::from(res); }
21655                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21656                 Self::from(res)
21657         }
21658 }
21659 #[repr(C)]
21660 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
21661 /// This corresponds to std::vector in C++
21662 pub struct CVec_MonitorUpdateIdZ {
21663         /// The elements in the array.
21664         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21665         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
21666         /// The number of elements pointed to by `data`.
21667         pub datalen: usize
21668 }
21669 impl CVec_MonitorUpdateIdZ {
21670         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
21671                 if self.datalen == 0 { return Vec::new(); }
21672                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21673                 self.data = core::ptr::null_mut();
21674                 self.datalen = 0;
21675                 ret
21676         }
21677         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
21678                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21679         }
21680 }
21681 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
21682         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
21683                 let datalen = v.len();
21684                 let data = Box::into_raw(v.into_boxed_slice());
21685                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21686         }
21687 }
21688 #[no_mangle]
21689 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21690 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
21691 impl Drop for CVec_MonitorUpdateIdZ {
21692         fn drop(&mut self) {
21693                 if self.datalen == 0 { return; }
21694                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21695         }
21696 }
21697 impl Clone for CVec_MonitorUpdateIdZ {
21698         fn clone(&self) -> Self {
21699                 let mut res = Vec::new();
21700                 if self.datalen == 0 { return Self::from(res); }
21701                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21702                 Self::from(res)
21703         }
21704 }
21705 #[repr(C)]
21706 /// A tuple of 2 elements. See the individual fields for the types contained.
21707 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21708         /// The element at position 0
21709         pub a: crate::lightning::chain::transaction::OutPoint,
21710         /// The element at position 1
21711         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
21712 }
21713 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21714         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
21715                 Self {
21716                         a: tup.0,
21717                         b: tup.1,
21718                 }
21719         }
21720 }
21721 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21722         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
21723                 (self.a, self.b)
21724         }
21725 }
21726 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21727         fn clone(&self) -> Self {
21728                 Self {
21729                         a: Clone::clone(&self.a),
21730                         b: Clone::clone(&self.b),
21731                 }
21732         }
21733 }
21734 #[no_mangle]
21735 /// Creates a new tuple which has the same data as `orig`
21736 /// but with all dynamically-allocated buffers duplicated in new buffers.
21737 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
21738 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
21739 #[no_mangle]
21740 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21741         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
21742 }
21743
21744 #[no_mangle]
21745 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
21746 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
21747 #[repr(C)]
21748 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
21749 /// This corresponds to std::vector in C++
21750 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21751         /// The elements in the array.
21752         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21753         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
21754         /// The number of elements pointed to by `data`.
21755         pub datalen: usize
21756 }
21757 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21758         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
21759                 if self.datalen == 0 { return Vec::new(); }
21760                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21761                 self.data = core::ptr::null_mut();
21762                 self.datalen = 0;
21763                 ret
21764         }
21765         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
21766                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21767         }
21768 }
21769 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21770         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
21771                 let datalen = v.len();
21772                 let data = Box::into_raw(v.into_boxed_slice());
21773                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21774         }
21775 }
21776 #[no_mangle]
21777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21778 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
21779 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21780         fn drop(&mut self) {
21781                 if self.datalen == 0 { return; }
21782                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21783         }
21784 }
21785 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21786         fn clone(&self) -> Self {
21787                 let mut res = Vec::new();
21788                 if self.datalen == 0 { return Self::from(res); }
21789                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21790                 Self::from(res)
21791         }
21792 }