Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use alloc::string::String;
4 use core::ffi::c_void;
5 use core::convert::Infallible;
6 use bitcoin::hashes::Hash;
7 use crate::c_types::*;
8 #[cfg(feature="no-std")]
9 use alloc::{vec::Vec, boxed::Box};
10
11 #[repr(C)]
12 #[derive(Clone)]
13 /// An enum which can either contain a u64 or not
14 pub enum COption_u64Z {
15         /// When we're in this state, this COption_u64Z contains a u64
16         Some(u64),
17         /// When we're in this state, this COption_u64Z contains nothing
18         None
19 }
20 impl COption_u64Z {
21         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22                 if let Self::None = self { false } else { true }
23         }
24         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
25                 !self.is_some()
26         }
27         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
28                 if let Self::Some(v) = self { v } else { unreachable!() }
29         }
30 }
31 #[no_mangle]
32 /// Constructs a new COption_u64Z containing a u64
33 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
34         COption_u64Z::Some(o)
35 }
36 #[no_mangle]
37 /// Constructs a new COption_u64Z containing nothing
38 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
39         COption_u64Z::None
40 }
41 #[no_mangle]
42 /// Frees any resources associated with the u64, if we are in the Some state
43 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
44 #[no_mangle]
45 /// Creates a new COption_u64Z which has the same data as `orig`
46 /// but with all dynamically-allocated buffers duplicated in new buffers.
47 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
48 #[repr(C)]
49 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
50 /// This corresponds to std::vector in C++
51 pub struct CVec_BlindedPathZ {
52         /// The elements in the array.
53         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
54         pub data: *mut crate::lightning::blinded_path::BlindedPath,
55         /// The number of elements pointed to by `data`.
56         pub datalen: usize
57 }
58 impl CVec_BlindedPathZ {
59         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
60                 if self.datalen == 0 { return Vec::new(); }
61                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
62                 self.data = core::ptr::null_mut();
63                 self.datalen = 0;
64                 ret
65         }
66         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
67                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
68         }
69 }
70 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
71         fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
72                 let datalen = v.len();
73                 let data = Box::into_raw(v.into_boxed_slice());
74                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
75         }
76 }
77 #[no_mangle]
78 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
79 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
80 impl Drop for CVec_BlindedPathZ {
81         fn drop(&mut self) {
82                 if self.datalen == 0 { return; }
83                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
84         }
85 }
86 impl Clone for CVec_BlindedPathZ {
87         fn clone(&self) -> Self {
88                 let mut res = Vec::new();
89                 if self.datalen == 0 { return Self::from(res); }
90                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
91                 Self::from(res)
92         }
93 }
94 #[repr(C)]
95 /// The contents of CResult_RefundBolt12ParseErrorZ
96 pub union CResult_RefundBolt12ParseErrorZPtr {
97         /// A pointer to the contents in the success state.
98         /// Reading from this pointer when `result_ok` is not set is undefined.
99         pub result: *mut crate::lightning::offers::refund::Refund,
100         /// A pointer to the contents in the error state.
101         /// Reading from this pointer when `result_ok` is set is undefined.
102         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
103 }
104 #[repr(C)]
105 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
106 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
108 pub struct CResult_RefundBolt12ParseErrorZ {
109         /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
110         /// `err` or `result` depending on the state of `result_ok`.
111         pub contents: CResult_RefundBolt12ParseErrorZPtr,
112         /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
113         pub result_ok: bool,
114 }
115 #[no_mangle]
116 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
117 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
118         CResult_RefundBolt12ParseErrorZ {
119                 contents: CResult_RefundBolt12ParseErrorZPtr {
120                         result: Box::into_raw(Box::new(o)),
121                 },
122                 result_ok: true,
123         }
124 }
125 #[no_mangle]
126 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
127 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
128         CResult_RefundBolt12ParseErrorZ {
129                 contents: CResult_RefundBolt12ParseErrorZPtr {
130                         err: Box::into_raw(Box::new(e)),
131                 },
132                 result_ok: false,
133         }
134 }
135 /// Checks if the given object is currently in the success state
136 #[no_mangle]
137 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
138         o.result_ok
139 }
140 #[no_mangle]
141 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
142 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
143 impl Drop for CResult_RefundBolt12ParseErrorZ {
144         fn drop(&mut self) {
145                 if self.result_ok {
146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
148                         }
149                 } else {
150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
152                         }
153                 }
154         }
155 }
156 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
157         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
158                 let contents = if o.result_ok {
159                         let result = unsafe { o.contents.result };
160                         unsafe { o.contents.result = core::ptr::null_mut() };
161                         CResult_RefundBolt12ParseErrorZPtr { result }
162                 } else {
163                         let err = unsafe { o.contents.err };
164                         unsafe { o.contents.err = core::ptr::null_mut(); }
165                         CResult_RefundBolt12ParseErrorZPtr { err }
166                 };
167                 Self {
168                         contents,
169                         result_ok: o.result_ok,
170                 }
171         }
172 }
173 impl Clone for CResult_RefundBolt12ParseErrorZ {
174         fn clone(&self) -> Self {
175                 if self.result_ok {
176                         Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
177                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
178                         } }
179                 } else {
180                         Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
181                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
182                         } }
183                 }
184         }
185 }
186 #[no_mangle]
187 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
188 /// but with all dynamically-allocated buffers duplicated in new buffers.
189 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
190 #[repr(C)]
191 /// The contents of CResult_RetryDecodeErrorZ
192 pub union CResult_RetryDecodeErrorZPtr {
193         /// A pointer to the contents in the success state.
194         /// Reading from this pointer when `result_ok` is not set is undefined.
195         pub result: *mut crate::lightning::ln::outbound_payment::Retry,
196         /// A pointer to the contents in the error state.
197         /// Reading from this pointer when `result_ok` is set is undefined.
198         pub err: *mut crate::lightning::ln::msgs::DecodeError,
199 }
200 #[repr(C)]
201 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
202 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
204 pub struct CResult_RetryDecodeErrorZ {
205         /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
206         /// `err` or `result` depending on the state of `result_ok`.
207         pub contents: CResult_RetryDecodeErrorZPtr,
208         /// Whether this CResult_RetryDecodeErrorZ represents a success state.
209         pub result_ok: bool,
210 }
211 #[no_mangle]
212 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
213 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
214         CResult_RetryDecodeErrorZ {
215                 contents: CResult_RetryDecodeErrorZPtr {
216                         result: Box::into_raw(Box::new(o)),
217                 },
218                 result_ok: true,
219         }
220 }
221 #[no_mangle]
222 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
223 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
224         CResult_RetryDecodeErrorZ {
225                 contents: CResult_RetryDecodeErrorZPtr {
226                         err: Box::into_raw(Box::new(e)),
227                 },
228                 result_ok: false,
229         }
230 }
231 /// Checks if the given object is currently in the success state
232 #[no_mangle]
233 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
234         o.result_ok
235 }
236 #[no_mangle]
237 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
238 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
239 impl Drop for CResult_RetryDecodeErrorZ {
240         fn drop(&mut self) {
241                 if self.result_ok {
242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
244                         }
245                 } else {
246                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.err) };
248                         }
249                 }
250         }
251 }
252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
253         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
254                 let contents = if o.result_ok {
255                         let result = unsafe { o.contents.result };
256                         unsafe { o.contents.result = core::ptr::null_mut() };
257                         CResult_RetryDecodeErrorZPtr { result }
258                 } else {
259                         let err = unsafe { o.contents.err };
260                         unsafe { o.contents.err = core::ptr::null_mut(); }
261                         CResult_RetryDecodeErrorZPtr { err }
262                 };
263                 Self {
264                         contents,
265                         result_ok: o.result_ok,
266                 }
267         }
268 }
269 impl Clone for CResult_RetryDecodeErrorZ {
270         fn clone(&self) -> Self {
271                 if self.result_ok {
272                         Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
273                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
274                         } }
275                 } else {
276                         Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
277                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
278                         } }
279                 }
280         }
281 }
282 #[no_mangle]
283 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
284 /// but with all dynamically-allocated buffers duplicated in new buffers.
285 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
286 #[repr(C)]
287 /// The contents of CResult_NoneAPIErrorZ
288 pub union CResult_NoneAPIErrorZPtr {
289         /// Note that this value is always NULL, as there are no contents in the OK variant
290         pub result: *mut core::ffi::c_void,
291         /// A pointer to the contents in the error state.
292         /// Reading from this pointer when `result_ok` is set is undefined.
293         pub err: *mut crate::lightning::util::errors::APIError,
294 }
295 #[repr(C)]
296 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
297 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
299 pub struct CResult_NoneAPIErrorZ {
300         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
301         /// `err` or `result` depending on the state of `result_ok`.
302         pub contents: CResult_NoneAPIErrorZPtr,
303         /// Whether this CResult_NoneAPIErrorZ represents a success state.
304         pub result_ok: bool,
305 }
306 #[no_mangle]
307 /// Creates a new CResult_NoneAPIErrorZ in the success state.
308 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
309         CResult_NoneAPIErrorZ {
310                 contents: CResult_NoneAPIErrorZPtr {
311                         result: core::ptr::null_mut(),
312                 },
313                 result_ok: true,
314         }
315 }
316 #[no_mangle]
317 /// Creates a new CResult_NoneAPIErrorZ in the error state.
318 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
319         CResult_NoneAPIErrorZ {
320                 contents: CResult_NoneAPIErrorZPtr {
321                         err: Box::into_raw(Box::new(e)),
322                 },
323                 result_ok: false,
324         }
325 }
326 /// Checks if the given object is currently in the success state
327 #[no_mangle]
328 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
329         o.result_ok
330 }
331 #[no_mangle]
332 /// Frees any resources used by the CResult_NoneAPIErrorZ.
333 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
334 impl Drop for CResult_NoneAPIErrorZ {
335         fn drop(&mut self) {
336                 if self.result_ok {
337                 } else {
338                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
339                                 let _ = unsafe { Box::from_raw(self.contents.err) };
340                         }
341                 }
342         }
343 }
344 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
345         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
346                 let contents = if o.result_ok {
347                         let _ = unsafe { Box::from_raw(o.contents.result) };
348                         o.contents.result = core::ptr::null_mut();
349                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
350                 } else {
351                         let err = unsafe { o.contents.err };
352                         unsafe { o.contents.err = core::ptr::null_mut(); }
353                         CResult_NoneAPIErrorZPtr { err }
354                 };
355                 Self {
356                         contents,
357                         result_ok: o.result_ok,
358                 }
359         }
360 }
361 impl Clone for CResult_NoneAPIErrorZ {
362         fn clone(&self) -> Self {
363                 if self.result_ok {
364                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
365                                 result: core::ptr::null_mut()
366                         } }
367                 } else {
368                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
369                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
370                         } }
371                 }
372         }
373 }
374 #[no_mangle]
375 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
376 /// but with all dynamically-allocated buffers duplicated in new buffers.
377 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
378 #[repr(C)]
379 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
380 /// This corresponds to std::vector in C++
381 pub struct CVec_CResult_NoneAPIErrorZZ {
382         /// The elements in the array.
383         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
384         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
385         /// The number of elements pointed to by `data`.
386         pub datalen: usize
387 }
388 impl CVec_CResult_NoneAPIErrorZZ {
389         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
390                 if self.datalen == 0 { return Vec::new(); }
391                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
392                 self.data = core::ptr::null_mut();
393                 self.datalen = 0;
394                 ret
395         }
396         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
397                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
398         }
399 }
400 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
401         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
402                 let datalen = v.len();
403                 let data = Box::into_raw(v.into_boxed_slice());
404                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
405         }
406 }
407 #[no_mangle]
408 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
409 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
410 impl Drop for CVec_CResult_NoneAPIErrorZZ {
411         fn drop(&mut self) {
412                 if self.datalen == 0 { return; }
413                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
414         }
415 }
416 impl Clone for CVec_CResult_NoneAPIErrorZZ {
417         fn clone(&self) -> Self {
418                 let mut res = Vec::new();
419                 if self.datalen == 0 { return Self::from(res); }
420                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
421                 Self::from(res)
422         }
423 }
424 #[repr(C)]
425 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
426 /// This corresponds to std::vector in C++
427 pub struct CVec_APIErrorZ {
428         /// The elements in the array.
429         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
430         pub data: *mut crate::lightning::util::errors::APIError,
431         /// The number of elements pointed to by `data`.
432         pub datalen: usize
433 }
434 impl CVec_APIErrorZ {
435         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
436                 if self.datalen == 0 { return Vec::new(); }
437                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
438                 self.data = core::ptr::null_mut();
439                 self.datalen = 0;
440                 ret
441         }
442         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
443                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
444         }
445 }
446 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
447         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
448                 let datalen = v.len();
449                 let data = Box::into_raw(v.into_boxed_slice());
450                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
451         }
452 }
453 #[no_mangle]
454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
455 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
456 impl Drop for CVec_APIErrorZ {
457         fn drop(&mut self) {
458                 if self.datalen == 0 { return; }
459                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
460         }
461 }
462 impl Clone for CVec_APIErrorZ {
463         fn clone(&self) -> Self {
464                 let mut res = Vec::new();
465                 if self.datalen == 0 { return Self::from(res); }
466                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
467                 Self::from(res)
468         }
469 }
470 #[repr(C)]
471 #[derive(Clone)]
472 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
473 pub enum COption_ThirtyTwoBytesZ {
474         /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
475         Some(crate::c_types::ThirtyTwoBytes),
476         /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
477         None
478 }
479 impl COption_ThirtyTwoBytesZ {
480         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
481                 if let Self::None = self { false } else { true }
482         }
483         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
484                 !self.is_some()
485         }
486         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
487                 if let Self::Some(v) = self { v } else { unreachable!() }
488         }
489 }
490 #[no_mangle]
491 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
492 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
493         COption_ThirtyTwoBytesZ::Some(o)
494 }
495 #[no_mangle]
496 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
497 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
498         COption_ThirtyTwoBytesZ::None
499 }
500 #[no_mangle]
501 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
502 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
503 #[no_mangle]
504 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
505 /// but with all dynamically-allocated buffers duplicated in new buffers.
506 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
507 #[repr(C)]
508 /// A dynamically-allocated array of u8s of arbitrary size.
509 /// This corresponds to std::vector in C++
510 pub struct CVec_u8Z {
511         /// The elements in the array.
512         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
513         pub data: *mut u8,
514         /// The number of elements pointed to by `data`.
515         pub datalen: usize
516 }
517 impl CVec_u8Z {
518         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
519                 if self.datalen == 0 { return Vec::new(); }
520                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
521                 self.data = core::ptr::null_mut();
522                 self.datalen = 0;
523                 ret
524         }
525         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
526                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
527         }
528 }
529 impl From<Vec<u8>> for CVec_u8Z {
530         fn from(v: Vec<u8>) -> Self {
531                 let datalen = v.len();
532                 let data = Box::into_raw(v.into_boxed_slice());
533                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
534         }
535 }
536 #[no_mangle]
537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
538 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
539 impl Drop for CVec_u8Z {
540         fn drop(&mut self) {
541                 if self.datalen == 0 { return; }
542                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
543         }
544 }
545 impl Clone for CVec_u8Z {
546         fn clone(&self) -> Self {
547                 let mut res = Vec::new();
548                 if self.datalen == 0 { return Self::from(res); }
549                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
550                 Self::from(res)
551         }
552 }
553 #[repr(C)]
554 #[derive(Clone)]
555 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
556 pub enum COption_CVec_u8ZZ {
557         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
558         Some(crate::c_types::derived::CVec_u8Z),
559         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
560         None
561 }
562 impl COption_CVec_u8ZZ {
563         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
564                 if let Self::None = self { false } else { true }
565         }
566         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
567                 !self.is_some()
568         }
569         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
570                 if let Self::Some(v) = self { v } else { unreachable!() }
571         }
572 }
573 #[no_mangle]
574 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
575 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
576         COption_CVec_u8ZZ::Some(o)
577 }
578 #[no_mangle]
579 /// Constructs a new COption_CVec_u8ZZ containing nothing
580 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
581         COption_CVec_u8ZZ::None
582 }
583 #[no_mangle]
584 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
585 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
586 #[no_mangle]
587 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
588 /// but with all dynamically-allocated buffers duplicated in new buffers.
589 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
590 #[repr(C)]
591 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
592 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
593         /// A pointer to the contents in the success state.
594         /// Reading from this pointer when `result_ok` is not set is undefined.
595         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
596         /// A pointer to the contents in the error state.
597         /// Reading from this pointer when `result_ok` is set is undefined.
598         pub err: *mut crate::lightning::ln::msgs::DecodeError,
599 }
600 #[repr(C)]
601 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
602 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
604 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
605         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
606         /// `err` or `result` depending on the state of `result_ok`.
607         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
608         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
609         pub result_ok: bool,
610 }
611 #[no_mangle]
612 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
613 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
614         CResult_RecipientOnionFieldsDecodeErrorZ {
615                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
616                         result: Box::into_raw(Box::new(o)),
617                 },
618                 result_ok: true,
619         }
620 }
621 #[no_mangle]
622 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
623 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
624         CResult_RecipientOnionFieldsDecodeErrorZ {
625                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
626                         err: Box::into_raw(Box::new(e)),
627                 },
628                 result_ok: false,
629         }
630 }
631 /// Checks if the given object is currently in the success state
632 #[no_mangle]
633 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
634         o.result_ok
635 }
636 #[no_mangle]
637 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
638 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
639 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
640         fn drop(&mut self) {
641                 if self.result_ok {
642                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
643                                 let _ = unsafe { Box::from_raw(self.contents.result) };
644                         }
645                 } else {
646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
648                         }
649                 }
650         }
651 }
652 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
653         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
654                 let contents = if o.result_ok {
655                         let result = unsafe { o.contents.result };
656                         unsafe { o.contents.result = core::ptr::null_mut() };
657                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
658                 } else {
659                         let err = unsafe { o.contents.err };
660                         unsafe { o.contents.err = core::ptr::null_mut(); }
661                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
662                 };
663                 Self {
664                         contents,
665                         result_ok: o.result_ok,
666                 }
667         }
668 }
669 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
670         fn clone(&self) -> Self {
671                 if self.result_ok {
672                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
673                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
674                         } }
675                 } else {
676                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
677                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
678                         } }
679                 }
680         }
681 }
682 #[no_mangle]
683 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
684 /// but with all dynamically-allocated buffers duplicated in new buffers.
685 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
686 #[repr(C)]
687 /// A tuple of 2 elements. See the individual fields for the types contained.
688 pub struct C2Tuple_u64CVec_u8ZZ {
689         /// The element at position 0
690         pub a: u64,
691         /// The element at position 1
692         pub b: crate::c_types::derived::CVec_u8Z,
693 }
694 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
695         fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
696                 Self {
697                         a: tup.0,
698                         b: tup.1,
699                 }
700         }
701 }
702 impl C2Tuple_u64CVec_u8ZZ {
703         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
704                 (self.a, self.b)
705         }
706 }
707 impl Clone for C2Tuple_u64CVec_u8ZZ {
708         fn clone(&self) -> Self {
709                 Self {
710                         a: Clone::clone(&self.a),
711                         b: Clone::clone(&self.b),
712                 }
713         }
714 }
715 #[no_mangle]
716 /// Creates a new tuple which has the same data as `orig`
717 /// but with all dynamically-allocated buffers duplicated in new buffers.
718 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
719 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
720 #[no_mangle]
721 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
722         C2Tuple_u64CVec_u8ZZ { a, b, }
723 }
724
725 #[no_mangle]
726 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
727 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
728 #[repr(C)]
729 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
730 /// This corresponds to std::vector in C++
731 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
732         /// The elements in the array.
733         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
734         pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
735         /// The number of elements pointed to by `data`.
736         pub datalen: usize
737 }
738 impl CVec_C2Tuple_u64CVec_u8ZZZ {
739         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
740                 if self.datalen == 0 { return Vec::new(); }
741                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
742                 self.data = core::ptr::null_mut();
743                 self.datalen = 0;
744                 ret
745         }
746         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
747                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
748         }
749 }
750 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
751         fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
752                 let datalen = v.len();
753                 let data = Box::into_raw(v.into_boxed_slice());
754                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
755         }
756 }
757 #[no_mangle]
758 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
759 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
760 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
761         fn drop(&mut self) {
762                 if self.datalen == 0 { return; }
763                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
764         }
765 }
766 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
767         fn clone(&self) -> Self {
768                 let mut res = Vec::new();
769                 if self.datalen == 0 { return Self::from(res); }
770                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
771                 Self::from(res)
772         }
773 }
774 #[repr(C)]
775 /// The contents of CResult_RecipientOnionFieldsNoneZ
776 pub union CResult_RecipientOnionFieldsNoneZPtr {
777         /// A pointer to the contents in the success state.
778         /// Reading from this pointer when `result_ok` is not set is undefined.
779         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
780         /// Note that this value is always NULL, as there are no contents in the Err variant
781         pub err: *mut core::ffi::c_void,
782 }
783 #[repr(C)]
784 /// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
785 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
787 pub struct CResult_RecipientOnionFieldsNoneZ {
788         /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
789         /// `err` or `result` depending on the state of `result_ok`.
790         pub contents: CResult_RecipientOnionFieldsNoneZPtr,
791         /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
792         pub result_ok: bool,
793 }
794 #[no_mangle]
795 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
796 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
797         CResult_RecipientOnionFieldsNoneZ {
798                 contents: CResult_RecipientOnionFieldsNoneZPtr {
799                         result: Box::into_raw(Box::new(o)),
800                 },
801                 result_ok: true,
802         }
803 }
804 #[no_mangle]
805 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
806 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
807         CResult_RecipientOnionFieldsNoneZ {
808                 contents: CResult_RecipientOnionFieldsNoneZPtr {
809                         err: core::ptr::null_mut(),
810                 },
811                 result_ok: false,
812         }
813 }
814 /// Checks if the given object is currently in the success state
815 #[no_mangle]
816 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
817         o.result_ok
818 }
819 #[no_mangle]
820 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
821 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
822 impl Drop for CResult_RecipientOnionFieldsNoneZ {
823         fn drop(&mut self) {
824                 if self.result_ok {
825                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
826                                 let _ = unsafe { Box::from_raw(self.contents.result) };
827                         }
828                 } else {
829                 }
830         }
831 }
832 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
833         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> Self {
834                 let contents = if o.result_ok {
835                         let result = unsafe { o.contents.result };
836                         unsafe { o.contents.result = core::ptr::null_mut() };
837                         CResult_RecipientOnionFieldsNoneZPtr { result }
838                 } else {
839                         let _ = unsafe { Box::from_raw(o.contents.err) };
840                         o.contents.err = core::ptr::null_mut();
841                         CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
842                 };
843                 Self {
844                         contents,
845                         result_ok: o.result_ok,
846                 }
847         }
848 }
849 impl Clone for CResult_RecipientOnionFieldsNoneZ {
850         fn clone(&self) -> Self {
851                 if self.result_ok {
852                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
853                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
854                         } }
855                 } else {
856                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
857                                 err: core::ptr::null_mut()
858                         } }
859                 }
860         }
861 }
862 #[no_mangle]
863 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
864 /// but with all dynamically-allocated buffers duplicated in new buffers.
865 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
866 #[repr(C)]
867 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
868 /// This corresponds to std::vector in C++
869 pub struct CVec_ThirtyTwoBytesZ {
870         /// The elements in the array.
871         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
872         pub data: *mut crate::c_types::ThirtyTwoBytes,
873         /// The number of elements pointed to by `data`.
874         pub datalen: usize
875 }
876 impl CVec_ThirtyTwoBytesZ {
877         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
878                 if self.datalen == 0 { return Vec::new(); }
879                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
880                 self.data = core::ptr::null_mut();
881                 self.datalen = 0;
882                 ret
883         }
884         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
885                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
886         }
887 }
888 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
889         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
890                 let datalen = v.len();
891                 let data = Box::into_raw(v.into_boxed_slice());
892                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
893         }
894 }
895 #[no_mangle]
896 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
897 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
898 impl Drop for CVec_ThirtyTwoBytesZ {
899         fn drop(&mut self) {
900                 if self.datalen == 0 { return; }
901                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
902         }
903 }
904 impl Clone for CVec_ThirtyTwoBytesZ {
905         fn clone(&self) -> Self {
906                 let mut res = Vec::new();
907                 if self.datalen == 0 { return Self::from(res); }
908                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
909                 Self::from(res)
910         }
911 }
912 #[repr(C)]
913 #[derive(Clone)]
914 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
915 pub enum COption_CVec_ThirtyTwoBytesZZ {
916         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
917         Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
918         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
919         None
920 }
921 impl COption_CVec_ThirtyTwoBytesZZ {
922         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
923                 if let Self::None = self { false } else { true }
924         }
925         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
926                 !self.is_some()
927         }
928         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
929                 if let Self::Some(v) = self { v } else { unreachable!() }
930         }
931 }
932 #[no_mangle]
933 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
934 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
935         COption_CVec_ThirtyTwoBytesZZ::Some(o)
936 }
937 #[no_mangle]
938 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
939 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
940         COption_CVec_ThirtyTwoBytesZZ::None
941 }
942 #[no_mangle]
943 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
944 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
945 #[no_mangle]
946 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
947 /// but with all dynamically-allocated buffers duplicated in new buffers.
948 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
949 #[repr(C)]
950 /// The contents of CResult_ThirtyTwoBytesNoneZ
951 pub union CResult_ThirtyTwoBytesNoneZPtr {
952         /// A pointer to the contents in the success state.
953         /// Reading from this pointer when `result_ok` is not set is undefined.
954         pub result: *mut crate::c_types::ThirtyTwoBytes,
955         /// Note that this value is always NULL, as there are no contents in the Err variant
956         pub err: *mut core::ffi::c_void,
957 }
958 #[repr(C)]
959 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
960 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
962 pub struct CResult_ThirtyTwoBytesNoneZ {
963         /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
964         /// `err` or `result` depending on the state of `result_ok`.
965         pub contents: CResult_ThirtyTwoBytesNoneZPtr,
966         /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
967         pub result_ok: bool,
968 }
969 #[no_mangle]
970 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
971 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
972         CResult_ThirtyTwoBytesNoneZ {
973                 contents: CResult_ThirtyTwoBytesNoneZPtr {
974                         result: Box::into_raw(Box::new(o)),
975                 },
976                 result_ok: true,
977         }
978 }
979 #[no_mangle]
980 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
981 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
982         CResult_ThirtyTwoBytesNoneZ {
983                 contents: CResult_ThirtyTwoBytesNoneZPtr {
984                         err: core::ptr::null_mut(),
985                 },
986                 result_ok: false,
987         }
988 }
989 /// Checks if the given object is currently in the success state
990 #[no_mangle]
991 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
992         o.result_ok
993 }
994 #[no_mangle]
995 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
996 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
997 impl Drop for CResult_ThirtyTwoBytesNoneZ {
998         fn drop(&mut self) {
999                 if self.result_ok {
1000                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1001                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1002                         }
1003                 } else {
1004                 }
1005         }
1006 }
1007 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1008         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1009                 let contents = if o.result_ok {
1010                         let result = unsafe { o.contents.result };
1011                         unsafe { o.contents.result = core::ptr::null_mut() };
1012                         CResult_ThirtyTwoBytesNoneZPtr { result }
1013                 } else {
1014                         let _ = unsafe { Box::from_raw(o.contents.err) };
1015                         o.contents.err = core::ptr::null_mut();
1016                         CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1017                 };
1018                 Self {
1019                         contents,
1020                         result_ok: o.result_ok,
1021                 }
1022         }
1023 }
1024 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1025         fn clone(&self) -> Self {
1026                 if self.result_ok {
1027                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1028                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1029                         } }
1030                 } else {
1031                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1032                                 err: core::ptr::null_mut()
1033                         } }
1034                 }
1035         }
1036 }
1037 #[no_mangle]
1038 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1039 /// but with all dynamically-allocated buffers duplicated in new buffers.
1040 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1041 #[repr(C)]
1042 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1043 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1044         /// A pointer to the contents in the success state.
1045         /// Reading from this pointer when `result_ok` is not set is undefined.
1046         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1047         /// A pointer to the contents in the error state.
1048         /// Reading from this pointer when `result_ok` is set is undefined.
1049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1050 }
1051 #[repr(C)]
1052 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1053 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1055 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1056         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1057         /// `err` or `result` depending on the state of `result_ok`.
1058         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1059         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1060         pub result_ok: bool,
1061 }
1062 #[no_mangle]
1063 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1064 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1065         CResult_BlindedPayInfoDecodeErrorZ {
1066                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1067                         result: Box::into_raw(Box::new(o)),
1068                 },
1069                 result_ok: true,
1070         }
1071 }
1072 #[no_mangle]
1073 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1074 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1075         CResult_BlindedPayInfoDecodeErrorZ {
1076                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1077                         err: Box::into_raw(Box::new(e)),
1078                 },
1079                 result_ok: false,
1080         }
1081 }
1082 /// Checks if the given object is currently in the success state
1083 #[no_mangle]
1084 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1085         o.result_ok
1086 }
1087 #[no_mangle]
1088 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1089 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1090 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1091         fn drop(&mut self) {
1092                 if self.result_ok {
1093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1095                         }
1096                 } else {
1097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1099                         }
1100                 }
1101         }
1102 }
1103 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1105                 let contents = if o.result_ok {
1106                         let result = unsafe { o.contents.result };
1107                         unsafe { o.contents.result = core::ptr::null_mut() };
1108                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
1109                 } else {
1110                         let err = unsafe { o.contents.err };
1111                         unsafe { o.contents.err = core::ptr::null_mut(); }
1112                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
1113                 };
1114                 Self {
1115                         contents,
1116                         result_ok: o.result_ok,
1117                 }
1118         }
1119 }
1120 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1121         fn clone(&self) -> Self {
1122                 if self.result_ok {
1123                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1124                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1125                         } }
1126                 } else {
1127                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1129                         } }
1130                 }
1131         }
1132 }
1133 #[no_mangle]
1134 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1135 /// but with all dynamically-allocated buffers duplicated in new buffers.
1136 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1137 #[repr(C)]
1138 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1139 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1140         /// A pointer to the contents in the success state.
1141         /// Reading from this pointer when `result_ok` is not set is undefined.
1142         pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1143         /// A pointer to the contents in the error state.
1144         /// Reading from this pointer when `result_ok` is set is undefined.
1145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1146 }
1147 #[repr(C)]
1148 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1152         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1153         /// `err` or `result` depending on the state of `result_ok`.
1154         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1155         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1156         pub result_ok: bool,
1157 }
1158 #[no_mangle]
1159 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1160 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1161         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1162                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1163                         result: Box::into_raw(Box::new(o)),
1164                 },
1165                 result_ok: true,
1166         }
1167 }
1168 #[no_mangle]
1169 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1170 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1171         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1172                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1173                         err: Box::into_raw(Box::new(e)),
1174                 },
1175                 result_ok: false,
1176         }
1177 }
1178 /// Checks if the given object is currently in the success state
1179 #[no_mangle]
1180 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1181         o.result_ok
1182 }
1183 #[no_mangle]
1184 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1185 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1186 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1187         fn drop(&mut self) {
1188                 if self.result_ok {
1189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1191                         }
1192                 } else {
1193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1195                         }
1196                 }
1197         }
1198 }
1199 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1200         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1201                 let contents = if o.result_ok {
1202                         let result = unsafe { o.contents.result };
1203                         unsafe { o.contents.result = core::ptr::null_mut() };
1204                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1205                 } else {
1206                         let err = unsafe { o.contents.err };
1207                         unsafe { o.contents.err = core::ptr::null_mut(); }
1208                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1209                 };
1210                 Self {
1211                         contents,
1212                         result_ok: o.result_ok,
1213                 }
1214         }
1215 }
1216 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1217         fn clone(&self) -> Self {
1218                 if self.result_ok {
1219                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1220                                 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1221                         } }
1222                 } else {
1223                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1224                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1225                         } }
1226                 }
1227         }
1228 }
1229 #[no_mangle]
1230 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1231 /// but with all dynamically-allocated buffers duplicated in new buffers.
1232 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1233 #[repr(C)]
1234 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1235 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1236         /// A pointer to the contents in the success state.
1237         /// Reading from this pointer when `result_ok` is not set is undefined.
1238         pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1239         /// A pointer to the contents in the error state.
1240         /// Reading from this pointer when `result_ok` is set is undefined.
1241         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1242 }
1243 #[repr(C)]
1244 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1245 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1247 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1248         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1249         /// `err` or `result` depending on the state of `result_ok`.
1250         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1251         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1252         pub result_ok: bool,
1253 }
1254 #[no_mangle]
1255 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1256 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1257         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1258                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1259                         result: Box::into_raw(Box::new(o)),
1260                 },
1261                 result_ok: true,
1262         }
1263 }
1264 #[no_mangle]
1265 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1266 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1267         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1268                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1269                         err: Box::into_raw(Box::new(e)),
1270                 },
1271                 result_ok: false,
1272         }
1273 }
1274 /// Checks if the given object is currently in the success state
1275 #[no_mangle]
1276 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1277         o.result_ok
1278 }
1279 #[no_mangle]
1280 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1281 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1282 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1283         fn drop(&mut self) {
1284                 if self.result_ok {
1285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1287                         }
1288                 } else {
1289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1291                         }
1292                 }
1293         }
1294 }
1295 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1296         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1297                 let contents = if o.result_ok {
1298                         let result = unsafe { o.contents.result };
1299                         unsafe { o.contents.result = core::ptr::null_mut() };
1300                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1301                 } else {
1302                         let err = unsafe { o.contents.err };
1303                         unsafe { o.contents.err = core::ptr::null_mut(); }
1304                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1305                 };
1306                 Self {
1307                         contents,
1308                         result_ok: o.result_ok,
1309                 }
1310         }
1311 }
1312 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1313         fn clone(&self) -> Self {
1314                 if self.result_ok {
1315                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1316                                 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1317                         } }
1318                 } else {
1319                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1320                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1321                         } }
1322                 }
1323         }
1324 }
1325 #[no_mangle]
1326 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1327 /// but with all dynamically-allocated buffers duplicated in new buffers.
1328 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1329 #[repr(C)]
1330 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1331 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1332         /// A pointer to the contents in the success state.
1333         /// Reading from this pointer when `result_ok` is not set is undefined.
1334         pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1335         /// A pointer to the contents in the error state.
1336         /// Reading from this pointer when `result_ok` is set is undefined.
1337         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1338 }
1339 #[repr(C)]
1340 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1341 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1343 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1344         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1345         /// `err` or `result` depending on the state of `result_ok`.
1346         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1347         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1348         pub result_ok: bool,
1349 }
1350 #[no_mangle]
1351 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1352 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1353         CResult_SpendableOutputDescriptorDecodeErrorZ {
1354                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1355                         result: Box::into_raw(Box::new(o)),
1356                 },
1357                 result_ok: true,
1358         }
1359 }
1360 #[no_mangle]
1361 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1362 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1363         CResult_SpendableOutputDescriptorDecodeErrorZ {
1364                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1365                         err: Box::into_raw(Box::new(e)),
1366                 },
1367                 result_ok: false,
1368         }
1369 }
1370 /// Checks if the given object is currently in the success state
1371 #[no_mangle]
1372 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1373         o.result_ok
1374 }
1375 #[no_mangle]
1376 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1377 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1378 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1379         fn drop(&mut self) {
1380                 if self.result_ok {
1381                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1382                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1383                         }
1384                 } else {
1385                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1386                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1387                         }
1388                 }
1389         }
1390 }
1391 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1392         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1393                 let contents = if o.result_ok {
1394                         let result = unsafe { o.contents.result };
1395                         unsafe { o.contents.result = core::ptr::null_mut() };
1396                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1397                 } else {
1398                         let err = unsafe { o.contents.err };
1399                         unsafe { o.contents.err = core::ptr::null_mut(); }
1400                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1401                 };
1402                 Self {
1403                         contents,
1404                         result_ok: o.result_ok,
1405                 }
1406         }
1407 }
1408 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1409         fn clone(&self) -> Self {
1410                 if self.result_ok {
1411                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1412                                 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1413                         } }
1414                 } else {
1415                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1416                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1417                         } }
1418                 }
1419         }
1420 }
1421 #[no_mangle]
1422 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1423 /// but with all dynamically-allocated buffers duplicated in new buffers.
1424 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1425 #[repr(C)]
1426 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1427 /// This corresponds to std::vector in C++
1428 pub struct CVec_SpendableOutputDescriptorZ {
1429         /// The elements in the array.
1430         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1431         pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1432         /// The number of elements pointed to by `data`.
1433         pub datalen: usize
1434 }
1435 impl CVec_SpendableOutputDescriptorZ {
1436         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1437                 if self.datalen == 0 { return Vec::new(); }
1438                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1439                 self.data = core::ptr::null_mut();
1440                 self.datalen = 0;
1441                 ret
1442         }
1443         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1444                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1445         }
1446 }
1447 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1448         fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1449                 let datalen = v.len();
1450                 let data = Box::into_raw(v.into_boxed_slice());
1451                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1452         }
1453 }
1454 #[no_mangle]
1455 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1456 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1457 impl Drop for CVec_SpendableOutputDescriptorZ {
1458         fn drop(&mut self) {
1459                 if self.datalen == 0 { return; }
1460                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1461         }
1462 }
1463 impl Clone for CVec_SpendableOutputDescriptorZ {
1464         fn clone(&self) -> Self {
1465                 let mut res = Vec::new();
1466                 if self.datalen == 0 { return Self::from(res); }
1467                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1468                 Self::from(res)
1469         }
1470 }
1471 #[repr(C)]
1472 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1473 /// This corresponds to std::vector in C++
1474 pub struct CVec_TxOutZ {
1475         /// The elements in the array.
1476         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1477         pub data: *mut crate::c_types::TxOut,
1478         /// The number of elements pointed to by `data`.
1479         pub datalen: usize
1480 }
1481 impl CVec_TxOutZ {
1482         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1483                 if self.datalen == 0 { return Vec::new(); }
1484                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1485                 self.data = core::ptr::null_mut();
1486                 self.datalen = 0;
1487                 ret
1488         }
1489         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
1490                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1491         }
1492 }
1493 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
1494         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
1495                 let datalen = v.len();
1496                 let data = Box::into_raw(v.into_boxed_slice());
1497                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1498         }
1499 }
1500 #[no_mangle]
1501 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1502 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
1503 impl Drop for CVec_TxOutZ {
1504         fn drop(&mut self) {
1505                 if self.datalen == 0 { return; }
1506                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1507         }
1508 }
1509 impl Clone for CVec_TxOutZ {
1510         fn clone(&self) -> Self {
1511                 let mut res = Vec::new();
1512                 if self.datalen == 0 { return Self::from(res); }
1513                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1514                 Self::from(res)
1515         }
1516 }
1517 #[repr(C)]
1518 #[derive(Clone)]
1519 /// An enum which can either contain a u32 or not
1520 pub enum COption_u32Z {
1521         /// When we're in this state, this COption_u32Z contains a u32
1522         Some(u32),
1523         /// When we're in this state, this COption_u32Z contains nothing
1524         None
1525 }
1526 impl COption_u32Z {
1527         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1528                 if let Self::None = self { false } else { true }
1529         }
1530         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1531                 !self.is_some()
1532         }
1533         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
1534                 if let Self::Some(v) = self { v } else { unreachable!() }
1535         }
1536 }
1537 #[no_mangle]
1538 /// Constructs a new COption_u32Z containing a u32
1539 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
1540         COption_u32Z::Some(o)
1541 }
1542 #[no_mangle]
1543 /// Constructs a new COption_u32Z containing nothing
1544 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
1545         COption_u32Z::None
1546 }
1547 #[no_mangle]
1548 /// Frees any resources associated with the u32, if we are in the Some state
1549 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
1550 #[no_mangle]
1551 /// Creates a new COption_u32Z which has the same data as `orig`
1552 /// but with all dynamically-allocated buffers duplicated in new buffers.
1553 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
1554 #[repr(C)]
1555 /// A tuple of 2 elements. See the individual fields for the types contained.
1556 pub struct C2Tuple_CVec_u8ZusizeZ {
1557         /// The element at position 0
1558         pub a: crate::c_types::derived::CVec_u8Z,
1559         /// The element at position 1
1560         pub b: usize,
1561 }
1562 impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_CVec_u8ZusizeZ {
1563         fn from (tup: (crate::c_types::derived::CVec_u8Z, usize)) -> Self {
1564                 Self {
1565                         a: tup.0,
1566                         b: tup.1,
1567                 }
1568         }
1569 }
1570 impl C2Tuple_CVec_u8ZusizeZ {
1571         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, usize) {
1572                 (self.a, self.b)
1573         }
1574 }
1575 impl Clone for C2Tuple_CVec_u8ZusizeZ {
1576         fn clone(&self) -> Self {
1577                 Self {
1578                         a: Clone::clone(&self.a),
1579                         b: Clone::clone(&self.b),
1580                 }
1581         }
1582 }
1583 #[no_mangle]
1584 /// Creates a new tuple which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_clone(orig: &C2Tuple_CVec_u8ZusizeZ) -> C2Tuple_CVec_u8ZusizeZ { Clone::clone(&orig) }
1587 /// Creates a new C2Tuple_CVec_u8ZusizeZ from the contained elements.
1588 #[no_mangle]
1589 pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_CVec_u8ZusizeZ {
1590         C2Tuple_CVec_u8ZusizeZ { a, b, }
1591 }
1592
1593 #[no_mangle]
1594 /// Frees any resources used by the C2Tuple_CVec_u8ZusizeZ.
1595 pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_free(_res: C2Tuple_CVec_u8ZusizeZ) { }
1596 #[repr(C)]
1597 /// The contents of CResult_C2Tuple_CVec_u8ZusizeZNoneZ
1598 pub union CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1599         /// A pointer to the contents in the success state.
1600         /// Reading from this pointer when `result_ok` is not set is undefined.
1601         pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ,
1602         /// Note that this value is always NULL, as there are no contents in the Err variant
1603         pub err: *mut core::ffi::c_void,
1604 }
1605 #[repr(C)]
1606 /// A CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents the result of a fallible operation,
1607 /// containing a crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ on success and a () on failure.
1608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1609 pub struct CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1610         /// The contents of this CResult_C2Tuple_CVec_u8ZusizeZNoneZ, accessible via either
1611         /// `err` or `result` depending on the state of `result_ok`.
1612         pub contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr,
1613         /// Whether this CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents a success state.
1614         pub result_ok: bool,
1615 }
1616 #[no_mangle]
1617 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the success state.
1618 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1619         CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1620                 contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1621                         result: Box::into_raw(Box::new(o)),
1622                 },
1623                 result_ok: true,
1624         }
1625 }
1626 #[no_mangle]
1627 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the error state.
1628 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1629         CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1630                 contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1631                         err: core::ptr::null_mut(),
1632                 },
1633                 result_ok: false,
1634         }
1635 }
1636 /// Checks if the given object is currently in the success state
1637 #[no_mangle]
1638 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> bool {
1639         o.result_ok
1640 }
1641 #[no_mangle]
1642 /// Frees any resources used by the CResult_C2Tuple_CVec_u8ZusizeZNoneZ.
1643 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res: CResult_C2Tuple_CVec_u8ZusizeZNoneZ) { }
1644 impl Drop for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1645         fn drop(&mut self) {
1646                 if self.result_ok {
1647                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1648                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1649                         }
1650                 } else {
1651                 }
1652         }
1653 }
1654 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ, ()>> for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1655         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ, ()>) -> Self {
1656                 let contents = if o.result_ok {
1657                         let result = unsafe { o.contents.result };
1658                         unsafe { o.contents.result = core::ptr::null_mut() };
1659                         CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { result }
1660                 } else {
1661                         let _ = unsafe { Box::from_raw(o.contents.err) };
1662                         o.contents.err = core::ptr::null_mut();
1663                         CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { err: core::ptr::null_mut() }
1664                 };
1665                 Self {
1666                         contents,
1667                         result_ok: o.result_ok,
1668                 }
1669         }
1670 }
1671 impl Clone for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1672         fn clone(&self) -> Self {
1673                 if self.result_ok {
1674                         Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1675                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ>::clone(unsafe { &*self.contents.result })))
1676                         } }
1677                 } else {
1678                         Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1679                                 err: core::ptr::null_mut()
1680                         } }
1681                 }
1682         }
1683 }
1684 #[no_mangle]
1685 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ which has the same data as `orig`
1686 /// but with all dynamically-allocated buffers duplicated in new buffers.
1687 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { Clone::clone(&orig) }
1688 #[repr(C)]
1689 /// The contents of CResult_NoneNoneZ
1690 pub union CResult_NoneNoneZPtr {
1691         /// Note that this value is always NULL, as there are no contents in the OK variant
1692         pub result: *mut core::ffi::c_void,
1693         /// Note that this value is always NULL, as there are no contents in the Err variant
1694         pub err: *mut core::ffi::c_void,
1695 }
1696 #[repr(C)]
1697 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1698 /// containing a () on success and a () on failure.
1699 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1700 pub struct CResult_NoneNoneZ {
1701         /// The contents of this CResult_NoneNoneZ, accessible via either
1702         /// `err` or `result` depending on the state of `result_ok`.
1703         pub contents: CResult_NoneNoneZPtr,
1704         /// Whether this CResult_NoneNoneZ represents a success state.
1705         pub result_ok: bool,
1706 }
1707 #[no_mangle]
1708 /// Creates a new CResult_NoneNoneZ in the success state.
1709 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1710         CResult_NoneNoneZ {
1711                 contents: CResult_NoneNoneZPtr {
1712                         result: core::ptr::null_mut(),
1713                 },
1714                 result_ok: true,
1715         }
1716 }
1717 #[no_mangle]
1718 /// Creates a new CResult_NoneNoneZ in the error state.
1719 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1720         CResult_NoneNoneZ {
1721                 contents: CResult_NoneNoneZPtr {
1722                         err: core::ptr::null_mut(),
1723                 },
1724                 result_ok: false,
1725         }
1726 }
1727 /// Checks if the given object is currently in the success state
1728 #[no_mangle]
1729 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1730         o.result_ok
1731 }
1732 #[no_mangle]
1733 /// Frees any resources used by the CResult_NoneNoneZ.
1734 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1735 impl Drop for CResult_NoneNoneZ {
1736         fn drop(&mut self) {
1737                 if self.result_ok {
1738                 } else {
1739                 }
1740         }
1741 }
1742 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1743         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1744                 let contents = if o.result_ok {
1745                         let _ = unsafe { Box::from_raw(o.contents.result) };
1746                         o.contents.result = core::ptr::null_mut();
1747                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1748                 } else {
1749                         let _ = unsafe { Box::from_raw(o.contents.err) };
1750                         o.contents.err = core::ptr::null_mut();
1751                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1752                 };
1753                 Self {
1754                         contents,
1755                         result_ok: o.result_ok,
1756                 }
1757         }
1758 }
1759 impl Clone for CResult_NoneNoneZ {
1760         fn clone(&self) -> Self {
1761                 if self.result_ok {
1762                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1763                                 result: core::ptr::null_mut()
1764                         } }
1765                 } else {
1766                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1767                                 err: core::ptr::null_mut()
1768                         } }
1769                 }
1770         }
1771 }
1772 #[no_mangle]
1773 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1774 /// but with all dynamically-allocated buffers duplicated in new buffers.
1775 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1776 #[repr(C)]
1777 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
1778 /// This corresponds to std::vector in C++
1779 pub struct CVec_ECDSASignatureZ {
1780         /// The elements in the array.
1781         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1782         pub data: *mut crate::c_types::ECDSASignature,
1783         /// The number of elements pointed to by `data`.
1784         pub datalen: usize
1785 }
1786 impl CVec_ECDSASignatureZ {
1787         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
1788                 if self.datalen == 0 { return Vec::new(); }
1789                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1790                 self.data = core::ptr::null_mut();
1791                 self.datalen = 0;
1792                 ret
1793         }
1794         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
1795                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1796         }
1797 }
1798 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
1799         fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
1800                 let datalen = v.len();
1801                 let data = Box::into_raw(v.into_boxed_slice());
1802                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1803         }
1804 }
1805 #[no_mangle]
1806 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1807 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
1808 impl Drop for CVec_ECDSASignatureZ {
1809         fn drop(&mut self) {
1810                 if self.datalen == 0 { return; }
1811                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1812         }
1813 }
1814 impl Clone for CVec_ECDSASignatureZ {
1815         fn clone(&self) -> Self {
1816                 let mut res = Vec::new();
1817                 if self.datalen == 0 { return Self::from(res); }
1818                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1819                 Self::from(res)
1820         }
1821 }
1822 #[repr(C)]
1823 /// A tuple of 2 elements. See the individual fields for the types contained.
1824 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1825         /// The element at position 0
1826         pub a: crate::c_types::ECDSASignature,
1827         /// The element at position 1
1828         pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
1829 }
1830 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1831         fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
1832                 Self {
1833                         a: tup.0,
1834                         b: tup.1,
1835                 }
1836         }
1837 }
1838 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1839         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
1840                 (self.a, self.b)
1841         }
1842 }
1843 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1844         fn clone(&self) -> Self {
1845                 Self {
1846                         a: Clone::clone(&self.a),
1847                         b: Clone::clone(&self.b),
1848                 }
1849         }
1850 }
1851 #[no_mangle]
1852 /// Creates a new tuple which has the same data as `orig`
1853 /// but with all dynamically-allocated buffers duplicated in new buffers.
1854 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
1855 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
1856 #[no_mangle]
1857 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1858         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
1859 }
1860
1861 #[no_mangle]
1862 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
1863 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
1864 #[repr(C)]
1865 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
1866 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1867         /// A pointer to the contents in the success state.
1868         /// Reading from this pointer when `result_ok` is not set is undefined.
1869         pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
1870         /// Note that this value is always NULL, as there are no contents in the Err variant
1871         pub err: *mut core::ffi::c_void,
1872 }
1873 #[repr(C)]
1874 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
1875 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
1876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1877 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1878         /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
1879         /// `err` or `result` depending on the state of `result_ok`.
1880         pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
1881         /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
1882         pub result_ok: bool,
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
1886 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1887         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1888                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1889                         result: Box::into_raw(Box::new(o)),
1890                 },
1891                 result_ok: true,
1892         }
1893 }
1894 #[no_mangle]
1895 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
1896 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1897         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1898                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1899                         err: core::ptr::null_mut(),
1900                 },
1901                 result_ok: false,
1902         }
1903 }
1904 /// Checks if the given object is currently in the success state
1905 #[no_mangle]
1906 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
1907         o.result_ok
1908 }
1909 #[no_mangle]
1910 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
1911 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
1912 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1913         fn drop(&mut self) {
1914                 if self.result_ok {
1915                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1916                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1917                         }
1918                 } else {
1919                 }
1920         }
1921 }
1922 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1923         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
1924                 let contents = if o.result_ok {
1925                         let result = unsafe { o.contents.result };
1926                         unsafe { o.contents.result = core::ptr::null_mut() };
1927                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
1928                 } else {
1929                         let _ = unsafe { Box::from_raw(o.contents.err) };
1930                         o.contents.err = core::ptr::null_mut();
1931                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
1932                 };
1933                 Self {
1934                         contents,
1935                         result_ok: o.result_ok,
1936                 }
1937         }
1938 }
1939 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1940         fn clone(&self) -> Self {
1941                 if self.result_ok {
1942                         Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1943                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
1944                         } }
1945                 } else {
1946                         Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1947                                 err: core::ptr::null_mut()
1948                         } }
1949                 }
1950         }
1951 }
1952 #[no_mangle]
1953 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
1954 /// but with all dynamically-allocated buffers duplicated in new buffers.
1955 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
1956 #[repr(C)]
1957 /// The contents of CResult_ECDSASignatureNoneZ
1958 pub union CResult_ECDSASignatureNoneZPtr {
1959         /// A pointer to the contents in the success state.
1960         /// Reading from this pointer when `result_ok` is not set is undefined.
1961         pub result: *mut crate::c_types::ECDSASignature,
1962         /// Note that this value is always NULL, as there are no contents in the Err variant
1963         pub err: *mut core::ffi::c_void,
1964 }
1965 #[repr(C)]
1966 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
1967 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
1968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1969 pub struct CResult_ECDSASignatureNoneZ {
1970         /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
1971         /// `err` or `result` depending on the state of `result_ok`.
1972         pub contents: CResult_ECDSASignatureNoneZPtr,
1973         /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
1974         pub result_ok: bool,
1975 }
1976 #[no_mangle]
1977 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
1978 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
1979         CResult_ECDSASignatureNoneZ {
1980                 contents: CResult_ECDSASignatureNoneZPtr {
1981                         result: Box::into_raw(Box::new(o)),
1982                 },
1983                 result_ok: true,
1984         }
1985 }
1986 #[no_mangle]
1987 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
1988 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
1989         CResult_ECDSASignatureNoneZ {
1990                 contents: CResult_ECDSASignatureNoneZPtr {
1991                         err: core::ptr::null_mut(),
1992                 },
1993                 result_ok: false,
1994         }
1995 }
1996 /// Checks if the given object is currently in the success state
1997 #[no_mangle]
1998 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
1999         o.result_ok
2000 }
2001 #[no_mangle]
2002 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2003 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2004 impl Drop for CResult_ECDSASignatureNoneZ {
2005         fn drop(&mut self) {
2006                 if self.result_ok {
2007                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2008                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2009                         }
2010                 } else {
2011                 }
2012         }
2013 }
2014 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2015         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2016                 let contents = if o.result_ok {
2017                         let result = unsafe { o.contents.result };
2018                         unsafe { o.contents.result = core::ptr::null_mut() };
2019                         CResult_ECDSASignatureNoneZPtr { result }
2020                 } else {
2021                         let _ = unsafe { Box::from_raw(o.contents.err) };
2022                         o.contents.err = core::ptr::null_mut();
2023                         CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2024                 };
2025                 Self {
2026                         contents,
2027                         result_ok: o.result_ok,
2028                 }
2029         }
2030 }
2031 impl Clone for CResult_ECDSASignatureNoneZ {
2032         fn clone(&self) -> Self {
2033                 if self.result_ok {
2034                         Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2035                                 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2036                         } }
2037                 } else {
2038                         Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2039                                 err: core::ptr::null_mut()
2040                         } }
2041                 }
2042         }
2043 }
2044 #[no_mangle]
2045 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2046 /// but with all dynamically-allocated buffers duplicated in new buffers.
2047 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2048 #[repr(C)]
2049 /// The contents of CResult_PublicKeyNoneZ
2050 pub union CResult_PublicKeyNoneZPtr {
2051         /// A pointer to the contents in the success state.
2052         /// Reading from this pointer when `result_ok` is not set is undefined.
2053         pub result: *mut crate::c_types::PublicKey,
2054         /// Note that this value is always NULL, as there are no contents in the Err variant
2055         pub err: *mut core::ffi::c_void,
2056 }
2057 #[repr(C)]
2058 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2059 /// containing a crate::c_types::PublicKey on success and a () on failure.
2060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2061 pub struct CResult_PublicKeyNoneZ {
2062         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2063         /// `err` or `result` depending on the state of `result_ok`.
2064         pub contents: CResult_PublicKeyNoneZPtr,
2065         /// Whether this CResult_PublicKeyNoneZ represents a success state.
2066         pub result_ok: bool,
2067 }
2068 #[no_mangle]
2069 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2070 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2071         CResult_PublicKeyNoneZ {
2072                 contents: CResult_PublicKeyNoneZPtr {
2073                         result: Box::into_raw(Box::new(o)),
2074                 },
2075                 result_ok: true,
2076         }
2077 }
2078 #[no_mangle]
2079 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2080 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2081         CResult_PublicKeyNoneZ {
2082                 contents: CResult_PublicKeyNoneZPtr {
2083                         err: core::ptr::null_mut(),
2084                 },
2085                 result_ok: false,
2086         }
2087 }
2088 /// Checks if the given object is currently in the success state
2089 #[no_mangle]
2090 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2091         o.result_ok
2092 }
2093 #[no_mangle]
2094 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2095 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2096 impl Drop for CResult_PublicKeyNoneZ {
2097         fn drop(&mut self) {
2098                 if self.result_ok {
2099                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2100                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2101                         }
2102                 } else {
2103                 }
2104         }
2105 }
2106 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2107         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2108                 let contents = if o.result_ok {
2109                         let result = unsafe { o.contents.result };
2110                         unsafe { o.contents.result = core::ptr::null_mut() };
2111                         CResult_PublicKeyNoneZPtr { result }
2112                 } else {
2113                         let _ = unsafe { Box::from_raw(o.contents.err) };
2114                         o.contents.err = core::ptr::null_mut();
2115                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2116                 };
2117                 Self {
2118                         contents,
2119                         result_ok: o.result_ok,
2120                 }
2121         }
2122 }
2123 impl Clone for CResult_PublicKeyNoneZ {
2124         fn clone(&self) -> Self {
2125                 if self.result_ok {
2126                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2127                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2128                         } }
2129                 } else {
2130                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2131                                 err: core::ptr::null_mut()
2132                         } }
2133                 }
2134         }
2135 }
2136 #[no_mangle]
2137 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2138 /// but with all dynamically-allocated buffers duplicated in new buffers.
2139 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2140 #[repr(C)]
2141 #[derive(Clone)]
2142 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2143 pub enum COption_BigEndianScalarZ {
2144         /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2145         Some(crate::c_types::BigEndianScalar),
2146         /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2147         None
2148 }
2149 impl COption_BigEndianScalarZ {
2150         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2151                 if let Self::None = self { false } else { true }
2152         }
2153         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2154                 !self.is_some()
2155         }
2156         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2157                 if let Self::Some(v) = self { v } else { unreachable!() }
2158         }
2159 }
2160 #[no_mangle]
2161 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2162 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2163         COption_BigEndianScalarZ::Some(o)
2164 }
2165 #[no_mangle]
2166 /// Constructs a new COption_BigEndianScalarZ containing nothing
2167 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2168         COption_BigEndianScalarZ::None
2169 }
2170 #[no_mangle]
2171 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2172 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2173 #[no_mangle]
2174 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2175 /// but with all dynamically-allocated buffers duplicated in new buffers.
2176 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2177 #[repr(C)]
2178 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2179 /// This corresponds to std::vector in C++
2180 pub struct CVec_U5Z {
2181         /// The elements in the array.
2182         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2183         pub data: *mut crate::c_types::U5,
2184         /// The number of elements pointed to by `data`.
2185         pub datalen: usize
2186 }
2187 impl CVec_U5Z {
2188         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2189                 if self.datalen == 0 { return Vec::new(); }
2190                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2191                 self.data = core::ptr::null_mut();
2192                 self.datalen = 0;
2193                 ret
2194         }
2195         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2196                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2197         }
2198 }
2199 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2200         fn from(v: Vec<crate::c_types::U5>) -> Self {
2201                 let datalen = v.len();
2202                 let data = Box::into_raw(v.into_boxed_slice());
2203                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2204         }
2205 }
2206 #[no_mangle]
2207 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2208 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2209 impl Drop for CVec_U5Z {
2210         fn drop(&mut self) {
2211                 if self.datalen == 0 { return; }
2212                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2213         }
2214 }
2215 impl Clone for CVec_U5Z {
2216         fn clone(&self) -> Self {
2217                 let mut res = Vec::new();
2218                 if self.datalen == 0 { return Self::from(res); }
2219                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2220                 Self::from(res)
2221         }
2222 }
2223 #[repr(C)]
2224 /// The contents of CResult_RecoverableSignatureNoneZ
2225 pub union CResult_RecoverableSignatureNoneZPtr {
2226         /// A pointer to the contents in the success state.
2227         /// Reading from this pointer when `result_ok` is not set is undefined.
2228         pub result: *mut crate::c_types::RecoverableSignature,
2229         /// Note that this value is always NULL, as there are no contents in the Err variant
2230         pub err: *mut core::ffi::c_void,
2231 }
2232 #[repr(C)]
2233 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2234 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2236 pub struct CResult_RecoverableSignatureNoneZ {
2237         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2238         /// `err` or `result` depending on the state of `result_ok`.
2239         pub contents: CResult_RecoverableSignatureNoneZPtr,
2240         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2241         pub result_ok: bool,
2242 }
2243 #[no_mangle]
2244 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2245 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2246         CResult_RecoverableSignatureNoneZ {
2247                 contents: CResult_RecoverableSignatureNoneZPtr {
2248                         result: Box::into_raw(Box::new(o)),
2249                 },
2250                 result_ok: true,
2251         }
2252 }
2253 #[no_mangle]
2254 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2255 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2256         CResult_RecoverableSignatureNoneZ {
2257                 contents: CResult_RecoverableSignatureNoneZPtr {
2258                         err: core::ptr::null_mut(),
2259                 },
2260                 result_ok: false,
2261         }
2262 }
2263 /// Checks if the given object is currently in the success state
2264 #[no_mangle]
2265 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2266         o.result_ok
2267 }
2268 #[no_mangle]
2269 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2270 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2271 impl Drop for CResult_RecoverableSignatureNoneZ {
2272         fn drop(&mut self) {
2273                 if self.result_ok {
2274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2276                         }
2277                 } else {
2278                 }
2279         }
2280 }
2281 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2282         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2283                 let contents = if o.result_ok {
2284                         let result = unsafe { o.contents.result };
2285                         unsafe { o.contents.result = core::ptr::null_mut() };
2286                         CResult_RecoverableSignatureNoneZPtr { result }
2287                 } else {
2288                         let _ = unsafe { Box::from_raw(o.contents.err) };
2289                         o.contents.err = core::ptr::null_mut();
2290                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2291                 };
2292                 Self {
2293                         contents,
2294                         result_ok: o.result_ok,
2295                 }
2296         }
2297 }
2298 impl Clone for CResult_RecoverableSignatureNoneZ {
2299         fn clone(&self) -> Self {
2300                 if self.result_ok {
2301                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2302                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2303                         } }
2304                 } else {
2305                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2306                                 err: core::ptr::null_mut()
2307                         } }
2308                 }
2309         }
2310 }
2311 #[no_mangle]
2312 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2315 #[repr(C)]
2316 /// The contents of CResult_SchnorrSignatureNoneZ
2317 pub union CResult_SchnorrSignatureNoneZPtr {
2318         /// A pointer to the contents in the success state.
2319         /// Reading from this pointer when `result_ok` is not set is undefined.
2320         pub result: *mut crate::c_types::SchnorrSignature,
2321         /// Note that this value is always NULL, as there are no contents in the Err variant
2322         pub err: *mut core::ffi::c_void,
2323 }
2324 #[repr(C)]
2325 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2326 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2328 pub struct CResult_SchnorrSignatureNoneZ {
2329         /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2330         /// `err` or `result` depending on the state of `result_ok`.
2331         pub contents: CResult_SchnorrSignatureNoneZPtr,
2332         /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2333         pub result_ok: bool,
2334 }
2335 #[no_mangle]
2336 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2337 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2338         CResult_SchnorrSignatureNoneZ {
2339                 contents: CResult_SchnorrSignatureNoneZPtr {
2340                         result: Box::into_raw(Box::new(o)),
2341                 },
2342                 result_ok: true,
2343         }
2344 }
2345 #[no_mangle]
2346 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2347 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2348         CResult_SchnorrSignatureNoneZ {
2349                 contents: CResult_SchnorrSignatureNoneZPtr {
2350                         err: core::ptr::null_mut(),
2351                 },
2352                 result_ok: false,
2353         }
2354 }
2355 /// Checks if the given object is currently in the success state
2356 #[no_mangle]
2357 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2358         o.result_ok
2359 }
2360 #[no_mangle]
2361 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2362 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2363 impl Drop for CResult_SchnorrSignatureNoneZ {
2364         fn drop(&mut self) {
2365                 if self.result_ok {
2366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2368                         }
2369                 } else {
2370                 }
2371         }
2372 }
2373 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2374         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2375                 let contents = if o.result_ok {
2376                         let result = unsafe { o.contents.result };
2377                         unsafe { o.contents.result = core::ptr::null_mut() };
2378                         CResult_SchnorrSignatureNoneZPtr { result }
2379                 } else {
2380                         let _ = unsafe { Box::from_raw(o.contents.err) };
2381                         o.contents.err = core::ptr::null_mut();
2382                         CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2383                 };
2384                 Self {
2385                         contents,
2386                         result_ok: o.result_ok,
2387                 }
2388         }
2389 }
2390 impl Clone for CResult_SchnorrSignatureNoneZ {
2391         fn clone(&self) -> Self {
2392                 if self.result_ok {
2393                         Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2394                                 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2395                         } }
2396                 } else {
2397                         Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2398                                 err: core::ptr::null_mut()
2399                         } }
2400                 }
2401         }
2402 }
2403 #[no_mangle]
2404 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2405 /// but with all dynamically-allocated buffers duplicated in new buffers.
2406 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2407 #[repr(C)]
2408 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2409 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2410         /// A pointer to the contents in the success state.
2411         /// Reading from this pointer when `result_ok` is not set is undefined.
2412         pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2413         /// A pointer to the contents in the error state.
2414         /// Reading from this pointer when `result_ok` is set is undefined.
2415         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2416 }
2417 #[repr(C)]
2418 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2419 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2421 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2422         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2423         /// `err` or `result` depending on the state of `result_ok`.
2424         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2425         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2426         pub result_ok: bool,
2427 }
2428 #[no_mangle]
2429 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2430 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2431         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2432                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2433                         result: Box::into_raw(Box::new(o)),
2434                 },
2435                 result_ok: true,
2436         }
2437 }
2438 #[no_mangle]
2439 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2440 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2441         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2442                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2443                         err: Box::into_raw(Box::new(e)),
2444                 },
2445                 result_ok: false,
2446         }
2447 }
2448 /// Checks if the given object is currently in the success state
2449 #[no_mangle]
2450 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2451         o.result_ok
2452 }
2453 #[no_mangle]
2454 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2455 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2456 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2457         fn drop(&mut self) {
2458                 if self.result_ok {
2459                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2460                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2461                         }
2462                 } else {
2463                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2464                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2465                         }
2466                 }
2467         }
2468 }
2469 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2470         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2471                 let contents = if o.result_ok {
2472                         let result = unsafe { o.contents.result };
2473                         unsafe { o.contents.result = core::ptr::null_mut() };
2474                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2475                 } else {
2476                         let err = unsafe { o.contents.err };
2477                         unsafe { o.contents.err = core::ptr::null_mut(); }
2478                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2479                 };
2480                 Self {
2481                         contents,
2482                         result_ok: o.result_ok,
2483                 }
2484         }
2485 }
2486 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2487         fn clone(&self) -> Self {
2488                 if self.result_ok {
2489                         Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2490                                 result: Box::into_raw(Box::new(<crate::lightning::sign::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2491                         } }
2492                 } else {
2493                         Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2494                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2495                         } }
2496                 }
2497         }
2498 }
2499 #[no_mangle]
2500 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2501 /// but with all dynamically-allocated buffers duplicated in new buffers.
2502 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2503 #[repr(C)]
2504 /// The contents of CResult_CVec_u8ZNoneZ
2505 pub union CResult_CVec_u8ZNoneZPtr {
2506         /// A pointer to the contents in the success state.
2507         /// Reading from this pointer when `result_ok` is not set is undefined.
2508         pub result: *mut crate::c_types::derived::CVec_u8Z,
2509         /// Note that this value is always NULL, as there are no contents in the Err variant
2510         pub err: *mut core::ffi::c_void,
2511 }
2512 #[repr(C)]
2513 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2514 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2516 pub struct CResult_CVec_u8ZNoneZ {
2517         /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2518         /// `err` or `result` depending on the state of `result_ok`.
2519         pub contents: CResult_CVec_u8ZNoneZPtr,
2520         /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2521         pub result_ok: bool,
2522 }
2523 #[no_mangle]
2524 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2525 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2526         CResult_CVec_u8ZNoneZ {
2527                 contents: CResult_CVec_u8ZNoneZPtr {
2528                         result: Box::into_raw(Box::new(o)),
2529                 },
2530                 result_ok: true,
2531         }
2532 }
2533 #[no_mangle]
2534 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2535 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2536         CResult_CVec_u8ZNoneZ {
2537                 contents: CResult_CVec_u8ZNoneZPtr {
2538                         err: core::ptr::null_mut(),
2539                 },
2540                 result_ok: false,
2541         }
2542 }
2543 /// Checks if the given object is currently in the success state
2544 #[no_mangle]
2545 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2546         o.result_ok
2547 }
2548 #[no_mangle]
2549 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2550 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2551 impl Drop for CResult_CVec_u8ZNoneZ {
2552         fn drop(&mut self) {
2553                 if self.result_ok {
2554                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2555                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2556                         }
2557                 } else {
2558                 }
2559         }
2560 }
2561 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2562         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2563                 let contents = if o.result_ok {
2564                         let result = unsafe { o.contents.result };
2565                         unsafe { o.contents.result = core::ptr::null_mut() };
2566                         CResult_CVec_u8ZNoneZPtr { result }
2567                 } else {
2568                         let _ = unsafe { Box::from_raw(o.contents.err) };
2569                         o.contents.err = core::ptr::null_mut();
2570                         CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2571                 };
2572                 Self {
2573                         contents,
2574                         result_ok: o.result_ok,
2575                 }
2576         }
2577 }
2578 impl Clone for CResult_CVec_u8ZNoneZ {
2579         fn clone(&self) -> Self {
2580                 if self.result_ok {
2581                         Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2582                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2583                         } }
2584                 } else {
2585                         Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2586                                 err: core::ptr::null_mut()
2587                         } }
2588                 }
2589         }
2590 }
2591 #[no_mangle]
2592 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2593 /// but with all dynamically-allocated buffers duplicated in new buffers.
2594 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2595 #[repr(C)]
2596 /// The contents of CResult_ShutdownScriptNoneZ
2597 pub union CResult_ShutdownScriptNoneZPtr {
2598         /// A pointer to the contents in the success state.
2599         /// Reading from this pointer when `result_ok` is not set is undefined.
2600         pub result: *mut crate::lightning::ln::script::ShutdownScript,
2601         /// Note that this value is always NULL, as there are no contents in the Err variant
2602         pub err: *mut core::ffi::c_void,
2603 }
2604 #[repr(C)]
2605 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2606 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2608 pub struct CResult_ShutdownScriptNoneZ {
2609         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2610         /// `err` or `result` depending on the state of `result_ok`.
2611         pub contents: CResult_ShutdownScriptNoneZPtr,
2612         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2613         pub result_ok: bool,
2614 }
2615 #[no_mangle]
2616 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2617 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2618         CResult_ShutdownScriptNoneZ {
2619                 contents: CResult_ShutdownScriptNoneZPtr {
2620                         result: Box::into_raw(Box::new(o)),
2621                 },
2622                 result_ok: true,
2623         }
2624 }
2625 #[no_mangle]
2626 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2627 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2628         CResult_ShutdownScriptNoneZ {
2629                 contents: CResult_ShutdownScriptNoneZPtr {
2630                         err: core::ptr::null_mut(),
2631                 },
2632                 result_ok: false,
2633         }
2634 }
2635 /// Checks if the given object is currently in the success state
2636 #[no_mangle]
2637 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2638         o.result_ok
2639 }
2640 #[no_mangle]
2641 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2642 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2643 impl Drop for CResult_ShutdownScriptNoneZ {
2644         fn drop(&mut self) {
2645                 if self.result_ok {
2646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2648                         }
2649                 } else {
2650                 }
2651         }
2652 }
2653 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2654         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2655                 let contents = if o.result_ok {
2656                         let result = unsafe { o.contents.result };
2657                         unsafe { o.contents.result = core::ptr::null_mut() };
2658                         CResult_ShutdownScriptNoneZPtr { result }
2659                 } else {
2660                         let _ = unsafe { Box::from_raw(o.contents.err) };
2661                         o.contents.err = core::ptr::null_mut();
2662                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2663                 };
2664                 Self {
2665                         contents,
2666                         result_ok: o.result_ok,
2667                 }
2668         }
2669 }
2670 impl Clone for CResult_ShutdownScriptNoneZ {
2671         fn clone(&self) -> Self {
2672                 if self.result_ok {
2673                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2674                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2675                         } }
2676                 } else {
2677                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2678                                 err: core::ptr::null_mut()
2679                         } }
2680                 }
2681         }
2682 }
2683 #[no_mangle]
2684 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2685 /// but with all dynamically-allocated buffers duplicated in new buffers.
2686 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2687 #[repr(C)]
2688 #[derive(Clone)]
2689 /// An enum which can either contain a u16 or not
2690 pub enum COption_u16Z {
2691         /// When we're in this state, this COption_u16Z contains a u16
2692         Some(u16),
2693         /// When we're in this state, this COption_u16Z contains nothing
2694         None
2695 }
2696 impl COption_u16Z {
2697         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2698                 if let Self::None = self { false } else { true }
2699         }
2700         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2701                 !self.is_some()
2702         }
2703         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2704                 if let Self::Some(v) = self { v } else { unreachable!() }
2705         }
2706 }
2707 #[no_mangle]
2708 /// Constructs a new COption_u16Z containing a u16
2709 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2710         COption_u16Z::Some(o)
2711 }
2712 #[no_mangle]
2713 /// Constructs a new COption_u16Z containing nothing
2714 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2715         COption_u16Z::None
2716 }
2717 #[no_mangle]
2718 /// Frees any resources associated with the u16, if we are in the Some state
2719 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2720 #[no_mangle]
2721 /// Creates a new COption_u16Z which has the same data as `orig`
2722 /// but with all dynamically-allocated buffers duplicated in new buffers.
2723 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2724 #[repr(C)]
2725 #[derive(Clone)]
2726 /// An enum which can either contain a bool or not
2727 pub enum COption_boolZ {
2728         /// When we're in this state, this COption_boolZ contains a bool
2729         Some(bool),
2730         /// When we're in this state, this COption_boolZ contains nothing
2731         None
2732 }
2733 impl COption_boolZ {
2734         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2735                 if let Self::None = self { false } else { true }
2736         }
2737         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2738                 !self.is_some()
2739         }
2740         #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2741                 if let Self::Some(v) = self { v } else { unreachable!() }
2742         }
2743 }
2744 #[no_mangle]
2745 /// Constructs a new COption_boolZ containing a bool
2746 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2747         COption_boolZ::Some(o)
2748 }
2749 #[no_mangle]
2750 /// Constructs a new COption_boolZ containing nothing
2751 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2752         COption_boolZ::None
2753 }
2754 #[no_mangle]
2755 /// Frees any resources associated with the bool, if we are in the Some state
2756 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2757 #[no_mangle]
2758 /// Creates a new COption_boolZ which has the same data as `orig`
2759 /// but with all dynamically-allocated buffers duplicated in new buffers.
2760 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2761 #[repr(C)]
2762 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2763 /// This corresponds to std::vector in C++
2764 pub struct CVec_CVec_u8ZZ {
2765         /// The elements in the array.
2766         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2767         pub data: *mut crate::c_types::derived::CVec_u8Z,
2768         /// The number of elements pointed to by `data`.
2769         pub datalen: usize
2770 }
2771 impl CVec_CVec_u8ZZ {
2772         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2773                 if self.datalen == 0 { return Vec::new(); }
2774                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2775                 self.data = core::ptr::null_mut();
2776                 self.datalen = 0;
2777                 ret
2778         }
2779         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2780                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2781         }
2782 }
2783 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2784         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2785                 let datalen = v.len();
2786                 let data = Box::into_raw(v.into_boxed_slice());
2787                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2788         }
2789 }
2790 #[no_mangle]
2791 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2792 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2793 impl Drop for CVec_CVec_u8ZZ {
2794         fn drop(&mut self) {
2795                 if self.datalen == 0 { return; }
2796                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2797         }
2798 }
2799 impl Clone for CVec_CVec_u8ZZ {
2800         fn clone(&self) -> Self {
2801                 let mut res = Vec::new();
2802                 if self.datalen == 0 { return Self::from(res); }
2803                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2804                 Self::from(res)
2805         }
2806 }
2807 #[repr(C)]
2808 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
2809 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
2810         /// A pointer to the contents in the success state.
2811         /// Reading from this pointer when `result_ok` is not set is undefined.
2812         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
2813         /// Note that this value is always NULL, as there are no contents in the Err variant
2814         pub err: *mut core::ffi::c_void,
2815 }
2816 #[repr(C)]
2817 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
2818 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
2819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2820 pub struct CResult_CVec_CVec_u8ZZNoneZ {
2821         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
2822         /// `err` or `result` depending on the state of `result_ok`.
2823         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
2824         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
2825         pub result_ok: bool,
2826 }
2827 #[no_mangle]
2828 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
2829 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
2830         CResult_CVec_CVec_u8ZZNoneZ {
2831                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2832                         result: Box::into_raw(Box::new(o)),
2833                 },
2834                 result_ok: true,
2835         }
2836 }
2837 #[no_mangle]
2838 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
2839 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
2840         CResult_CVec_CVec_u8ZZNoneZ {
2841                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2842                         err: core::ptr::null_mut(),
2843                 },
2844                 result_ok: false,
2845         }
2846 }
2847 /// Checks if the given object is currently in the success state
2848 #[no_mangle]
2849 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
2850         o.result_ok
2851 }
2852 #[no_mangle]
2853 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
2854 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
2855 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
2856         fn drop(&mut self) {
2857                 if self.result_ok {
2858                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2859                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2860                         }
2861                 } else {
2862                 }
2863         }
2864 }
2865 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
2866         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
2867                 let contents = if o.result_ok {
2868                         let result = unsafe { o.contents.result };
2869                         unsafe { o.contents.result = core::ptr::null_mut() };
2870                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
2871                 } else {
2872                         let _ = unsafe { Box::from_raw(o.contents.err) };
2873                         o.contents.err = core::ptr::null_mut();
2874                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
2875                 };
2876                 Self {
2877                         contents,
2878                         result_ok: o.result_ok,
2879                 }
2880         }
2881 }
2882 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
2883         fn clone(&self) -> Self {
2884                 if self.result_ok {
2885                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2886                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
2887                         } }
2888                 } else {
2889                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2890                                 err: core::ptr::null_mut()
2891                         } }
2892                 }
2893         }
2894 }
2895 #[no_mangle]
2896 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
2897 /// but with all dynamically-allocated buffers duplicated in new buffers.
2898 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
2899 #[repr(C)]
2900 /// The contents of CResult_InMemorySignerDecodeErrorZ
2901 pub union CResult_InMemorySignerDecodeErrorZPtr {
2902         /// A pointer to the contents in the success state.
2903         /// Reading from this pointer when `result_ok` is not set is undefined.
2904         pub result: *mut crate::lightning::sign::InMemorySigner,
2905         /// A pointer to the contents in the error state.
2906         /// Reading from this pointer when `result_ok` is set is undefined.
2907         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2908 }
2909 #[repr(C)]
2910 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
2911 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2913 pub struct CResult_InMemorySignerDecodeErrorZ {
2914         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
2915         /// `err` or `result` depending on the state of `result_ok`.
2916         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
2917         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
2918         pub result_ok: bool,
2919 }
2920 #[no_mangle]
2921 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
2922 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
2923         CResult_InMemorySignerDecodeErrorZ {
2924                 contents: CResult_InMemorySignerDecodeErrorZPtr {
2925                         result: Box::into_raw(Box::new(o)),
2926                 },
2927                 result_ok: true,
2928         }
2929 }
2930 #[no_mangle]
2931 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
2932 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
2933         CResult_InMemorySignerDecodeErrorZ {
2934                 contents: CResult_InMemorySignerDecodeErrorZPtr {
2935                         err: Box::into_raw(Box::new(e)),
2936                 },
2937                 result_ok: false,
2938         }
2939 }
2940 /// Checks if the given object is currently in the success state
2941 #[no_mangle]
2942 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
2943         o.result_ok
2944 }
2945 #[no_mangle]
2946 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
2947 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
2948 impl Drop for CResult_InMemorySignerDecodeErrorZ {
2949         fn drop(&mut self) {
2950                 if self.result_ok {
2951                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2952                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2953                         }
2954                 } else {
2955                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2956                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2957                         }
2958                 }
2959         }
2960 }
2961 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
2962         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2963                 let contents = if o.result_ok {
2964                         let result = unsafe { o.contents.result };
2965                         unsafe { o.contents.result = core::ptr::null_mut() };
2966                         CResult_InMemorySignerDecodeErrorZPtr { result }
2967                 } else {
2968                         let err = unsafe { o.contents.err };
2969                         unsafe { o.contents.err = core::ptr::null_mut(); }
2970                         CResult_InMemorySignerDecodeErrorZPtr { err }
2971                 };
2972                 Self {
2973                         contents,
2974                         result_ok: o.result_ok,
2975                 }
2976         }
2977 }
2978 impl Clone for CResult_InMemorySignerDecodeErrorZ {
2979         fn clone(&self) -> Self {
2980                 if self.result_ok {
2981                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
2982                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
2983                         } }
2984                 } else {
2985                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
2986                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2987                         } }
2988                 }
2989         }
2990 }
2991 #[no_mangle]
2992 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
2993 /// but with all dynamically-allocated buffers duplicated in new buffers.
2994 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
2995 #[repr(C)]
2996 /// The contents of CResult_TransactionNoneZ
2997 pub union CResult_TransactionNoneZPtr {
2998         /// A pointer to the contents in the success state.
2999         /// Reading from this pointer when `result_ok` is not set is undefined.
3000         pub result: *mut crate::c_types::Transaction,
3001         /// Note that this value is always NULL, as there are no contents in the Err variant
3002         pub err: *mut core::ffi::c_void,
3003 }
3004 #[repr(C)]
3005 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3006 /// containing a crate::c_types::Transaction on success and a () on failure.
3007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3008 pub struct CResult_TransactionNoneZ {
3009         /// The contents of this CResult_TransactionNoneZ, accessible via either
3010         /// `err` or `result` depending on the state of `result_ok`.
3011         pub contents: CResult_TransactionNoneZPtr,
3012         /// Whether this CResult_TransactionNoneZ represents a success state.
3013         pub result_ok: bool,
3014 }
3015 #[no_mangle]
3016 /// Creates a new CResult_TransactionNoneZ in the success state.
3017 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3018         CResult_TransactionNoneZ {
3019                 contents: CResult_TransactionNoneZPtr {
3020                         result: Box::into_raw(Box::new(o)),
3021                 },
3022                 result_ok: true,
3023         }
3024 }
3025 #[no_mangle]
3026 /// Creates a new CResult_TransactionNoneZ in the error state.
3027 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3028         CResult_TransactionNoneZ {
3029                 contents: CResult_TransactionNoneZPtr {
3030                         err: core::ptr::null_mut(),
3031                 },
3032                 result_ok: false,
3033         }
3034 }
3035 /// Checks if the given object is currently in the success state
3036 #[no_mangle]
3037 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3038         o.result_ok
3039 }
3040 #[no_mangle]
3041 /// Frees any resources used by the CResult_TransactionNoneZ.
3042 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3043 impl Drop for CResult_TransactionNoneZ {
3044         fn drop(&mut self) {
3045                 if self.result_ok {
3046                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3047                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3048                         }
3049                 } else {
3050                 }
3051         }
3052 }
3053 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3054         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3055                 let contents = if o.result_ok {
3056                         let result = unsafe { o.contents.result };
3057                         unsafe { o.contents.result = core::ptr::null_mut() };
3058                         CResult_TransactionNoneZPtr { result }
3059                 } else {
3060                         let _ = unsafe { Box::from_raw(o.contents.err) };
3061                         o.contents.err = core::ptr::null_mut();
3062                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3063                 };
3064                 Self {
3065                         contents,
3066                         result_ok: o.result_ok,
3067                 }
3068         }
3069 }
3070 impl Clone for CResult_TransactionNoneZ {
3071         fn clone(&self) -> Self {
3072                 if self.result_ok {
3073                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3074                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3075                         } }
3076                 } else {
3077                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3078                                 err: core::ptr::null_mut()
3079                         } }
3080                 }
3081         }
3082 }
3083 #[no_mangle]
3084 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3085 /// but with all dynamically-allocated buffers duplicated in new buffers.
3086 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3087 #[repr(C)]
3088 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3089 pub enum COption_WriteableScoreZ {
3090         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3091         Some(crate::lightning::routing::scoring::WriteableScore),
3092         /// When we're in this state, this COption_WriteableScoreZ contains nothing
3093         None
3094 }
3095 impl COption_WriteableScoreZ {
3096         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3097                 if let Self::None = self { false } else { true }
3098         }
3099         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3100                 !self.is_some()
3101         }
3102         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3103                 if let Self::Some(v) = self { v } else { unreachable!() }
3104         }
3105 }
3106 #[no_mangle]
3107 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3108 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3109         COption_WriteableScoreZ::Some(o)
3110 }
3111 #[no_mangle]
3112 /// Constructs a new COption_WriteableScoreZ containing nothing
3113 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3114         COption_WriteableScoreZ::None
3115 }
3116 #[no_mangle]
3117 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3118 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3119 #[repr(C)]
3120 /// The contents of CResult_NoneIOErrorZ
3121 pub union CResult_NoneIOErrorZPtr {
3122         /// Note that this value is always NULL, as there are no contents in the OK variant
3123         pub result: *mut core::ffi::c_void,
3124         /// A pointer to the contents in the error state.
3125         /// Reading from this pointer when `result_ok` is set is undefined.
3126         pub err: *mut crate::c_types::IOError,
3127 }
3128 #[repr(C)]
3129 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3130 /// containing a () on success and a crate::c_types::IOError on failure.
3131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3132 pub struct CResult_NoneIOErrorZ {
3133         /// The contents of this CResult_NoneIOErrorZ, accessible via either
3134         /// `err` or `result` depending on the state of `result_ok`.
3135         pub contents: CResult_NoneIOErrorZPtr,
3136         /// Whether this CResult_NoneIOErrorZ represents a success state.
3137         pub result_ok: bool,
3138 }
3139 #[no_mangle]
3140 /// Creates a new CResult_NoneIOErrorZ in the success state.
3141 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3142         CResult_NoneIOErrorZ {
3143                 contents: CResult_NoneIOErrorZPtr {
3144                         result: core::ptr::null_mut(),
3145                 },
3146                 result_ok: true,
3147         }
3148 }
3149 #[no_mangle]
3150 /// Creates a new CResult_NoneIOErrorZ in the error state.
3151 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3152         CResult_NoneIOErrorZ {
3153                 contents: CResult_NoneIOErrorZPtr {
3154                         err: Box::into_raw(Box::new(e)),
3155                 },
3156                 result_ok: false,
3157         }
3158 }
3159 /// Checks if the given object is currently in the success state
3160 #[no_mangle]
3161 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3162         o.result_ok
3163 }
3164 #[no_mangle]
3165 /// Frees any resources used by the CResult_NoneIOErrorZ.
3166 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3167 impl Drop for CResult_NoneIOErrorZ {
3168         fn drop(&mut self) {
3169                 if self.result_ok {
3170                 } else {
3171                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3172                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3173                         }
3174                 }
3175         }
3176 }
3177 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3178         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3179                 let contents = if o.result_ok {
3180                         let _ = unsafe { Box::from_raw(o.contents.result) };
3181                         o.contents.result = core::ptr::null_mut();
3182                         CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3183                 } else {
3184                         let err = unsafe { o.contents.err };
3185                         unsafe { o.contents.err = core::ptr::null_mut(); }
3186                         CResult_NoneIOErrorZPtr { err }
3187                 };
3188                 Self {
3189                         contents,
3190                         result_ok: o.result_ok,
3191                 }
3192         }
3193 }
3194 impl Clone for CResult_NoneIOErrorZ {
3195         fn clone(&self) -> Self {
3196                 if self.result_ok {
3197                         Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3198                                 result: core::ptr::null_mut()
3199                         } }
3200                 } else {
3201                         Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3202                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3203                         } }
3204                 }
3205         }
3206 }
3207 #[no_mangle]
3208 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3209 /// but with all dynamically-allocated buffers duplicated in new buffers.
3210 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3211 #[repr(C)]
3212 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3213 /// This corresponds to std::vector in C++
3214 pub struct CVec_ChannelDetailsZ {
3215         /// The elements in the array.
3216         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3217         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3218         /// The number of elements pointed to by `data`.
3219         pub datalen: usize
3220 }
3221 impl CVec_ChannelDetailsZ {
3222         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3223                 if self.datalen == 0 { return Vec::new(); }
3224                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3225                 self.data = core::ptr::null_mut();
3226                 self.datalen = 0;
3227                 ret
3228         }
3229         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3230                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3231         }
3232 }
3233 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3234         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3235                 let datalen = v.len();
3236                 let data = Box::into_raw(v.into_boxed_slice());
3237                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3238         }
3239 }
3240 #[no_mangle]
3241 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3242 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3243 impl Drop for CVec_ChannelDetailsZ {
3244         fn drop(&mut self) {
3245                 if self.datalen == 0 { return; }
3246                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3247         }
3248 }
3249 impl Clone for CVec_ChannelDetailsZ {
3250         fn clone(&self) -> Self {
3251                 let mut res = Vec::new();
3252                 if self.datalen == 0 { return Self::from(res); }
3253                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3254                 Self::from(res)
3255         }
3256 }
3257 #[repr(C)]
3258 /// The contents of CResult_RouteLightningErrorZ
3259 pub union CResult_RouteLightningErrorZPtr {
3260         /// A pointer to the contents in the success state.
3261         /// Reading from this pointer when `result_ok` is not set is undefined.
3262         pub result: *mut crate::lightning::routing::router::Route,
3263         /// A pointer to the contents in the error state.
3264         /// Reading from this pointer when `result_ok` is set is undefined.
3265         pub err: *mut crate::lightning::ln::msgs::LightningError,
3266 }
3267 #[repr(C)]
3268 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3269 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3271 pub struct CResult_RouteLightningErrorZ {
3272         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3273         /// `err` or `result` depending on the state of `result_ok`.
3274         pub contents: CResult_RouteLightningErrorZPtr,
3275         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3276         pub result_ok: bool,
3277 }
3278 #[no_mangle]
3279 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3280 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3281         CResult_RouteLightningErrorZ {
3282                 contents: CResult_RouteLightningErrorZPtr {
3283                         result: Box::into_raw(Box::new(o)),
3284                 },
3285                 result_ok: true,
3286         }
3287 }
3288 #[no_mangle]
3289 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3290 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3291         CResult_RouteLightningErrorZ {
3292                 contents: CResult_RouteLightningErrorZPtr {
3293                         err: Box::into_raw(Box::new(e)),
3294                 },
3295                 result_ok: false,
3296         }
3297 }
3298 /// Checks if the given object is currently in the success state
3299 #[no_mangle]
3300 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3301         o.result_ok
3302 }
3303 #[no_mangle]
3304 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3305 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3306 impl Drop for CResult_RouteLightningErrorZ {
3307         fn drop(&mut self) {
3308                 if self.result_ok {
3309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3311                         }
3312                 } else {
3313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3315                         }
3316                 }
3317         }
3318 }
3319 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3321                 let contents = if o.result_ok {
3322                         let result = unsafe { o.contents.result };
3323                         unsafe { o.contents.result = core::ptr::null_mut() };
3324                         CResult_RouteLightningErrorZPtr { result }
3325                 } else {
3326                         let err = unsafe { o.contents.err };
3327                         unsafe { o.contents.err = core::ptr::null_mut(); }
3328                         CResult_RouteLightningErrorZPtr { err }
3329                 };
3330                 Self {
3331                         contents,
3332                         result_ok: o.result_ok,
3333                 }
3334         }
3335 }
3336 impl Clone for CResult_RouteLightningErrorZ {
3337         fn clone(&self) -> Self {
3338                 if self.result_ok {
3339                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3340                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3341                         } }
3342                 } else {
3343                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3345                         } }
3346                 }
3347         }
3348 }
3349 #[no_mangle]
3350 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3351 /// but with all dynamically-allocated buffers duplicated in new buffers.
3352 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3353 #[repr(C)]
3354 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3355 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3356         /// A pointer to the contents in the success state.
3357         /// Reading from this pointer when `result_ok` is not set is undefined.
3358         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3359         /// A pointer to the contents in the error state.
3360         /// Reading from this pointer when `result_ok` is set is undefined.
3361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3362 }
3363 #[repr(C)]
3364 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3365 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3367 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3368         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3369         /// `err` or `result` depending on the state of `result_ok`.
3370         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3371         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3372         pub result_ok: bool,
3373 }
3374 #[no_mangle]
3375 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3376 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3377         CResult_InFlightHtlcsDecodeErrorZ {
3378                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3379                         result: Box::into_raw(Box::new(o)),
3380                 },
3381                 result_ok: true,
3382         }
3383 }
3384 #[no_mangle]
3385 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3386 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3387         CResult_InFlightHtlcsDecodeErrorZ {
3388                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3389                         err: Box::into_raw(Box::new(e)),
3390                 },
3391                 result_ok: false,
3392         }
3393 }
3394 /// Checks if the given object is currently in the success state
3395 #[no_mangle]
3396 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3397         o.result_ok
3398 }
3399 #[no_mangle]
3400 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3401 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3402 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3403         fn drop(&mut self) {
3404                 if self.result_ok {
3405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3407                         }
3408                 } else {
3409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3411                         }
3412                 }
3413         }
3414 }
3415 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3417                 let contents = if o.result_ok {
3418                         let result = unsafe { o.contents.result };
3419                         unsafe { o.contents.result = core::ptr::null_mut() };
3420                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
3421                 } else {
3422                         let err = unsafe { o.contents.err };
3423                         unsafe { o.contents.err = core::ptr::null_mut(); }
3424                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
3425                 };
3426                 Self {
3427                         contents,
3428                         result_ok: o.result_ok,
3429                 }
3430         }
3431 }
3432 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3433         fn clone(&self) -> Self {
3434                 if self.result_ok {
3435                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3436                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3437                         } }
3438                 } else {
3439                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3441                         } }
3442                 }
3443         }
3444 }
3445 #[no_mangle]
3446 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3447 /// but with all dynamically-allocated buffers duplicated in new buffers.
3448 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3449 #[repr(C)]
3450 /// The contents of CResult_RouteHopDecodeErrorZ
3451 pub union CResult_RouteHopDecodeErrorZPtr {
3452         /// A pointer to the contents in the success state.
3453         /// Reading from this pointer when `result_ok` is not set is undefined.
3454         pub result: *mut crate::lightning::routing::router::RouteHop,
3455         /// A pointer to the contents in the error state.
3456         /// Reading from this pointer when `result_ok` is set is undefined.
3457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3458 }
3459 #[repr(C)]
3460 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3461 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3463 pub struct CResult_RouteHopDecodeErrorZ {
3464         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3465         /// `err` or `result` depending on the state of `result_ok`.
3466         pub contents: CResult_RouteHopDecodeErrorZPtr,
3467         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3468         pub result_ok: bool,
3469 }
3470 #[no_mangle]
3471 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3472 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3473         CResult_RouteHopDecodeErrorZ {
3474                 contents: CResult_RouteHopDecodeErrorZPtr {
3475                         result: Box::into_raw(Box::new(o)),
3476                 },
3477                 result_ok: true,
3478         }
3479 }
3480 #[no_mangle]
3481 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3482 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3483         CResult_RouteHopDecodeErrorZ {
3484                 contents: CResult_RouteHopDecodeErrorZPtr {
3485                         err: Box::into_raw(Box::new(e)),
3486                 },
3487                 result_ok: false,
3488         }
3489 }
3490 /// Checks if the given object is currently in the success state
3491 #[no_mangle]
3492 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3493         o.result_ok
3494 }
3495 #[no_mangle]
3496 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3497 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3498 impl Drop for CResult_RouteHopDecodeErrorZ {
3499         fn drop(&mut self) {
3500                 if self.result_ok {
3501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3503                         }
3504                 } else {
3505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3507                         }
3508                 }
3509         }
3510 }
3511 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3513                 let contents = if o.result_ok {
3514                         let result = unsafe { o.contents.result };
3515                         unsafe { o.contents.result = core::ptr::null_mut() };
3516                         CResult_RouteHopDecodeErrorZPtr { result }
3517                 } else {
3518                         let err = unsafe { o.contents.err };
3519                         unsafe { o.contents.err = core::ptr::null_mut(); }
3520                         CResult_RouteHopDecodeErrorZPtr { err }
3521                 };
3522                 Self {
3523                         contents,
3524                         result_ok: o.result_ok,
3525                 }
3526         }
3527 }
3528 impl Clone for CResult_RouteHopDecodeErrorZ {
3529         fn clone(&self) -> Self {
3530                 if self.result_ok {
3531                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3532                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3533                         } }
3534                 } else {
3535                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3537                         } }
3538                 }
3539         }
3540 }
3541 #[no_mangle]
3542 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3543 /// but with all dynamically-allocated buffers duplicated in new buffers.
3544 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3545 #[repr(C)]
3546 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3547 /// This corresponds to std::vector in C++
3548 pub struct CVec_BlindedHopZ {
3549         /// The elements in the array.
3550         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3551         pub data: *mut crate::lightning::blinded_path::BlindedHop,
3552         /// The number of elements pointed to by `data`.
3553         pub datalen: usize
3554 }
3555 impl CVec_BlindedHopZ {
3556         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3557                 if self.datalen == 0 { return Vec::new(); }
3558                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3559                 self.data = core::ptr::null_mut();
3560                 self.datalen = 0;
3561                 ret
3562         }
3563         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3564                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3565         }
3566 }
3567 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3568         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3569                 let datalen = v.len();
3570                 let data = Box::into_raw(v.into_boxed_slice());
3571                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3572         }
3573 }
3574 #[no_mangle]
3575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3576 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3577 impl Drop for CVec_BlindedHopZ {
3578         fn drop(&mut self) {
3579                 if self.datalen == 0 { return; }
3580                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3581         }
3582 }
3583 impl Clone for CVec_BlindedHopZ {
3584         fn clone(&self) -> Self {
3585                 let mut res = Vec::new();
3586                 if self.datalen == 0 { return Self::from(res); }
3587                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3588                 Self::from(res)
3589         }
3590 }
3591 #[repr(C)]
3592 /// The contents of CResult_BlindedTailDecodeErrorZ
3593 pub union CResult_BlindedTailDecodeErrorZPtr {
3594         /// A pointer to the contents in the success state.
3595         /// Reading from this pointer when `result_ok` is not set is undefined.
3596         pub result: *mut crate::lightning::routing::router::BlindedTail,
3597         /// A pointer to the contents in the error state.
3598         /// Reading from this pointer when `result_ok` is set is undefined.
3599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3600 }
3601 #[repr(C)]
3602 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3603 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3605 pub struct CResult_BlindedTailDecodeErrorZ {
3606         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3607         /// `err` or `result` depending on the state of `result_ok`.
3608         pub contents: CResult_BlindedTailDecodeErrorZPtr,
3609         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3610         pub result_ok: bool,
3611 }
3612 #[no_mangle]
3613 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3614 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3615         CResult_BlindedTailDecodeErrorZ {
3616                 contents: CResult_BlindedTailDecodeErrorZPtr {
3617                         result: Box::into_raw(Box::new(o)),
3618                 },
3619                 result_ok: true,
3620         }
3621 }
3622 #[no_mangle]
3623 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3624 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3625         CResult_BlindedTailDecodeErrorZ {
3626                 contents: CResult_BlindedTailDecodeErrorZPtr {
3627                         err: Box::into_raw(Box::new(e)),
3628                 },
3629                 result_ok: false,
3630         }
3631 }
3632 /// Checks if the given object is currently in the success state
3633 #[no_mangle]
3634 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3635         o.result_ok
3636 }
3637 #[no_mangle]
3638 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3639 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3640 impl Drop for CResult_BlindedTailDecodeErrorZ {
3641         fn drop(&mut self) {
3642                 if self.result_ok {
3643                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3644                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3645                         }
3646                 } else {
3647                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3648                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3649                         }
3650                 }
3651         }
3652 }
3653 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3654         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3655                 let contents = if o.result_ok {
3656                         let result = unsafe { o.contents.result };
3657                         unsafe { o.contents.result = core::ptr::null_mut() };
3658                         CResult_BlindedTailDecodeErrorZPtr { result }
3659                 } else {
3660                         let err = unsafe { o.contents.err };
3661                         unsafe { o.contents.err = core::ptr::null_mut(); }
3662                         CResult_BlindedTailDecodeErrorZPtr { err }
3663                 };
3664                 Self {
3665                         contents,
3666                         result_ok: o.result_ok,
3667                 }
3668         }
3669 }
3670 impl Clone for CResult_BlindedTailDecodeErrorZ {
3671         fn clone(&self) -> Self {
3672                 if self.result_ok {
3673                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3674                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3675                         } }
3676                 } else {
3677                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3678                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3679                         } }
3680                 }
3681         }
3682 }
3683 #[no_mangle]
3684 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3685 /// but with all dynamically-allocated buffers duplicated in new buffers.
3686 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3687 #[repr(C)]
3688 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3689 /// This corresponds to std::vector in C++
3690 pub struct CVec_RouteHopZ {
3691         /// The elements in the array.
3692         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3693         pub data: *mut crate::lightning::routing::router::RouteHop,
3694         /// The number of elements pointed to by `data`.
3695         pub datalen: usize
3696 }
3697 impl CVec_RouteHopZ {
3698         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3699                 if self.datalen == 0 { return Vec::new(); }
3700                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3701                 self.data = core::ptr::null_mut();
3702                 self.datalen = 0;
3703                 ret
3704         }
3705         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3706                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3707         }
3708 }
3709 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3710         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3711                 let datalen = v.len();
3712                 let data = Box::into_raw(v.into_boxed_slice());
3713                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3714         }
3715 }
3716 #[no_mangle]
3717 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3718 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3719 impl Drop for CVec_RouteHopZ {
3720         fn drop(&mut self) {
3721                 if self.datalen == 0 { return; }
3722                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3723         }
3724 }
3725 impl Clone for CVec_RouteHopZ {
3726         fn clone(&self) -> Self {
3727                 let mut res = Vec::new();
3728                 if self.datalen == 0 { return Self::from(res); }
3729                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3730                 Self::from(res)
3731         }
3732 }
3733 #[repr(C)]
3734 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3735 /// This corresponds to std::vector in C++
3736 pub struct CVec_PathZ {
3737         /// The elements in the array.
3738         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3739         pub data: *mut crate::lightning::routing::router::Path,
3740         /// The number of elements pointed to by `data`.
3741         pub datalen: usize
3742 }
3743 impl CVec_PathZ {
3744         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3745                 if self.datalen == 0 { return Vec::new(); }
3746                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3747                 self.data = core::ptr::null_mut();
3748                 self.datalen = 0;
3749                 ret
3750         }
3751         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3752                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3753         }
3754 }
3755 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3756         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3757                 let datalen = v.len();
3758                 let data = Box::into_raw(v.into_boxed_slice());
3759                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3760         }
3761 }
3762 #[no_mangle]
3763 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3764 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3765 impl Drop for CVec_PathZ {
3766         fn drop(&mut self) {
3767                 if self.datalen == 0 { return; }
3768                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3769         }
3770 }
3771 impl Clone for CVec_PathZ {
3772         fn clone(&self) -> Self {
3773                 let mut res = Vec::new();
3774                 if self.datalen == 0 { return Self::from(res); }
3775                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3776                 Self::from(res)
3777         }
3778 }
3779 #[repr(C)]
3780 /// The contents of CResult_RouteDecodeErrorZ
3781 pub union CResult_RouteDecodeErrorZPtr {
3782         /// A pointer to the contents in the success state.
3783         /// Reading from this pointer when `result_ok` is not set is undefined.
3784         pub result: *mut crate::lightning::routing::router::Route,
3785         /// A pointer to the contents in the error state.
3786         /// Reading from this pointer when `result_ok` is set is undefined.
3787         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3788 }
3789 #[repr(C)]
3790 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3791 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3793 pub struct CResult_RouteDecodeErrorZ {
3794         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3795         /// `err` or `result` depending on the state of `result_ok`.
3796         pub contents: CResult_RouteDecodeErrorZPtr,
3797         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3798         pub result_ok: bool,
3799 }
3800 #[no_mangle]
3801 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3802 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3803         CResult_RouteDecodeErrorZ {
3804                 contents: CResult_RouteDecodeErrorZPtr {
3805                         result: Box::into_raw(Box::new(o)),
3806                 },
3807                 result_ok: true,
3808         }
3809 }
3810 #[no_mangle]
3811 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3812 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3813         CResult_RouteDecodeErrorZ {
3814                 contents: CResult_RouteDecodeErrorZPtr {
3815                         err: Box::into_raw(Box::new(e)),
3816                 },
3817                 result_ok: false,
3818         }
3819 }
3820 /// Checks if the given object is currently in the success state
3821 #[no_mangle]
3822 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
3823         o.result_ok
3824 }
3825 #[no_mangle]
3826 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3827 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3828 impl Drop for CResult_RouteDecodeErrorZ {
3829         fn drop(&mut self) {
3830                 if self.result_ok {
3831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3833                         }
3834                 } else {
3835                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3836                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3837                         }
3838                 }
3839         }
3840 }
3841 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3842         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3843                 let contents = if o.result_ok {
3844                         let result = unsafe { o.contents.result };
3845                         unsafe { o.contents.result = core::ptr::null_mut() };
3846                         CResult_RouteDecodeErrorZPtr { result }
3847                 } else {
3848                         let err = unsafe { o.contents.err };
3849                         unsafe { o.contents.err = core::ptr::null_mut(); }
3850                         CResult_RouteDecodeErrorZPtr { err }
3851                 };
3852                 Self {
3853                         contents,
3854                         result_ok: o.result_ok,
3855                 }
3856         }
3857 }
3858 impl Clone for CResult_RouteDecodeErrorZ {
3859         fn clone(&self) -> Self {
3860                 if self.result_ok {
3861                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3862                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3863                         } }
3864                 } else {
3865                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3866                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3867                         } }
3868                 }
3869         }
3870 }
3871 #[no_mangle]
3872 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3873 /// but with all dynamically-allocated buffers duplicated in new buffers.
3874 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
3875 #[repr(C)]
3876 /// The contents of CResult_RouteParametersDecodeErrorZ
3877 pub union CResult_RouteParametersDecodeErrorZPtr {
3878         /// A pointer to the contents in the success state.
3879         /// Reading from this pointer when `result_ok` is not set is undefined.
3880         pub result: *mut crate::lightning::routing::router::RouteParameters,
3881         /// A pointer to the contents in the error state.
3882         /// Reading from this pointer when `result_ok` is set is undefined.
3883         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3884 }
3885 #[repr(C)]
3886 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
3887 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3889 pub struct CResult_RouteParametersDecodeErrorZ {
3890         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
3891         /// `err` or `result` depending on the state of `result_ok`.
3892         pub contents: CResult_RouteParametersDecodeErrorZPtr,
3893         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
3894         pub result_ok: bool,
3895 }
3896 #[no_mangle]
3897 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
3898 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
3899         CResult_RouteParametersDecodeErrorZ {
3900                 contents: CResult_RouteParametersDecodeErrorZPtr {
3901                         result: Box::into_raw(Box::new(o)),
3902                 },
3903                 result_ok: true,
3904         }
3905 }
3906 #[no_mangle]
3907 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
3908 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
3909         CResult_RouteParametersDecodeErrorZ {
3910                 contents: CResult_RouteParametersDecodeErrorZPtr {
3911                         err: Box::into_raw(Box::new(e)),
3912                 },
3913                 result_ok: false,
3914         }
3915 }
3916 /// Checks if the given object is currently in the success state
3917 #[no_mangle]
3918 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
3919         o.result_ok
3920 }
3921 #[no_mangle]
3922 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
3923 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
3924 impl Drop for CResult_RouteParametersDecodeErrorZ {
3925         fn drop(&mut self) {
3926                 if self.result_ok {
3927                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3928                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3929                         }
3930                 } else {
3931                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3932                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3933                         }
3934                 }
3935         }
3936 }
3937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
3938         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3939                 let contents = if o.result_ok {
3940                         let result = unsafe { o.contents.result };
3941                         unsafe { o.contents.result = core::ptr::null_mut() };
3942                         CResult_RouteParametersDecodeErrorZPtr { result }
3943                 } else {
3944                         let err = unsafe { o.contents.err };
3945                         unsafe { o.contents.err = core::ptr::null_mut(); }
3946                         CResult_RouteParametersDecodeErrorZPtr { err }
3947                 };
3948                 Self {
3949                         contents,
3950                         result_ok: o.result_ok,
3951                 }
3952         }
3953 }
3954 impl Clone for CResult_RouteParametersDecodeErrorZ {
3955         fn clone(&self) -> Self {
3956                 if self.result_ok {
3957                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
3958                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
3959                         } }
3960                 } else {
3961                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
3962                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3963                         } }
3964                 }
3965         }
3966 }
3967 #[no_mangle]
3968 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3969 /// but with all dynamically-allocated buffers duplicated in new buffers.
3970 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3971 #[repr(C)]
3972 /// A dynamically-allocated array of u64s of arbitrary size.
3973 /// This corresponds to std::vector in C++
3974 pub struct CVec_u64Z {
3975         /// The elements in the array.
3976         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3977         pub data: *mut u64,
3978         /// The number of elements pointed to by `data`.
3979         pub datalen: usize
3980 }
3981 impl CVec_u64Z {
3982         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3983                 if self.datalen == 0 { return Vec::new(); }
3984                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3985                 self.data = core::ptr::null_mut();
3986                 self.datalen = 0;
3987                 ret
3988         }
3989         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3990                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3991         }
3992 }
3993 impl From<Vec<u64>> for CVec_u64Z {
3994         fn from(v: Vec<u64>) -> Self {
3995                 let datalen = v.len();
3996                 let data = Box::into_raw(v.into_boxed_slice());
3997                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3998         }
3999 }
4000 #[no_mangle]
4001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4002 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4003 impl Drop for CVec_u64Z {
4004         fn drop(&mut self) {
4005                 if self.datalen == 0 { return; }
4006                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4007         }
4008 }
4009 impl Clone for CVec_u64Z {
4010         fn clone(&self) -> Self {
4011                 let mut res = Vec::new();
4012                 if self.datalen == 0 { return Self::from(res); }
4013                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4014                 Self::from(res)
4015         }
4016 }
4017 #[repr(C)]
4018 /// The contents of CResult_PaymentParametersDecodeErrorZ
4019 pub union CResult_PaymentParametersDecodeErrorZPtr {
4020         /// A pointer to the contents in the success state.
4021         /// Reading from this pointer when `result_ok` is not set is undefined.
4022         pub result: *mut crate::lightning::routing::router::PaymentParameters,
4023         /// A pointer to the contents in the error state.
4024         /// Reading from this pointer when `result_ok` is set is undefined.
4025         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4026 }
4027 #[repr(C)]
4028 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4029 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4031 pub struct CResult_PaymentParametersDecodeErrorZ {
4032         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4033         /// `err` or `result` depending on the state of `result_ok`.
4034         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4035         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4036         pub result_ok: bool,
4037 }
4038 #[no_mangle]
4039 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4040 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4041         CResult_PaymentParametersDecodeErrorZ {
4042                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4043                         result: Box::into_raw(Box::new(o)),
4044                 },
4045                 result_ok: true,
4046         }
4047 }
4048 #[no_mangle]
4049 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4050 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4051         CResult_PaymentParametersDecodeErrorZ {
4052                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4053                         err: Box::into_raw(Box::new(e)),
4054                 },
4055                 result_ok: false,
4056         }
4057 }
4058 /// Checks if the given object is currently in the success state
4059 #[no_mangle]
4060 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4061         o.result_ok
4062 }
4063 #[no_mangle]
4064 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4065 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4066 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4067         fn drop(&mut self) {
4068                 if self.result_ok {
4069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4071                         }
4072                 } else {
4073                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4074                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4075                         }
4076                 }
4077         }
4078 }
4079 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4080         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4081                 let contents = if o.result_ok {
4082                         let result = unsafe { o.contents.result };
4083                         unsafe { o.contents.result = core::ptr::null_mut() };
4084                         CResult_PaymentParametersDecodeErrorZPtr { result }
4085                 } else {
4086                         let err = unsafe { o.contents.err };
4087                         unsafe { o.contents.err = core::ptr::null_mut(); }
4088                         CResult_PaymentParametersDecodeErrorZPtr { err }
4089                 };
4090                 Self {
4091                         contents,
4092                         result_ok: o.result_ok,
4093                 }
4094         }
4095 }
4096 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4097         fn clone(&self) -> Self {
4098                 if self.result_ok {
4099                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4100                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4101                         } }
4102                 } else {
4103                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4104                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4105                         } }
4106                 }
4107         }
4108 }
4109 #[no_mangle]
4110 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4111 /// but with all dynamically-allocated buffers duplicated in new buffers.
4112 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4113 #[repr(C)]
4114 /// A tuple of 2 elements. See the individual fields for the types contained.
4115 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
4116         /// The element at position 0
4117         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
4118         /// The element at position 1
4119         pub b: crate::lightning::blinded_path::BlindedPath,
4120 }
4121 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
4122         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
4123                 Self {
4124                         a: tup.0,
4125                         b: tup.1,
4126                 }
4127         }
4128 }
4129 impl C2Tuple_BlindedPayInfoBlindedPathZ {
4130         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
4131                 (self.a, self.b)
4132         }
4133 }
4134 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
4135         fn clone(&self) -> Self {
4136                 Self {
4137                         a: Clone::clone(&self.a),
4138                         b: Clone::clone(&self.b),
4139                 }
4140         }
4141 }
4142 #[no_mangle]
4143 /// Creates a new tuple which has the same data as `orig`
4144 /// but with all dynamically-allocated buffers duplicated in new buffers.
4145 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
4146 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
4147 #[no_mangle]
4148 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
4149         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
4150 }
4151
4152 #[no_mangle]
4153 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
4154 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
4155 #[repr(C)]
4156 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4157 /// This corresponds to std::vector in C++
4158 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4159         /// The elements in the array.
4160         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4161         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4162         /// The number of elements pointed to by `data`.
4163         pub datalen: usize
4164 }
4165 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4166         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4167                 if self.datalen == 0 { return Vec::new(); }
4168                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4169                 self.data = core::ptr::null_mut();
4170                 self.datalen = 0;
4171                 ret
4172         }
4173         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4174                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4175         }
4176 }
4177 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4178         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4179                 let datalen = v.len();
4180                 let data = Box::into_raw(v.into_boxed_slice());
4181                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4182         }
4183 }
4184 #[no_mangle]
4185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4186 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4187 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4188         fn drop(&mut self) {
4189                 if self.datalen == 0 { return; }
4190                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4191         }
4192 }
4193 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4194         fn clone(&self) -> Self {
4195                 let mut res = Vec::new();
4196                 if self.datalen == 0 { return Self::from(res); }
4197                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4198                 Self::from(res)
4199         }
4200 }
4201 #[repr(C)]
4202 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4203 /// This corresponds to std::vector in C++
4204 pub struct CVec_RouteHintZ {
4205         /// The elements in the array.
4206         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4207         pub data: *mut crate::lightning::routing::router::RouteHint,
4208         /// The number of elements pointed to by `data`.
4209         pub datalen: usize
4210 }
4211 impl CVec_RouteHintZ {
4212         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4213                 if self.datalen == 0 { return Vec::new(); }
4214                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4215                 self.data = core::ptr::null_mut();
4216                 self.datalen = 0;
4217                 ret
4218         }
4219         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4220                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4221         }
4222 }
4223 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4224         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4225                 let datalen = v.len();
4226                 let data = Box::into_raw(v.into_boxed_slice());
4227                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4228         }
4229 }
4230 #[no_mangle]
4231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4232 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4233 impl Drop for CVec_RouteHintZ {
4234         fn drop(&mut self) {
4235                 if self.datalen == 0 { return; }
4236                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4237         }
4238 }
4239 impl Clone for CVec_RouteHintZ {
4240         fn clone(&self) -> Self {
4241                 let mut res = Vec::new();
4242                 if self.datalen == 0 { return Self::from(res); }
4243                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4244                 Self::from(res)
4245         }
4246 }
4247 #[repr(C)]
4248 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4249 /// This corresponds to std::vector in C++
4250 pub struct CVec_RouteHintHopZ {
4251         /// The elements in the array.
4252         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4253         pub data: *mut crate::lightning::routing::router::RouteHintHop,
4254         /// The number of elements pointed to by `data`.
4255         pub datalen: usize
4256 }
4257 impl CVec_RouteHintHopZ {
4258         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4259                 if self.datalen == 0 { return Vec::new(); }
4260                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4261                 self.data = core::ptr::null_mut();
4262                 self.datalen = 0;
4263                 ret
4264         }
4265         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4266                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4267         }
4268 }
4269 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4270         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4271                 let datalen = v.len();
4272                 let data = Box::into_raw(v.into_boxed_slice());
4273                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4274         }
4275 }
4276 #[no_mangle]
4277 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4278 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4279 impl Drop for CVec_RouteHintHopZ {
4280         fn drop(&mut self) {
4281                 if self.datalen == 0 { return; }
4282                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4283         }
4284 }
4285 impl Clone for CVec_RouteHintHopZ {
4286         fn clone(&self) -> Self {
4287                 let mut res = Vec::new();
4288                 if self.datalen == 0 { return Self::from(res); }
4289                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4290                 Self::from(res)
4291         }
4292 }
4293 #[repr(C)]
4294 /// The contents of CResult_RouteHintDecodeErrorZ
4295 pub union CResult_RouteHintDecodeErrorZPtr {
4296         /// A pointer to the contents in the success state.
4297         /// Reading from this pointer when `result_ok` is not set is undefined.
4298         pub result: *mut crate::lightning::routing::router::RouteHint,
4299         /// A pointer to the contents in the error state.
4300         /// Reading from this pointer when `result_ok` is set is undefined.
4301         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4302 }
4303 #[repr(C)]
4304 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_RouteHintDecodeErrorZ {
4308         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4309         /// `err` or `result` depending on the state of `result_ok`.
4310         pub contents: CResult_RouteHintDecodeErrorZPtr,
4311         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4312         pub result_ok: bool,
4313 }
4314 #[no_mangle]
4315 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4317         CResult_RouteHintDecodeErrorZ {
4318                 contents: CResult_RouteHintDecodeErrorZPtr {
4319                         result: Box::into_raw(Box::new(o)),
4320                 },
4321                 result_ok: true,
4322         }
4323 }
4324 #[no_mangle]
4325 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4327         CResult_RouteHintDecodeErrorZ {
4328                 contents: CResult_RouteHintDecodeErrorZPtr {
4329                         err: Box::into_raw(Box::new(e)),
4330                 },
4331                 result_ok: false,
4332         }
4333 }
4334 /// Checks if the given object is currently in the success state
4335 #[no_mangle]
4336 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4337         o.result_ok
4338 }
4339 #[no_mangle]
4340 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4341 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4342 impl Drop for CResult_RouteHintDecodeErrorZ {
4343         fn drop(&mut self) {
4344                 if self.result_ok {
4345                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4347                         }
4348                 } else {
4349                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4351                         }
4352                 }
4353         }
4354 }
4355 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4356         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357                 let contents = if o.result_ok {
4358                         let result = unsafe { o.contents.result };
4359                         unsafe { o.contents.result = core::ptr::null_mut() };
4360                         CResult_RouteHintDecodeErrorZPtr { result }
4361                 } else {
4362                         let err = unsafe { o.contents.err };
4363                         unsafe { o.contents.err = core::ptr::null_mut(); }
4364                         CResult_RouteHintDecodeErrorZPtr { err }
4365                 };
4366                 Self {
4367                         contents,
4368                         result_ok: o.result_ok,
4369                 }
4370         }
4371 }
4372 impl Clone for CResult_RouteHintDecodeErrorZ {
4373         fn clone(&self) -> Self {
4374                 if self.result_ok {
4375                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4376                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4377                         } }
4378                 } else {
4379                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4380                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4381                         } }
4382                 }
4383         }
4384 }
4385 #[no_mangle]
4386 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4387 /// but with all dynamically-allocated buffers duplicated in new buffers.
4388 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4389 #[repr(C)]
4390 /// The contents of CResult_RouteHintHopDecodeErrorZ
4391 pub union CResult_RouteHintHopDecodeErrorZPtr {
4392         /// A pointer to the contents in the success state.
4393         /// Reading from this pointer when `result_ok` is not set is undefined.
4394         pub result: *mut crate::lightning::routing::router::RouteHintHop,
4395         /// A pointer to the contents in the error state.
4396         /// Reading from this pointer when `result_ok` is set is undefined.
4397         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4398 }
4399 #[repr(C)]
4400 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4401 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4402 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4403 pub struct CResult_RouteHintHopDecodeErrorZ {
4404         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4405         /// `err` or `result` depending on the state of `result_ok`.
4406         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4407         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4408         pub result_ok: bool,
4409 }
4410 #[no_mangle]
4411 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4412 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4413         CResult_RouteHintHopDecodeErrorZ {
4414                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4415                         result: Box::into_raw(Box::new(o)),
4416                 },
4417                 result_ok: true,
4418         }
4419 }
4420 #[no_mangle]
4421 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4422 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4423         CResult_RouteHintHopDecodeErrorZ {
4424                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4425                         err: Box::into_raw(Box::new(e)),
4426                 },
4427                 result_ok: false,
4428         }
4429 }
4430 /// Checks if the given object is currently in the success state
4431 #[no_mangle]
4432 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4433         o.result_ok
4434 }
4435 #[no_mangle]
4436 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4437 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4438 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4439         fn drop(&mut self) {
4440                 if self.result_ok {
4441                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4442                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4443                         }
4444                 } else {
4445                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4446                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4447                         }
4448                 }
4449         }
4450 }
4451 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4452         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4453                 let contents = if o.result_ok {
4454                         let result = unsafe { o.contents.result };
4455                         unsafe { o.contents.result = core::ptr::null_mut() };
4456                         CResult_RouteHintHopDecodeErrorZPtr { result }
4457                 } else {
4458                         let err = unsafe { o.contents.err };
4459                         unsafe { o.contents.err = core::ptr::null_mut(); }
4460                         CResult_RouteHintHopDecodeErrorZPtr { err }
4461                 };
4462                 Self {
4463                         contents,
4464                         result_ok: o.result_ok,
4465                 }
4466         }
4467 }
4468 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4469         fn clone(&self) -> Self {
4470                 if self.result_ok {
4471                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4472                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4473                         } }
4474                 } else {
4475                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4476                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4477                         } }
4478                 }
4479         }
4480 }
4481 #[no_mangle]
4482 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4483 /// but with all dynamically-allocated buffers duplicated in new buffers.
4484 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4485 #[repr(C)]
4486 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4487 /// This corresponds to std::vector in C++
4488 pub struct CVec_PublicKeyZ {
4489         /// The elements in the array.
4490         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4491         pub data: *mut crate::c_types::PublicKey,
4492         /// The number of elements pointed to by `data`.
4493         pub datalen: usize
4494 }
4495 impl CVec_PublicKeyZ {
4496         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4497                 if self.datalen == 0 { return Vec::new(); }
4498                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4499                 self.data = core::ptr::null_mut();
4500                 self.datalen = 0;
4501                 ret
4502         }
4503         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4504                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4505         }
4506 }
4507 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4508         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4509                 let datalen = v.len();
4510                 let data = Box::into_raw(v.into_boxed_slice());
4511                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4512         }
4513 }
4514 #[no_mangle]
4515 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4516 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4517 impl Drop for CVec_PublicKeyZ {
4518         fn drop(&mut self) {
4519                 if self.datalen == 0 { return; }
4520                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4521         }
4522 }
4523 impl Clone for CVec_PublicKeyZ {
4524         fn clone(&self) -> Self {
4525                 let mut res = Vec::new();
4526                 if self.datalen == 0 { return Self::from(res); }
4527                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4528                 Self::from(res)
4529         }
4530 }
4531 #[repr(C)]
4532 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4533 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4534         /// A pointer to the contents in the success state.
4535         /// Reading from this pointer when `result_ok` is not set is undefined.
4536         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4537         /// A pointer to the contents in the error state.
4538         /// Reading from this pointer when `result_ok` is set is undefined.
4539         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4540 }
4541 #[repr(C)]
4542 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4543 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4544 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4545 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4546         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4547         /// `err` or `result` depending on the state of `result_ok`.
4548         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4549         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4550         pub result_ok: bool,
4551 }
4552 #[no_mangle]
4553 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4554 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4555         CResult_FixedPenaltyScorerDecodeErrorZ {
4556                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4557                         result: Box::into_raw(Box::new(o)),
4558                 },
4559                 result_ok: true,
4560         }
4561 }
4562 #[no_mangle]
4563 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4564 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4565         CResult_FixedPenaltyScorerDecodeErrorZ {
4566                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4567                         err: Box::into_raw(Box::new(e)),
4568                 },
4569                 result_ok: false,
4570         }
4571 }
4572 /// Checks if the given object is currently in the success state
4573 #[no_mangle]
4574 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4575         o.result_ok
4576 }
4577 #[no_mangle]
4578 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4579 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4580 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4581         fn drop(&mut self) {
4582                 if self.result_ok {
4583                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4584                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4585                         }
4586                 } else {
4587                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4588                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4589                         }
4590                 }
4591         }
4592 }
4593 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4594         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4595                 let contents = if o.result_ok {
4596                         let result = unsafe { o.contents.result };
4597                         unsafe { o.contents.result = core::ptr::null_mut() };
4598                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4599                 } else {
4600                         let err = unsafe { o.contents.err };
4601                         unsafe { o.contents.err = core::ptr::null_mut(); }
4602                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4603                 };
4604                 Self {
4605                         contents,
4606                         result_ok: o.result_ok,
4607                 }
4608         }
4609 }
4610 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4611         fn clone(&self) -> Self {
4612                 if self.result_ok {
4613                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4614                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4615                         } }
4616                 } else {
4617                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4618                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4619                         } }
4620                 }
4621         }
4622 }
4623 #[no_mangle]
4624 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4625 /// but with all dynamically-allocated buffers duplicated in new buffers.
4626 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4627 #[repr(C)]
4628 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4629 /// This corresponds to std::vector in C++
4630 pub struct CVec_NodeIdZ {
4631         /// The elements in the array.
4632         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4633         pub data: *mut crate::lightning::routing::gossip::NodeId,
4634         /// The number of elements pointed to by `data`.
4635         pub datalen: usize
4636 }
4637 impl CVec_NodeIdZ {
4638         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4639                 if self.datalen == 0 { return Vec::new(); }
4640                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4641                 self.data = core::ptr::null_mut();
4642                 self.datalen = 0;
4643                 ret
4644         }
4645         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4646                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4647         }
4648 }
4649 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4650         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4651                 let datalen = v.len();
4652                 let data = Box::into_raw(v.into_boxed_slice());
4653                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4654         }
4655 }
4656 #[no_mangle]
4657 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4658 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4659 impl Drop for CVec_NodeIdZ {
4660         fn drop(&mut self) {
4661                 if self.datalen == 0 { return; }
4662                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4663         }
4664 }
4665 impl Clone for CVec_NodeIdZ {
4666         fn clone(&self) -> Self {
4667                 let mut res = Vec::new();
4668                 if self.datalen == 0 { return Self::from(res); }
4669                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4670                 Self::from(res)
4671         }
4672 }
4673 #[repr(C)]
4674 /// A tuple of 2 elements. See the individual fields for the types contained.
4675 pub struct C2Tuple_u64u64Z {
4676         /// The element at position 0
4677         pub a: u64,
4678         /// The element at position 1
4679         pub b: u64,
4680 }
4681 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4682         fn from (tup: (u64, u64)) -> Self {
4683                 Self {
4684                         a: tup.0,
4685                         b: tup.1,
4686                 }
4687         }
4688 }
4689 impl C2Tuple_u64u64Z {
4690         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4691                 (self.a, self.b)
4692         }
4693 }
4694 impl Clone for C2Tuple_u64u64Z {
4695         fn clone(&self) -> Self {
4696                 Self {
4697                         a: Clone::clone(&self.a),
4698                         b: Clone::clone(&self.b),
4699                 }
4700         }
4701 }
4702 #[no_mangle]
4703 /// Creates a new tuple which has the same data as `orig`
4704 /// but with all dynamically-allocated buffers duplicated in new buffers.
4705 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4706 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4707 #[no_mangle]
4708 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4709         C2Tuple_u64u64Z { a, b, }
4710 }
4711
4712 #[no_mangle]
4713 /// Frees any resources used by the C2Tuple_u64u64Z.
4714 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4715 #[repr(C)]
4716 #[derive(Clone)]
4717 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4718 pub enum COption_C2Tuple_u64u64ZZ {
4719         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4720         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4721         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4722         None
4723 }
4724 impl COption_C2Tuple_u64u64ZZ {
4725         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4726                 if let Self::None = self { false } else { true }
4727         }
4728         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4729                 !self.is_some()
4730         }
4731         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4732                 if let Self::Some(v) = self { v } else { unreachable!() }
4733         }
4734 }
4735 #[no_mangle]
4736 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4737 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4738         COption_C2Tuple_u64u64ZZ::Some(o)
4739 }
4740 #[no_mangle]
4741 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4742 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4743         COption_C2Tuple_u64u64ZZ::None
4744 }
4745 #[no_mangle]
4746 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4747 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4748 #[no_mangle]
4749 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4750 /// but with all dynamically-allocated buffers duplicated in new buffers.
4751 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4752 #[repr(C)]
4753 /// A tuple of 2 elements. See the individual fields for the types contained.
4754 pub struct C2Tuple_Z {
4755         /// The element at position 0
4756         pub a: crate::c_types::ThirtyTwoU16s,
4757         /// The element at position 1
4758         pub b: crate::c_types::ThirtyTwoU16s,
4759 }
4760 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
4761         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4762                 Self {
4763                         a: tup.0,
4764                         b: tup.1,
4765                 }
4766         }
4767 }
4768 impl C2Tuple_Z {
4769         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4770                 (self.a, self.b)
4771         }
4772 }
4773 /// Creates a new C2Tuple_Z from the contained elements.
4774 #[no_mangle]
4775 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
4776         C2Tuple_Z { a, b, }
4777 }
4778
4779 #[no_mangle]
4780 /// Frees any resources used by the C2Tuple_Z.
4781 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4782 #[repr(C)]
4783 /// A tuple of 2 elements. See the individual fields for the types contained.
4784 pub struct C2Tuple__u1632_u1632Z {
4785         /// The element at position 0
4786         pub a: crate::c_types::ThirtyTwoU16s,
4787         /// The element at position 1
4788         pub b: crate::c_types::ThirtyTwoU16s,
4789 }
4790 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
4791         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4792                 Self {
4793                         a: tup.0,
4794                         b: tup.1,
4795                 }
4796         }
4797 }
4798 impl C2Tuple__u1632_u1632Z {
4799         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4800                 (self.a, self.b)
4801         }
4802 }
4803 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
4804 #[no_mangle]
4805 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
4806         C2Tuple__u1632_u1632Z { a, b, }
4807 }
4808
4809 #[no_mangle]
4810 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
4811 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
4812 #[repr(C)]
4813 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
4814 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4815         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
4816         Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
4817         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
4818         None
4819 }
4820 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4821         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4822                 if let Self::None = self { false } else { true }
4823         }
4824         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4825                 !self.is_some()
4826         }
4827         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
4828                 if let Self::Some(v) = self { v } else { unreachable!() }
4829         }
4830 }
4831 #[no_mangle]
4832 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
4833 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4834         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
4835 }
4836 #[no_mangle]
4837 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
4838 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4839         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
4840 }
4841 #[no_mangle]
4842 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
4843 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
4844 #[repr(C)]
4845 #[derive(Clone)]
4846 /// An enum which can either contain a f64 or not
4847 pub enum COption_f64Z {
4848         /// When we're in this state, this COption_f64Z contains a f64
4849         Some(f64),
4850         /// When we're in this state, this COption_f64Z contains nothing
4851         None
4852 }
4853 impl COption_f64Z {
4854         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4855                 if let Self::None = self { false } else { true }
4856         }
4857         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4858                 !self.is_some()
4859         }
4860         #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
4861                 if let Self::Some(v) = self { v } else { unreachable!() }
4862         }
4863 }
4864 #[no_mangle]
4865 /// Constructs a new COption_f64Z containing a f64
4866 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
4867         COption_f64Z::Some(o)
4868 }
4869 #[no_mangle]
4870 /// Constructs a new COption_f64Z containing nothing
4871 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
4872         COption_f64Z::None
4873 }
4874 #[no_mangle]
4875 /// Frees any resources associated with the f64, if we are in the Some state
4876 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
4877 #[no_mangle]
4878 /// Creates a new COption_f64Z which has the same data as `orig`
4879 /// but with all dynamically-allocated buffers duplicated in new buffers.
4880 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
4881 #[repr(C)]
4882 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4883 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4884         /// A pointer to the contents in the success state.
4885         /// Reading from this pointer when `result_ok` is not set is undefined.
4886         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4887         /// A pointer to the contents in the error state.
4888         /// Reading from this pointer when `result_ok` is set is undefined.
4889         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4890 }
4891 #[repr(C)]
4892 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4893 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4895 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4896         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4897         /// `err` or `result` depending on the state of `result_ok`.
4898         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4899         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4900         pub result_ok: bool,
4901 }
4902 #[no_mangle]
4903 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4904 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4905         CResult_ProbabilisticScorerDecodeErrorZ {
4906                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4907                         result: Box::into_raw(Box::new(o)),
4908                 },
4909                 result_ok: true,
4910         }
4911 }
4912 #[no_mangle]
4913 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4914 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4915         CResult_ProbabilisticScorerDecodeErrorZ {
4916                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4917                         err: Box::into_raw(Box::new(e)),
4918                 },
4919                 result_ok: false,
4920         }
4921 }
4922 /// Checks if the given object is currently in the success state
4923 #[no_mangle]
4924 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4925         o.result_ok
4926 }
4927 #[no_mangle]
4928 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4929 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4930 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4931         fn drop(&mut self) {
4932                 if self.result_ok {
4933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4935                         }
4936                 } else {
4937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4939                         }
4940                 }
4941         }
4942 }
4943 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4945                 let contents = if o.result_ok {
4946                         let result = unsafe { o.contents.result };
4947                         unsafe { o.contents.result = core::ptr::null_mut() };
4948                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4949                 } else {
4950                         let err = unsafe { o.contents.err };
4951                         unsafe { o.contents.err = core::ptr::null_mut(); }
4952                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4953                 };
4954                 Self {
4955                         contents,
4956                         result_ok: o.result_ok,
4957                 }
4958         }
4959 }
4960 #[repr(C)]
4961 /// A tuple of 2 elements. See the individual fields for the types contained.
4962 pub struct C2Tuple_usizeTransactionZ {
4963         /// The element at position 0
4964         pub a: usize,
4965         /// The element at position 1
4966         pub b: crate::c_types::Transaction,
4967 }
4968 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4969         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4970                 Self {
4971                         a: tup.0,
4972                         b: tup.1,
4973                 }
4974         }
4975 }
4976 impl C2Tuple_usizeTransactionZ {
4977         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4978                 (self.a, self.b)
4979         }
4980 }
4981 impl Clone for C2Tuple_usizeTransactionZ {
4982         fn clone(&self) -> Self {
4983                 Self {
4984                         a: Clone::clone(&self.a),
4985                         b: Clone::clone(&self.b),
4986                 }
4987         }
4988 }
4989 #[no_mangle]
4990 /// Creates a new tuple which has the same data as `orig`
4991 /// but with all dynamically-allocated buffers duplicated in new buffers.
4992 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4993 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4994 #[no_mangle]
4995 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4996         C2Tuple_usizeTransactionZ { a, b, }
4997 }
4998
4999 #[no_mangle]
5000 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5001 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5002 #[repr(C)]
5003 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5004 /// This corresponds to std::vector in C++
5005 pub struct CVec_C2Tuple_usizeTransactionZZ {
5006         /// The elements in the array.
5007         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5008         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5009         /// The number of elements pointed to by `data`.
5010         pub datalen: usize
5011 }
5012 impl CVec_C2Tuple_usizeTransactionZZ {
5013         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5014                 if self.datalen == 0 { return Vec::new(); }
5015                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5016                 self.data = core::ptr::null_mut();
5017                 self.datalen = 0;
5018                 ret
5019         }
5020         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5021                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5022         }
5023 }
5024 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5025         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5026                 let datalen = v.len();
5027                 let data = Box::into_raw(v.into_boxed_slice());
5028                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5029         }
5030 }
5031 #[no_mangle]
5032 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5033 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5034 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5035         fn drop(&mut self) {
5036                 if self.datalen == 0 { return; }
5037                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5038         }
5039 }
5040 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5041         fn clone(&self) -> Self {
5042                 let mut res = Vec::new();
5043                 if self.datalen == 0 { return Self::from(res); }
5044                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5045                 Self::from(res)
5046         }
5047 }
5048 #[repr(C)]
5049 /// A tuple of 2 elements. See the individual fields for the types contained.
5050 pub struct C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5051         /// The element at position 0
5052         pub a: crate::c_types::ThirtyTwoBytes,
5053         /// The element at position 1
5054         pub b: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5055 }
5056 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5057         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5058                 Self {
5059                         a: tup.0,
5060                         b: tup.1,
5061                 }
5062         }
5063 }
5064 impl C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5065         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5066                 (self.a, self.b)
5067         }
5068 }
5069 impl Clone for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5070         fn clone(&self) -> Self {
5071                 Self {
5072                         a: Clone::clone(&self.a),
5073                         b: Clone::clone(&self.b),
5074                 }
5075         }
5076 }
5077 #[no_mangle]
5078 /// Creates a new tuple which has the same data as `orig`
5079 /// but with all dynamically-allocated buffers duplicated in new buffers.
5080 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5081 /// Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements.
5082 #[no_mangle]
5083 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5084         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { a, b, }
5085 }
5086
5087 #[no_mangle]
5088 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.
5089 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res: C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) { }
5090 #[repr(C)]
5091 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size.
5092 /// This corresponds to std::vector in C++
5093 pub struct CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5094         /// The elements in the array.
5095         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5096         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ,
5097         /// The number of elements pointed to by `data`.
5098         pub datalen: usize
5099 }
5100 impl CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5101         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ> {
5102                 if self.datalen == 0 { return Vec::new(); }
5103                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5104                 self.data = core::ptr::null_mut();
5105                 self.datalen = 0;
5106                 ret
5107         }
5108         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ] {
5109                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5110         }
5111 }
5112 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>> for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5113         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>) -> Self {
5114                 let datalen = v.len();
5115                 let data = Box::into_raw(v.into_boxed_slice());
5116                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5117         }
5118 }
5119 #[no_mangle]
5120 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5121 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ) { }
5122 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5123         fn drop(&mut self) {
5124                 if self.datalen == 0 { return; }
5125                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5126         }
5127 }
5128 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5129         fn clone(&self) -> Self {
5130                 let mut res = Vec::new();
5131                 if self.datalen == 0 { return Self::from(res); }
5132                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5133                 Self::from(res)
5134         }
5135 }
5136 #[repr(C)]
5137 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5138 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5139         /// A pointer to the contents in the success state.
5140         /// Reading from this pointer when `result_ok` is not set is undefined.
5141         pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5142         /// Note that this value is always NULL, as there are no contents in the Err variant
5143         pub err: *mut core::ffi::c_void,
5144 }
5145 #[repr(C)]
5146 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5147 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5149 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5150         /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5151         /// `err` or `result` depending on the state of `result_ok`.
5152         pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5153         /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5154         pub result_ok: bool,
5155 }
5156 #[no_mangle]
5157 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5158 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5159         CResult_ChannelMonitorUpdateStatusNoneZ {
5160                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5161                         result: Box::into_raw(Box::new(o)),
5162                 },
5163                 result_ok: true,
5164         }
5165 }
5166 #[no_mangle]
5167 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5168 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5169         CResult_ChannelMonitorUpdateStatusNoneZ {
5170                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5171                         err: core::ptr::null_mut(),
5172                 },
5173                 result_ok: false,
5174         }
5175 }
5176 /// Checks if the given object is currently in the success state
5177 #[no_mangle]
5178 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5179         o.result_ok
5180 }
5181 #[no_mangle]
5182 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5183 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5184 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5185         fn drop(&mut self) {
5186                 if self.result_ok {
5187                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5188                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5189                         }
5190                 } else {
5191                 }
5192         }
5193 }
5194 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5195         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
5196                 let contents = if o.result_ok {
5197                         let result = unsafe { o.contents.result };
5198                         unsafe { o.contents.result = core::ptr::null_mut() };
5199                         CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
5200                 } else {
5201                         let _ = unsafe { Box::from_raw(o.contents.err) };
5202                         o.contents.err = core::ptr::null_mut();
5203                         CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5204                 };
5205                 Self {
5206                         contents,
5207                         result_ok: o.result_ok,
5208                 }
5209         }
5210 }
5211 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5212         fn clone(&self) -> Self {
5213                 if self.result_ok {
5214                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5215                                 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5216                         } }
5217                 } else {
5218                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5219                                 err: core::ptr::null_mut()
5220                         } }
5221                 }
5222         }
5223 }
5224 #[no_mangle]
5225 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5226 /// but with all dynamically-allocated buffers duplicated in new buffers.
5227 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5228 #[repr(C)]
5229 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5230 /// This corresponds to std::vector in C++
5231 pub struct CVec_MonitorEventZ {
5232         /// The elements in the array.
5233         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5234         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5235         /// The number of elements pointed to by `data`.
5236         pub datalen: usize
5237 }
5238 impl CVec_MonitorEventZ {
5239         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5240                 if self.datalen == 0 { return Vec::new(); }
5241                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5242                 self.data = core::ptr::null_mut();
5243                 self.datalen = 0;
5244                 ret
5245         }
5246         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5247                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5248         }
5249 }
5250 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5251         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5252                 let datalen = v.len();
5253                 let data = Box::into_raw(v.into_boxed_slice());
5254                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5255         }
5256 }
5257 #[no_mangle]
5258 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5259 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5260 impl Drop for CVec_MonitorEventZ {
5261         fn drop(&mut self) {
5262                 if self.datalen == 0 { return; }
5263                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5264         }
5265 }
5266 impl Clone for CVec_MonitorEventZ {
5267         fn clone(&self) -> Self {
5268                 let mut res = Vec::new();
5269                 if self.datalen == 0 { return Self::from(res); }
5270                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5271                 Self::from(res)
5272         }
5273 }
5274 #[repr(C)]
5275 /// A tuple of 3 elements. See the individual fields for the types contained.
5276 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5277         /// The element at position 0
5278         pub a: crate::lightning::chain::transaction::OutPoint,
5279         /// The element at position 1
5280         pub b: crate::c_types::derived::CVec_MonitorEventZ,
5281         /// The element at position 2
5282         pub c: crate::c_types::PublicKey,
5283 }
5284 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5285         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5286                 Self {
5287                         a: tup.0,
5288                         b: tup.1,
5289                         c: tup.2,
5290                 }
5291         }
5292 }
5293 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5294         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5295                 (self.a, self.b, self.c)
5296         }
5297 }
5298 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5299         fn clone(&self) -> Self {
5300                 Self {
5301                         a: Clone::clone(&self.a),
5302                         b: Clone::clone(&self.b),
5303                         c: Clone::clone(&self.c),
5304                 }
5305         }
5306 }
5307 #[no_mangle]
5308 /// Creates a new tuple which has the same data as `orig`
5309 /// but with all dynamically-allocated buffers duplicated in new buffers.
5310 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5311 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5312 #[no_mangle]
5313 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 {
5314         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5315 }
5316
5317 #[no_mangle]
5318 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5319 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5320 #[repr(C)]
5321 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5322 /// This corresponds to std::vector in C++
5323 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5324         /// The elements in the array.
5325         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5326         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5327         /// The number of elements pointed to by `data`.
5328         pub datalen: usize
5329 }
5330 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5331         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5332                 if self.datalen == 0 { return Vec::new(); }
5333                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5334                 self.data = core::ptr::null_mut();
5335                 self.datalen = 0;
5336                 ret
5337         }
5338         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5339                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5340         }
5341 }
5342 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5343         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5344                 let datalen = v.len();
5345                 let data = Box::into_raw(v.into_boxed_slice());
5346                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5347         }
5348 }
5349 #[no_mangle]
5350 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5351 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5352 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5353         fn drop(&mut self) {
5354                 if self.datalen == 0 { return; }
5355                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5356         }
5357 }
5358 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5359         fn clone(&self) -> Self {
5360                 let mut res = Vec::new();
5361                 if self.datalen == 0 { return Self::from(res); }
5362                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5363                 Self::from(res)
5364         }
5365 }
5366 #[repr(C)]
5367 /// The contents of CResult_InitFeaturesDecodeErrorZ
5368 pub union CResult_InitFeaturesDecodeErrorZPtr {
5369         /// A pointer to the contents in the success state.
5370         /// Reading from this pointer when `result_ok` is not set is undefined.
5371         pub result: *mut crate::lightning::ln::features::InitFeatures,
5372         /// A pointer to the contents in the error state.
5373         /// Reading from this pointer when `result_ok` is set is undefined.
5374         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5375 }
5376 #[repr(C)]
5377 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5378 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5380 pub struct CResult_InitFeaturesDecodeErrorZ {
5381         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5382         /// `err` or `result` depending on the state of `result_ok`.
5383         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5384         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5385         pub result_ok: bool,
5386 }
5387 #[no_mangle]
5388 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5389 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5390         CResult_InitFeaturesDecodeErrorZ {
5391                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5392                         result: Box::into_raw(Box::new(o)),
5393                 },
5394                 result_ok: true,
5395         }
5396 }
5397 #[no_mangle]
5398 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5399 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5400         CResult_InitFeaturesDecodeErrorZ {
5401                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5402                         err: Box::into_raw(Box::new(e)),
5403                 },
5404                 result_ok: false,
5405         }
5406 }
5407 /// Checks if the given object is currently in the success state
5408 #[no_mangle]
5409 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5410         o.result_ok
5411 }
5412 #[no_mangle]
5413 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5415 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5416         fn drop(&mut self) {
5417                 if self.result_ok {
5418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5420                         }
5421                 } else {
5422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5424                         }
5425                 }
5426         }
5427 }
5428 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5429         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5430                 let contents = if o.result_ok {
5431                         let result = unsafe { o.contents.result };
5432                         unsafe { o.contents.result = core::ptr::null_mut() };
5433                         CResult_InitFeaturesDecodeErrorZPtr { result }
5434                 } else {
5435                         let err = unsafe { o.contents.err };
5436                         unsafe { o.contents.err = core::ptr::null_mut(); }
5437                         CResult_InitFeaturesDecodeErrorZPtr { err }
5438                 };
5439                 Self {
5440                         contents,
5441                         result_ok: o.result_ok,
5442                 }
5443         }
5444 }
5445 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5446         fn clone(&self) -> Self {
5447                 if self.result_ok {
5448                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5449                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5450                         } }
5451                 } else {
5452                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5454                         } }
5455                 }
5456         }
5457 }
5458 #[no_mangle]
5459 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5460 /// but with all dynamically-allocated buffers duplicated in new buffers.
5461 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5462 #[repr(C)]
5463 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5464 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5465         /// A pointer to the contents in the success state.
5466         /// Reading from this pointer when `result_ok` is not set is undefined.
5467         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5468         /// A pointer to the contents in the error state.
5469         /// Reading from this pointer when `result_ok` is set is undefined.
5470         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5471 }
5472 #[repr(C)]
5473 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5474 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5476 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5477         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5478         /// `err` or `result` depending on the state of `result_ok`.
5479         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5480         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5481         pub result_ok: bool,
5482 }
5483 #[no_mangle]
5484 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5485 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5486         CResult_ChannelFeaturesDecodeErrorZ {
5487                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5488                         result: Box::into_raw(Box::new(o)),
5489                 },
5490                 result_ok: true,
5491         }
5492 }
5493 #[no_mangle]
5494 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5495 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5496         CResult_ChannelFeaturesDecodeErrorZ {
5497                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5498                         err: Box::into_raw(Box::new(e)),
5499                 },
5500                 result_ok: false,
5501         }
5502 }
5503 /// Checks if the given object is currently in the success state
5504 #[no_mangle]
5505 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5506         o.result_ok
5507 }
5508 #[no_mangle]
5509 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5510 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5511 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5512         fn drop(&mut self) {
5513                 if self.result_ok {
5514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5516                         }
5517                 } else {
5518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5520                         }
5521                 }
5522         }
5523 }
5524 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5525         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5526                 let contents = if o.result_ok {
5527                         let result = unsafe { o.contents.result };
5528                         unsafe { o.contents.result = core::ptr::null_mut() };
5529                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5530                 } else {
5531                         let err = unsafe { o.contents.err };
5532                         unsafe { o.contents.err = core::ptr::null_mut(); }
5533                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5534                 };
5535                 Self {
5536                         contents,
5537                         result_ok: o.result_ok,
5538                 }
5539         }
5540 }
5541 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5542         fn clone(&self) -> Self {
5543                 if self.result_ok {
5544                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5545                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5546                         } }
5547                 } else {
5548                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5549                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5550                         } }
5551                 }
5552         }
5553 }
5554 #[no_mangle]
5555 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5556 /// but with all dynamically-allocated buffers duplicated in new buffers.
5557 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5558 #[repr(C)]
5559 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5560 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5561         /// A pointer to the contents in the success state.
5562         /// Reading from this pointer when `result_ok` is not set is undefined.
5563         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5564         /// A pointer to the contents in the error state.
5565         /// Reading from this pointer when `result_ok` is set is undefined.
5566         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5567 }
5568 #[repr(C)]
5569 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5570 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5572 pub struct CResult_NodeFeaturesDecodeErrorZ {
5573         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5574         /// `err` or `result` depending on the state of `result_ok`.
5575         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5576         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5577         pub result_ok: bool,
5578 }
5579 #[no_mangle]
5580 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5581 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5582         CResult_NodeFeaturesDecodeErrorZ {
5583                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5584                         result: Box::into_raw(Box::new(o)),
5585                 },
5586                 result_ok: true,
5587         }
5588 }
5589 #[no_mangle]
5590 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5591 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5592         CResult_NodeFeaturesDecodeErrorZ {
5593                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5594                         err: Box::into_raw(Box::new(e)),
5595                 },
5596                 result_ok: false,
5597         }
5598 }
5599 /// Checks if the given object is currently in the success state
5600 #[no_mangle]
5601 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5602         o.result_ok
5603 }
5604 #[no_mangle]
5605 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5606 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5607 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5608         fn drop(&mut self) {
5609                 if self.result_ok {
5610                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5611                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5612                         }
5613                 } else {
5614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5616                         }
5617                 }
5618         }
5619 }
5620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5622                 let contents = if o.result_ok {
5623                         let result = unsafe { o.contents.result };
5624                         unsafe { o.contents.result = core::ptr::null_mut() };
5625                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5626                 } else {
5627                         let err = unsafe { o.contents.err };
5628                         unsafe { o.contents.err = core::ptr::null_mut(); }
5629                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5630                 };
5631                 Self {
5632                         contents,
5633                         result_ok: o.result_ok,
5634                 }
5635         }
5636 }
5637 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5638         fn clone(&self) -> Self {
5639                 if self.result_ok {
5640                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5641                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5642                         } }
5643                 } else {
5644                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5645                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5646                         } }
5647                 }
5648         }
5649 }
5650 #[no_mangle]
5651 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5654 #[repr(C)]
5655 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5656 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5657         /// A pointer to the contents in the success state.
5658         /// Reading from this pointer when `result_ok` is not set is undefined.
5659         pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
5660         /// A pointer to the contents in the error state.
5661         /// Reading from this pointer when `result_ok` is set is undefined.
5662         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5663 }
5664 #[repr(C)]
5665 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5666 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5668 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5669         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5670         /// `err` or `result` depending on the state of `result_ok`.
5671         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5672         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5673         pub result_ok: bool,
5674 }
5675 #[no_mangle]
5676 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5677 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5678         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5679                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5680                         result: Box::into_raw(Box::new(o)),
5681                 },
5682                 result_ok: true,
5683         }
5684 }
5685 #[no_mangle]
5686 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5687 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5688         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5689                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5690                         err: Box::into_raw(Box::new(e)),
5691                 },
5692                 result_ok: false,
5693         }
5694 }
5695 /// Checks if the given object is currently in the success state
5696 #[no_mangle]
5697 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5698         o.result_ok
5699 }
5700 #[no_mangle]
5701 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5702 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5703 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5704         fn drop(&mut self) {
5705                 if self.result_ok {
5706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5708                         }
5709                 } else {
5710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5712                         }
5713                 }
5714         }
5715 }
5716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5717         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5718                 let contents = if o.result_ok {
5719                         let result = unsafe { o.contents.result };
5720                         unsafe { o.contents.result = core::ptr::null_mut() };
5721                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5722                 } else {
5723                         let err = unsafe { o.contents.err };
5724                         unsafe { o.contents.err = core::ptr::null_mut(); }
5725                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5726                 };
5727                 Self {
5728                         contents,
5729                         result_ok: o.result_ok,
5730                 }
5731         }
5732 }
5733 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5734         fn clone(&self) -> Self {
5735                 if self.result_ok {
5736                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5737                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5738                         } }
5739                 } else {
5740                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5741                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5742                         } }
5743                 }
5744         }
5745 }
5746 #[no_mangle]
5747 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5750 #[repr(C)]
5751 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5752 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5753         /// A pointer to the contents in the success state.
5754         /// Reading from this pointer when `result_ok` is not set is undefined.
5755         pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
5756         /// A pointer to the contents in the error state.
5757         /// Reading from this pointer when `result_ok` is set is undefined.
5758         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5759 }
5760 #[repr(C)]
5761 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5764 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5765         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5766         /// `err` or `result` depending on the state of `result_ok`.
5767         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5768         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5769         pub result_ok: bool,
5770 }
5771 #[no_mangle]
5772 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5774         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5775                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5776                         result: Box::into_raw(Box::new(o)),
5777                 },
5778                 result_ok: true,
5779         }
5780 }
5781 #[no_mangle]
5782 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5784         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5785                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5786                         err: Box::into_raw(Box::new(e)),
5787                 },
5788                 result_ok: false,
5789         }
5790 }
5791 /// Checks if the given object is currently in the success state
5792 #[no_mangle]
5793 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5794         o.result_ok
5795 }
5796 #[no_mangle]
5797 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5798 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5799 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5800         fn drop(&mut self) {
5801                 if self.result_ok {
5802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5804                         }
5805                 } else {
5806                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5807                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5808                         }
5809                 }
5810         }
5811 }
5812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5813         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5814                 let contents = if o.result_ok {
5815                         let result = unsafe { o.contents.result };
5816                         unsafe { o.contents.result = core::ptr::null_mut() };
5817                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
5818                 } else {
5819                         let err = unsafe { o.contents.err };
5820                         unsafe { o.contents.err = core::ptr::null_mut(); }
5821                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
5822                 };
5823                 Self {
5824                         contents,
5825                         result_ok: o.result_ok,
5826                 }
5827         }
5828 }
5829 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5830         fn clone(&self) -> Self {
5831                 if self.result_ok {
5832                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5833                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5834                         } }
5835                 } else {
5836                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5837                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5838                         } }
5839                 }
5840         }
5841 }
5842 #[no_mangle]
5843 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5846 #[repr(C)]
5847 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5848 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5849         /// A pointer to the contents in the success state.
5850         /// Reading from this pointer when `result_ok` is not set is undefined.
5851         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5852         /// A pointer to the contents in the error state.
5853         /// Reading from this pointer when `result_ok` is set is undefined.
5854         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5855 }
5856 #[repr(C)]
5857 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5860 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5861         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5862         /// `err` or `result` depending on the state of `result_ok`.
5863         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5864         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5865         pub result_ok: bool,
5866 }
5867 #[no_mangle]
5868 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5870         CResult_BlindedHopFeaturesDecodeErrorZ {
5871                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5872                         result: Box::into_raw(Box::new(o)),
5873                 },
5874                 result_ok: true,
5875         }
5876 }
5877 #[no_mangle]
5878 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5880         CResult_BlindedHopFeaturesDecodeErrorZ {
5881                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5882                         err: Box::into_raw(Box::new(e)),
5883                 },
5884                 result_ok: false,
5885         }
5886 }
5887 /// Checks if the given object is currently in the success state
5888 #[no_mangle]
5889 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5890         o.result_ok
5891 }
5892 #[no_mangle]
5893 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5894 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5895 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5896         fn drop(&mut self) {
5897                 if self.result_ok {
5898                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5899                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5900                         }
5901                 } else {
5902                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5903                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5904                         }
5905                 }
5906         }
5907 }
5908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5910                 let contents = if o.result_ok {
5911                         let result = unsafe { o.contents.result };
5912                         unsafe { o.contents.result = core::ptr::null_mut() };
5913                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5914                 } else {
5915                         let err = unsafe { o.contents.err };
5916                         unsafe { o.contents.err = core::ptr::null_mut(); }
5917                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5918                 };
5919                 Self {
5920                         contents,
5921                         result_ok: o.result_ok,
5922                 }
5923         }
5924 }
5925 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5926         fn clone(&self) -> Self {
5927                 if self.result_ok {
5928                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5930                         } }
5931                 } else {
5932                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5933                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5934                         } }
5935                 }
5936         }
5937 }
5938 #[no_mangle]
5939 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5942 #[repr(C)]
5943 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5944 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5945         /// A pointer to the contents in the success state.
5946         /// Reading from this pointer when `result_ok` is not set is undefined.
5947         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5948         /// A pointer to the contents in the error state.
5949         /// Reading from this pointer when `result_ok` is set is undefined.
5950         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5951 }
5952 #[repr(C)]
5953 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5957         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5958         /// `err` or `result` depending on the state of `result_ok`.
5959         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5960         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5961         pub result_ok: bool,
5962 }
5963 #[no_mangle]
5964 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5966         CResult_ChannelTypeFeaturesDecodeErrorZ {
5967                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5968                         result: Box::into_raw(Box::new(o)),
5969                 },
5970                 result_ok: true,
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5976         CResult_ChannelTypeFeaturesDecodeErrorZ {
5977                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5978                         err: Box::into_raw(Box::new(e)),
5979                 },
5980                 result_ok: false,
5981         }
5982 }
5983 /// Checks if the given object is currently in the success state
5984 #[no_mangle]
5985 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5986         o.result_ok
5987 }
5988 #[no_mangle]
5989 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5990 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5991 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5992         fn drop(&mut self) {
5993                 if self.result_ok {
5994                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5995                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5996                         }
5997                 } else {
5998                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5999                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6000                         }
6001                 }
6002         }
6003 }
6004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6005         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6006                 let contents = if o.result_ok {
6007                         let result = unsafe { o.contents.result };
6008                         unsafe { o.contents.result = core::ptr::null_mut() };
6009                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6010                 } else {
6011                         let err = unsafe { o.contents.err };
6012                         unsafe { o.contents.err = core::ptr::null_mut(); }
6013                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6014                 };
6015                 Self {
6016                         contents,
6017                         result_ok: o.result_ok,
6018                 }
6019         }
6020 }
6021 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6022         fn clone(&self) -> Self {
6023                 if self.result_ok {
6024                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6025                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6026                         } }
6027                 } else {
6028                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6029                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6030                         } }
6031                 }
6032         }
6033 }
6034 #[no_mangle]
6035 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6038 #[repr(C)]
6039 /// The contents of CResult_OfferBolt12ParseErrorZ
6040 pub union CResult_OfferBolt12ParseErrorZPtr {
6041         /// A pointer to the contents in the success state.
6042         /// Reading from this pointer when `result_ok` is not set is undefined.
6043         pub result: *mut crate::lightning::offers::offer::Offer,
6044         /// A pointer to the contents in the error state.
6045         /// Reading from this pointer when `result_ok` is set is undefined.
6046         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
6047 }
6048 #[repr(C)]
6049 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6050 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6052 pub struct CResult_OfferBolt12ParseErrorZ {
6053         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6054         /// `err` or `result` depending on the state of `result_ok`.
6055         pub contents: CResult_OfferBolt12ParseErrorZPtr,
6056         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6057         pub result_ok: bool,
6058 }
6059 #[no_mangle]
6060 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6061 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6062         CResult_OfferBolt12ParseErrorZ {
6063                 contents: CResult_OfferBolt12ParseErrorZPtr {
6064                         result: Box::into_raw(Box::new(o)),
6065                 },
6066                 result_ok: true,
6067         }
6068 }
6069 #[no_mangle]
6070 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6071 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6072         CResult_OfferBolt12ParseErrorZ {
6073                 contents: CResult_OfferBolt12ParseErrorZPtr {
6074                         err: Box::into_raw(Box::new(e)),
6075                 },
6076                 result_ok: false,
6077         }
6078 }
6079 /// Checks if the given object is currently in the success state
6080 #[no_mangle]
6081 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6082         o.result_ok
6083 }
6084 #[no_mangle]
6085 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6086 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6087 impl Drop for CResult_OfferBolt12ParseErrorZ {
6088         fn drop(&mut self) {
6089                 if self.result_ok {
6090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6092                         }
6093                 } else {
6094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6096                         }
6097                 }
6098         }
6099 }
6100 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
6102                 let contents = if o.result_ok {
6103                         let result = unsafe { o.contents.result };
6104                         unsafe { o.contents.result = core::ptr::null_mut() };
6105                         CResult_OfferBolt12ParseErrorZPtr { result }
6106                 } else {
6107                         let err = unsafe { o.contents.err };
6108                         unsafe { o.contents.err = core::ptr::null_mut(); }
6109                         CResult_OfferBolt12ParseErrorZPtr { err }
6110                 };
6111                 Self {
6112                         contents,
6113                         result_ok: o.result_ok,
6114                 }
6115         }
6116 }
6117 impl Clone for CResult_OfferBolt12ParseErrorZ {
6118         fn clone(&self) -> Self {
6119                 if self.result_ok {
6120                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6121                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6122                         } }
6123                 } else {
6124                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6125                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6126                         } }
6127                 }
6128         }
6129 }
6130 #[no_mangle]
6131 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6132 /// but with all dynamically-allocated buffers duplicated in new buffers.
6133 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6134 #[repr(C)]
6135 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6136 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6137         /// A pointer to the contents in the success state.
6138         /// Reading from this pointer when `result_ok` is not set is undefined.
6139         pub result: *mut crate::c_types::PublicKey,
6140         /// A pointer to the contents in the error state.
6141         /// Reading from this pointer when `result_ok` is set is undefined.
6142         pub err: *mut crate::c_types::Secp256k1Error,
6143 }
6144 #[repr(C)]
6145 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6146 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6148 pub struct CResult_PublicKeySecp256k1ErrorZ {
6149         /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6150         /// `err` or `result` depending on the state of `result_ok`.
6151         pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6152         /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6153         pub result_ok: bool,
6154 }
6155 #[no_mangle]
6156 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6157 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6158         CResult_PublicKeySecp256k1ErrorZ {
6159                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6160                         result: Box::into_raw(Box::new(o)),
6161                 },
6162                 result_ok: true,
6163         }
6164 }
6165 #[no_mangle]
6166 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6167 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6168         CResult_PublicKeySecp256k1ErrorZ {
6169                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6170                         err: Box::into_raw(Box::new(e)),
6171                 },
6172                 result_ok: false,
6173         }
6174 }
6175 /// Checks if the given object is currently in the success state
6176 #[no_mangle]
6177 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6178         o.result_ok
6179 }
6180 #[no_mangle]
6181 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6182 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6183 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6184         fn drop(&mut self) {
6185                 if self.result_ok {
6186                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6187                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6188                         }
6189                 } else {
6190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6192                         }
6193                 }
6194         }
6195 }
6196 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6197         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6198                 let contents = if o.result_ok {
6199                         let result = unsafe { o.contents.result };
6200                         unsafe { o.contents.result = core::ptr::null_mut() };
6201                         CResult_PublicKeySecp256k1ErrorZPtr { result }
6202                 } else {
6203                         let err = unsafe { o.contents.err };
6204                         unsafe { o.contents.err = core::ptr::null_mut(); }
6205                         CResult_PublicKeySecp256k1ErrorZPtr { err }
6206                 };
6207                 Self {
6208                         contents,
6209                         result_ok: o.result_ok,
6210                 }
6211         }
6212 }
6213 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6214         fn clone(&self) -> Self {
6215                 if self.result_ok {
6216                         Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6217                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6218                         } }
6219                 } else {
6220                         Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6221                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6222                         } }
6223                 }
6224         }
6225 }
6226 #[no_mangle]
6227 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6228 /// but with all dynamically-allocated buffers duplicated in new buffers.
6229 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6230 #[repr(C)]
6231 /// The contents of CResult_NodeIdDecodeErrorZ
6232 pub union CResult_NodeIdDecodeErrorZPtr {
6233         /// A pointer to the contents in the success state.
6234         /// Reading from this pointer when `result_ok` is not set is undefined.
6235         pub result: *mut crate::lightning::routing::gossip::NodeId,
6236         /// A pointer to the contents in the error state.
6237         /// Reading from this pointer when `result_ok` is set is undefined.
6238         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6239 }
6240 #[repr(C)]
6241 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6242 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6244 pub struct CResult_NodeIdDecodeErrorZ {
6245         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6246         /// `err` or `result` depending on the state of `result_ok`.
6247         pub contents: CResult_NodeIdDecodeErrorZPtr,
6248         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6249         pub result_ok: bool,
6250 }
6251 #[no_mangle]
6252 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6253 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6254         CResult_NodeIdDecodeErrorZ {
6255                 contents: CResult_NodeIdDecodeErrorZPtr {
6256                         result: Box::into_raw(Box::new(o)),
6257                 },
6258                 result_ok: true,
6259         }
6260 }
6261 #[no_mangle]
6262 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6263 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6264         CResult_NodeIdDecodeErrorZ {
6265                 contents: CResult_NodeIdDecodeErrorZPtr {
6266                         err: Box::into_raw(Box::new(e)),
6267                 },
6268                 result_ok: false,
6269         }
6270 }
6271 /// Checks if the given object is currently in the success state
6272 #[no_mangle]
6273 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6274         o.result_ok
6275 }
6276 #[no_mangle]
6277 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6278 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6279 impl Drop for CResult_NodeIdDecodeErrorZ {
6280         fn drop(&mut self) {
6281                 if self.result_ok {
6282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6284                         }
6285                 } else {
6286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6288                         }
6289                 }
6290         }
6291 }
6292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6294                 let contents = if o.result_ok {
6295                         let result = unsafe { o.contents.result };
6296                         unsafe { o.contents.result = core::ptr::null_mut() };
6297                         CResult_NodeIdDecodeErrorZPtr { result }
6298                 } else {
6299                         let err = unsafe { o.contents.err };
6300                         unsafe { o.contents.err = core::ptr::null_mut(); }
6301                         CResult_NodeIdDecodeErrorZPtr { err }
6302                 };
6303                 Self {
6304                         contents,
6305                         result_ok: o.result_ok,
6306                 }
6307         }
6308 }
6309 impl Clone for CResult_NodeIdDecodeErrorZ {
6310         fn clone(&self) -> Self {
6311                 if self.result_ok {
6312                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6313                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6314                         } }
6315                 } else {
6316                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6317                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6318                         } }
6319                 }
6320         }
6321 }
6322 #[no_mangle]
6323 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6324 /// but with all dynamically-allocated buffers duplicated in new buffers.
6325 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6326 #[repr(C)]
6327 #[derive(Clone)]
6328 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6329 pub enum COption_NetworkUpdateZ {
6330         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6331         Some(crate::lightning::routing::gossip::NetworkUpdate),
6332         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6333         None
6334 }
6335 impl COption_NetworkUpdateZ {
6336         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6337                 if let Self::None = self { false } else { true }
6338         }
6339         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6340                 !self.is_some()
6341         }
6342         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6343                 if let Self::Some(v) = self { v } else { unreachable!() }
6344         }
6345 }
6346 #[no_mangle]
6347 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6348 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6349         COption_NetworkUpdateZ::Some(o)
6350 }
6351 #[no_mangle]
6352 /// Constructs a new COption_NetworkUpdateZ containing nothing
6353 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6354         COption_NetworkUpdateZ::None
6355 }
6356 #[no_mangle]
6357 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6358 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6359 #[no_mangle]
6360 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6361 /// but with all dynamically-allocated buffers duplicated in new buffers.
6362 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6363 #[repr(C)]
6364 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6365 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6366         /// A pointer to the contents in the success state.
6367         /// Reading from this pointer when `result_ok` is not set is undefined.
6368         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6369         /// A pointer to the contents in the error state.
6370         /// Reading from this pointer when `result_ok` is set is undefined.
6371         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6372 }
6373 #[repr(C)]
6374 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6375 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6377 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6378         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6379         /// `err` or `result` depending on the state of `result_ok`.
6380         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6381         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6382         pub result_ok: bool,
6383 }
6384 #[no_mangle]
6385 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6386 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6387         CResult_COption_NetworkUpdateZDecodeErrorZ {
6388                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6389                         result: Box::into_raw(Box::new(o)),
6390                 },
6391                 result_ok: true,
6392         }
6393 }
6394 #[no_mangle]
6395 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6396 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6397         CResult_COption_NetworkUpdateZDecodeErrorZ {
6398                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6399                         err: Box::into_raw(Box::new(e)),
6400                 },
6401                 result_ok: false,
6402         }
6403 }
6404 /// Checks if the given object is currently in the success state
6405 #[no_mangle]
6406 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6407         o.result_ok
6408 }
6409 #[no_mangle]
6410 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6411 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6412 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6413         fn drop(&mut self) {
6414                 if self.result_ok {
6415                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6416                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6417                         }
6418                 } else {
6419                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6420                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6421                         }
6422                 }
6423         }
6424 }
6425 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6426         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6427                 let contents = if o.result_ok {
6428                         let result = unsafe { o.contents.result };
6429                         unsafe { o.contents.result = core::ptr::null_mut() };
6430                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6431                 } else {
6432                         let err = unsafe { o.contents.err };
6433                         unsafe { o.contents.err = core::ptr::null_mut(); }
6434                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6435                 };
6436                 Self {
6437                         contents,
6438                         result_ok: o.result_ok,
6439                 }
6440         }
6441 }
6442 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6443         fn clone(&self) -> Self {
6444                 if self.result_ok {
6445                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6446                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6447                         } }
6448                 } else {
6449                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6450                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6451                         } }
6452                 }
6453         }
6454 }
6455 #[no_mangle]
6456 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6457 /// but with all dynamically-allocated buffers duplicated in new buffers.
6458 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6459 #[repr(C)]
6460 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6461 pub enum COption_UtxoLookupZ {
6462         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6463         Some(crate::lightning::routing::utxo::UtxoLookup),
6464         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6465         None
6466 }
6467 impl COption_UtxoLookupZ {
6468         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6469                 if let Self::None = self { false } else { true }
6470         }
6471         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6472                 !self.is_some()
6473         }
6474         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6475                 if let Self::Some(v) = self { v } else { unreachable!() }
6476         }
6477 }
6478 #[no_mangle]
6479 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6480 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6481         COption_UtxoLookupZ::Some(o)
6482 }
6483 #[no_mangle]
6484 /// Constructs a new COption_UtxoLookupZ containing nothing
6485 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6486         COption_UtxoLookupZ::None
6487 }
6488 #[no_mangle]
6489 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6490 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6491 #[repr(C)]
6492 /// The contents of CResult_NoneLightningErrorZ
6493 pub union CResult_NoneLightningErrorZPtr {
6494         /// Note that this value is always NULL, as there are no contents in the OK variant
6495         pub result: *mut core::ffi::c_void,
6496         /// A pointer to the contents in the error state.
6497         /// Reading from this pointer when `result_ok` is set is undefined.
6498         pub err: *mut crate::lightning::ln::msgs::LightningError,
6499 }
6500 #[repr(C)]
6501 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6502 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6504 pub struct CResult_NoneLightningErrorZ {
6505         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6506         /// `err` or `result` depending on the state of `result_ok`.
6507         pub contents: CResult_NoneLightningErrorZPtr,
6508         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6509         pub result_ok: bool,
6510 }
6511 #[no_mangle]
6512 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6513 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6514         CResult_NoneLightningErrorZ {
6515                 contents: CResult_NoneLightningErrorZPtr {
6516                         result: core::ptr::null_mut(),
6517                 },
6518                 result_ok: true,
6519         }
6520 }
6521 #[no_mangle]
6522 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6523 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6524         CResult_NoneLightningErrorZ {
6525                 contents: CResult_NoneLightningErrorZPtr {
6526                         err: Box::into_raw(Box::new(e)),
6527                 },
6528                 result_ok: false,
6529         }
6530 }
6531 /// Checks if the given object is currently in the success state
6532 #[no_mangle]
6533 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6534         o.result_ok
6535 }
6536 #[no_mangle]
6537 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6538 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6539 impl Drop for CResult_NoneLightningErrorZ {
6540         fn drop(&mut self) {
6541                 if self.result_ok {
6542                 } else {
6543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6545                         }
6546                 }
6547         }
6548 }
6549 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6550         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6551                 let contents = if o.result_ok {
6552                         let _ = unsafe { Box::from_raw(o.contents.result) };
6553                         o.contents.result = core::ptr::null_mut();
6554                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6555                 } else {
6556                         let err = unsafe { o.contents.err };
6557                         unsafe { o.contents.err = core::ptr::null_mut(); }
6558                         CResult_NoneLightningErrorZPtr { err }
6559                 };
6560                 Self {
6561                         contents,
6562                         result_ok: o.result_ok,
6563                 }
6564         }
6565 }
6566 impl Clone for CResult_NoneLightningErrorZ {
6567         fn clone(&self) -> Self {
6568                 if self.result_ok {
6569                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6570                                 result: core::ptr::null_mut()
6571                         } }
6572                 } else {
6573                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6574                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6575                         } }
6576                 }
6577         }
6578 }
6579 #[no_mangle]
6580 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6581 /// but with all dynamically-allocated buffers duplicated in new buffers.
6582 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6583 #[repr(C)]
6584 /// The contents of CResult_boolLightningErrorZ
6585 pub union CResult_boolLightningErrorZPtr {
6586         /// A pointer to the contents in the success state.
6587         /// Reading from this pointer when `result_ok` is not set is undefined.
6588         pub result: *mut bool,
6589         /// A pointer to the contents in the error state.
6590         /// Reading from this pointer when `result_ok` is set is undefined.
6591         pub err: *mut crate::lightning::ln::msgs::LightningError,
6592 }
6593 #[repr(C)]
6594 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6595 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6597 pub struct CResult_boolLightningErrorZ {
6598         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6599         /// `err` or `result` depending on the state of `result_ok`.
6600         pub contents: CResult_boolLightningErrorZPtr,
6601         /// Whether this CResult_boolLightningErrorZ represents a success state.
6602         pub result_ok: bool,
6603 }
6604 #[no_mangle]
6605 /// Creates a new CResult_boolLightningErrorZ in the success state.
6606 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6607         CResult_boolLightningErrorZ {
6608                 contents: CResult_boolLightningErrorZPtr {
6609                         result: Box::into_raw(Box::new(o)),
6610                 },
6611                 result_ok: true,
6612         }
6613 }
6614 #[no_mangle]
6615 /// Creates a new CResult_boolLightningErrorZ in the error state.
6616 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6617         CResult_boolLightningErrorZ {
6618                 contents: CResult_boolLightningErrorZPtr {
6619                         err: Box::into_raw(Box::new(e)),
6620                 },
6621                 result_ok: false,
6622         }
6623 }
6624 /// Checks if the given object is currently in the success state
6625 #[no_mangle]
6626 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6627         o.result_ok
6628 }
6629 #[no_mangle]
6630 /// Frees any resources used by the CResult_boolLightningErrorZ.
6631 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6632 impl Drop for CResult_boolLightningErrorZ {
6633         fn drop(&mut self) {
6634                 if self.result_ok {
6635                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6636                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6637                         }
6638                 } else {
6639                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6640                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6641                         }
6642                 }
6643         }
6644 }
6645 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6646         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6647                 let contents = if o.result_ok {
6648                         let result = unsafe { o.contents.result };
6649                         unsafe { o.contents.result = core::ptr::null_mut() };
6650                         CResult_boolLightningErrorZPtr { result }
6651                 } else {
6652                         let err = unsafe { o.contents.err };
6653                         unsafe { o.contents.err = core::ptr::null_mut(); }
6654                         CResult_boolLightningErrorZPtr { err }
6655                 };
6656                 Self {
6657                         contents,
6658                         result_ok: o.result_ok,
6659                 }
6660         }
6661 }
6662 impl Clone for CResult_boolLightningErrorZ {
6663         fn clone(&self) -> Self {
6664                 if self.result_ok {
6665                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6666                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6667                         } }
6668                 } else {
6669                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6670                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6671                         } }
6672                 }
6673         }
6674 }
6675 #[no_mangle]
6676 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6679 #[repr(C)]
6680 /// A tuple of 3 elements. See the individual fields for the types contained.
6681 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6682         /// The element at position 0
6683         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6684         /// The element at position 1
6685         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6686         /// The element at position 2
6687         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6688 }
6689 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6690         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6691                 Self {
6692                         a: tup.0,
6693                         b: tup.1,
6694                         c: tup.2,
6695                 }
6696         }
6697 }
6698 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6699         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6700                 (self.a, self.b, self.c)
6701         }
6702 }
6703 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6704         fn clone(&self) -> Self {
6705                 Self {
6706                         a: Clone::clone(&self.a),
6707                         b: Clone::clone(&self.b),
6708                         c: Clone::clone(&self.c),
6709                 }
6710         }
6711 }
6712 #[no_mangle]
6713 /// Creates a new tuple which has the same data as `orig`
6714 /// but with all dynamically-allocated buffers duplicated in new buffers.
6715 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6716 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6717 #[no_mangle]
6718 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 {
6719         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6720 }
6721
6722 #[no_mangle]
6723 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6724 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6725 #[repr(C)]
6726 #[derive(Clone)]
6727 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6728 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6729         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6730         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6731         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6732         None
6733 }
6734 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6735         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6736                 if let Self::None = self { false } else { true }
6737         }
6738         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6739                 !self.is_some()
6740         }
6741         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6742                 if let Self::Some(v) = self { v } else { unreachable!() }
6743         }
6744 }
6745 #[no_mangle]
6746 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6747 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6748         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6749 }
6750 #[no_mangle]
6751 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6752 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6753         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6754 }
6755 #[no_mangle]
6756 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6757 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6758 #[no_mangle]
6759 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6760 /// but with all dynamically-allocated buffers duplicated in new buffers.
6761 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6762 #[repr(C)]
6763 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6764 /// This corresponds to std::vector in C++
6765 pub struct CVec_MessageSendEventZ {
6766         /// The elements in the array.
6767         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6768         pub data: *mut crate::lightning::events::MessageSendEvent,
6769         /// The number of elements pointed to by `data`.
6770         pub datalen: usize
6771 }
6772 impl CVec_MessageSendEventZ {
6773         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6774                 if self.datalen == 0 { return Vec::new(); }
6775                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6776                 self.data = core::ptr::null_mut();
6777                 self.datalen = 0;
6778                 ret
6779         }
6780         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6781                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6782         }
6783 }
6784 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6785         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6786                 let datalen = v.len();
6787                 let data = Box::into_raw(v.into_boxed_slice());
6788                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6789         }
6790 }
6791 #[no_mangle]
6792 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6793 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6794 impl Drop for CVec_MessageSendEventZ {
6795         fn drop(&mut self) {
6796                 if self.datalen == 0 { return; }
6797                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6798         }
6799 }
6800 impl Clone for CVec_MessageSendEventZ {
6801         fn clone(&self) -> Self {
6802                 let mut res = Vec::new();
6803                 if self.datalen == 0 { return Self::from(res); }
6804                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6805                 Self::from(res)
6806         }
6807 }
6808 #[repr(C)]
6809 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6810 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6811         /// A pointer to the contents in the success state.
6812         /// Reading from this pointer when `result_ok` is not set is undefined.
6813         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6814         /// A pointer to the contents in the error state.
6815         /// Reading from this pointer when `result_ok` is set is undefined.
6816         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6817 }
6818 #[repr(C)]
6819 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6820 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6822 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6823         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6824         /// `err` or `result` depending on the state of `result_ok`.
6825         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6826         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6827         pub result_ok: bool,
6828 }
6829 #[no_mangle]
6830 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6831 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6832         CResult_ChannelUpdateInfoDecodeErrorZ {
6833                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6834                         result: Box::into_raw(Box::new(o)),
6835                 },
6836                 result_ok: true,
6837         }
6838 }
6839 #[no_mangle]
6840 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6841 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6842         CResult_ChannelUpdateInfoDecodeErrorZ {
6843                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6844                         err: Box::into_raw(Box::new(e)),
6845                 },
6846                 result_ok: false,
6847         }
6848 }
6849 /// Checks if the given object is currently in the success state
6850 #[no_mangle]
6851 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6852         o.result_ok
6853 }
6854 #[no_mangle]
6855 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6856 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6857 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6858         fn drop(&mut self) {
6859                 if self.result_ok {
6860                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6861                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6862                         }
6863                 } else {
6864                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6865                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6866                         }
6867                 }
6868         }
6869 }
6870 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6871         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6872                 let contents = if o.result_ok {
6873                         let result = unsafe { o.contents.result };
6874                         unsafe { o.contents.result = core::ptr::null_mut() };
6875                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6876                 } else {
6877                         let err = unsafe { o.contents.err };
6878                         unsafe { o.contents.err = core::ptr::null_mut(); }
6879                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6880                 };
6881                 Self {
6882                         contents,
6883                         result_ok: o.result_ok,
6884                 }
6885         }
6886 }
6887 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6888         fn clone(&self) -> Self {
6889                 if self.result_ok {
6890                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6891                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6892                         } }
6893                 } else {
6894                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6895                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6896                         } }
6897                 }
6898         }
6899 }
6900 #[no_mangle]
6901 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6902 /// but with all dynamically-allocated buffers duplicated in new buffers.
6903 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6904 #[repr(C)]
6905 /// The contents of CResult_ChannelInfoDecodeErrorZ
6906 pub union CResult_ChannelInfoDecodeErrorZPtr {
6907         /// A pointer to the contents in the success state.
6908         /// Reading from this pointer when `result_ok` is not set is undefined.
6909         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6910         /// A pointer to the contents in the error state.
6911         /// Reading from this pointer when `result_ok` is set is undefined.
6912         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6913 }
6914 #[repr(C)]
6915 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6916 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6918 pub struct CResult_ChannelInfoDecodeErrorZ {
6919         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6920         /// `err` or `result` depending on the state of `result_ok`.
6921         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6922         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6923         pub result_ok: bool,
6924 }
6925 #[no_mangle]
6926 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6927 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6928         CResult_ChannelInfoDecodeErrorZ {
6929                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6930                         result: Box::into_raw(Box::new(o)),
6931                 },
6932                 result_ok: true,
6933         }
6934 }
6935 #[no_mangle]
6936 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6937 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6938         CResult_ChannelInfoDecodeErrorZ {
6939                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6940                         err: Box::into_raw(Box::new(e)),
6941                 },
6942                 result_ok: false,
6943         }
6944 }
6945 /// Checks if the given object is currently in the success state
6946 #[no_mangle]
6947 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6948         o.result_ok
6949 }
6950 #[no_mangle]
6951 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6952 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6953 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6954         fn drop(&mut self) {
6955                 if self.result_ok {
6956                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6957                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6958                         }
6959                 } else {
6960                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6961                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6962                         }
6963                 }
6964         }
6965 }
6966 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6967         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6968                 let contents = if o.result_ok {
6969                         let result = unsafe { o.contents.result };
6970                         unsafe { o.contents.result = core::ptr::null_mut() };
6971                         CResult_ChannelInfoDecodeErrorZPtr { result }
6972                 } else {
6973                         let err = unsafe { o.contents.err };
6974                         unsafe { o.contents.err = core::ptr::null_mut(); }
6975                         CResult_ChannelInfoDecodeErrorZPtr { err }
6976                 };
6977                 Self {
6978                         contents,
6979                         result_ok: o.result_ok,
6980                 }
6981         }
6982 }
6983 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6984         fn clone(&self) -> Self {
6985                 if self.result_ok {
6986                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6987                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6988                         } }
6989                 } else {
6990                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6991                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6992                         } }
6993                 }
6994         }
6995 }
6996 #[no_mangle]
6997 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6998 /// but with all dynamically-allocated buffers duplicated in new buffers.
6999 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7000 #[repr(C)]
7001 /// The contents of CResult_RoutingFeesDecodeErrorZ
7002 pub union CResult_RoutingFeesDecodeErrorZPtr {
7003         /// A pointer to the contents in the success state.
7004         /// Reading from this pointer when `result_ok` is not set is undefined.
7005         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7006         /// A pointer to the contents in the error state.
7007         /// Reading from this pointer when `result_ok` is set is undefined.
7008         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7009 }
7010 #[repr(C)]
7011 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7012 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7014 pub struct CResult_RoutingFeesDecodeErrorZ {
7015         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7016         /// `err` or `result` depending on the state of `result_ok`.
7017         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7018         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7019         pub result_ok: bool,
7020 }
7021 #[no_mangle]
7022 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7023 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7024         CResult_RoutingFeesDecodeErrorZ {
7025                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7026                         result: Box::into_raw(Box::new(o)),
7027                 },
7028                 result_ok: true,
7029         }
7030 }
7031 #[no_mangle]
7032 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7033 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7034         CResult_RoutingFeesDecodeErrorZ {
7035                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7036                         err: Box::into_raw(Box::new(e)),
7037                 },
7038                 result_ok: false,
7039         }
7040 }
7041 /// Checks if the given object is currently in the success state
7042 #[no_mangle]
7043 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7044         o.result_ok
7045 }
7046 #[no_mangle]
7047 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7048 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7049 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7050         fn drop(&mut self) {
7051                 if self.result_ok {
7052                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7053                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7054                         }
7055                 } else {
7056                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7057                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7058                         }
7059                 }
7060         }
7061 }
7062 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7063         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7064                 let contents = if o.result_ok {
7065                         let result = unsafe { o.contents.result };
7066                         unsafe { o.contents.result = core::ptr::null_mut() };
7067                         CResult_RoutingFeesDecodeErrorZPtr { result }
7068                 } else {
7069                         let err = unsafe { o.contents.err };
7070                         unsafe { o.contents.err = core::ptr::null_mut(); }
7071                         CResult_RoutingFeesDecodeErrorZPtr { err }
7072                 };
7073                 Self {
7074                         contents,
7075                         result_ok: o.result_ok,
7076                 }
7077         }
7078 }
7079 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7080         fn clone(&self) -> Self {
7081                 if self.result_ok {
7082                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7083                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7084                         } }
7085                 } else {
7086                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7087                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7088                         } }
7089                 }
7090         }
7091 }
7092 #[no_mangle]
7093 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7094 /// but with all dynamically-allocated buffers duplicated in new buffers.
7095 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7096 #[repr(C)]
7097 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7098 /// This corresponds to std::vector in C++
7099 pub struct CVec_SocketAddressZ {
7100         /// The elements in the array.
7101         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7102         pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7103         /// The number of elements pointed to by `data`.
7104         pub datalen: usize
7105 }
7106 impl CVec_SocketAddressZ {
7107         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7108                 if self.datalen == 0 { return Vec::new(); }
7109                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7110                 self.data = core::ptr::null_mut();
7111                 self.datalen = 0;
7112                 ret
7113         }
7114         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7115                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7116         }
7117 }
7118 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7119         fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7120                 let datalen = v.len();
7121                 let data = Box::into_raw(v.into_boxed_slice());
7122                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7123         }
7124 }
7125 #[no_mangle]
7126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7127 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7128 impl Drop for CVec_SocketAddressZ {
7129         fn drop(&mut self) {
7130                 if self.datalen == 0 { return; }
7131                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7132         }
7133 }
7134 impl Clone for CVec_SocketAddressZ {
7135         fn clone(&self) -> Self {
7136                 let mut res = Vec::new();
7137                 if self.datalen == 0 { return Self::from(res); }
7138                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7139                 Self::from(res)
7140         }
7141 }
7142 #[repr(C)]
7143 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7144 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7145         /// A pointer to the contents in the success state.
7146         /// Reading from this pointer when `result_ok` is not set is undefined.
7147         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
7148         /// A pointer to the contents in the error state.
7149         /// Reading from this pointer when `result_ok` is set is undefined.
7150         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7151 }
7152 #[repr(C)]
7153 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7154 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7156 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7157         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7158         /// `err` or `result` depending on the state of `result_ok`.
7159         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7160         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7161         pub result_ok: bool,
7162 }
7163 #[no_mangle]
7164 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7165 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7166         CResult_NodeAnnouncementInfoDecodeErrorZ {
7167                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7168                         result: Box::into_raw(Box::new(o)),
7169                 },
7170                 result_ok: true,
7171         }
7172 }
7173 #[no_mangle]
7174 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7175 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7176         CResult_NodeAnnouncementInfoDecodeErrorZ {
7177                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7178                         err: Box::into_raw(Box::new(e)),
7179                 },
7180                 result_ok: false,
7181         }
7182 }
7183 /// Checks if the given object is currently in the success state
7184 #[no_mangle]
7185 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7186         o.result_ok
7187 }
7188 #[no_mangle]
7189 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7190 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7191 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7192         fn drop(&mut self) {
7193                 if self.result_ok {
7194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7196                         }
7197                 } else {
7198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7200                         }
7201                 }
7202         }
7203 }
7204 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7205         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7206                 let contents = if o.result_ok {
7207                         let result = unsafe { o.contents.result };
7208                         unsafe { o.contents.result = core::ptr::null_mut() };
7209                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7210                 } else {
7211                         let err = unsafe { o.contents.err };
7212                         unsafe { o.contents.err = core::ptr::null_mut(); }
7213                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7214                 };
7215                 Self {
7216                         contents,
7217                         result_ok: o.result_ok,
7218                 }
7219         }
7220 }
7221 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7222         fn clone(&self) -> Self {
7223                 if self.result_ok {
7224                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7225                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7226                         } }
7227                 } else {
7228                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7229                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7230                         } }
7231                 }
7232         }
7233 }
7234 #[no_mangle]
7235 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7236 /// but with all dynamically-allocated buffers duplicated in new buffers.
7237 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7238 #[repr(C)]
7239 /// The contents of CResult_NodeAliasDecodeErrorZ
7240 pub union CResult_NodeAliasDecodeErrorZPtr {
7241         /// A pointer to the contents in the success state.
7242         /// Reading from this pointer when `result_ok` is not set is undefined.
7243         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
7244         /// A pointer to the contents in the error state.
7245         /// Reading from this pointer when `result_ok` is set is undefined.
7246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7247 }
7248 #[repr(C)]
7249 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7250 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7252 pub struct CResult_NodeAliasDecodeErrorZ {
7253         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7254         /// `err` or `result` depending on the state of `result_ok`.
7255         pub contents: CResult_NodeAliasDecodeErrorZPtr,
7256         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7257         pub result_ok: bool,
7258 }
7259 #[no_mangle]
7260 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7261 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7262         CResult_NodeAliasDecodeErrorZ {
7263                 contents: CResult_NodeAliasDecodeErrorZPtr {
7264                         result: Box::into_raw(Box::new(o)),
7265                 },
7266                 result_ok: true,
7267         }
7268 }
7269 #[no_mangle]
7270 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7271 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7272         CResult_NodeAliasDecodeErrorZ {
7273                 contents: CResult_NodeAliasDecodeErrorZPtr {
7274                         err: Box::into_raw(Box::new(e)),
7275                 },
7276                 result_ok: false,
7277         }
7278 }
7279 /// Checks if the given object is currently in the success state
7280 #[no_mangle]
7281 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7282         o.result_ok
7283 }
7284 #[no_mangle]
7285 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7286 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7287 impl Drop for CResult_NodeAliasDecodeErrorZ {
7288         fn drop(&mut self) {
7289                 if self.result_ok {
7290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7292                         }
7293                 } else {
7294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7296                         }
7297                 }
7298         }
7299 }
7300 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7301         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
7302                 let contents = if o.result_ok {
7303                         let result = unsafe { o.contents.result };
7304                         unsafe { o.contents.result = core::ptr::null_mut() };
7305                         CResult_NodeAliasDecodeErrorZPtr { result }
7306                 } else {
7307                         let err = unsafe { o.contents.err };
7308                         unsafe { o.contents.err = core::ptr::null_mut(); }
7309                         CResult_NodeAliasDecodeErrorZPtr { err }
7310                 };
7311                 Self {
7312                         contents,
7313                         result_ok: o.result_ok,
7314                 }
7315         }
7316 }
7317 impl Clone for CResult_NodeAliasDecodeErrorZ {
7318         fn clone(&self) -> Self {
7319                 if self.result_ok {
7320                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7321                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7322                         } }
7323                 } else {
7324                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7325                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7326                         } }
7327                 }
7328         }
7329 }
7330 #[no_mangle]
7331 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7332 /// but with all dynamically-allocated buffers duplicated in new buffers.
7333 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7334 #[repr(C)]
7335 /// The contents of CResult_NodeInfoDecodeErrorZ
7336 pub union CResult_NodeInfoDecodeErrorZPtr {
7337         /// A pointer to the contents in the success state.
7338         /// Reading from this pointer when `result_ok` is not set is undefined.
7339         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7340         /// A pointer to the contents in the error state.
7341         /// Reading from this pointer when `result_ok` is set is undefined.
7342         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7343 }
7344 #[repr(C)]
7345 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7346 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7348 pub struct CResult_NodeInfoDecodeErrorZ {
7349         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7350         /// `err` or `result` depending on the state of `result_ok`.
7351         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7352         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7353         pub result_ok: bool,
7354 }
7355 #[no_mangle]
7356 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7357 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7358         CResult_NodeInfoDecodeErrorZ {
7359                 contents: CResult_NodeInfoDecodeErrorZPtr {
7360                         result: Box::into_raw(Box::new(o)),
7361                 },
7362                 result_ok: true,
7363         }
7364 }
7365 #[no_mangle]
7366 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7367 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7368         CResult_NodeInfoDecodeErrorZ {
7369                 contents: CResult_NodeInfoDecodeErrorZPtr {
7370                         err: Box::into_raw(Box::new(e)),
7371                 },
7372                 result_ok: false,
7373         }
7374 }
7375 /// Checks if the given object is currently in the success state
7376 #[no_mangle]
7377 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7378         o.result_ok
7379 }
7380 #[no_mangle]
7381 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7382 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7383 impl Drop for CResult_NodeInfoDecodeErrorZ {
7384         fn drop(&mut self) {
7385                 if self.result_ok {
7386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7388                         }
7389                 } else {
7390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7392                         }
7393                 }
7394         }
7395 }
7396 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7398                 let contents = if o.result_ok {
7399                         let result = unsafe { o.contents.result };
7400                         unsafe { o.contents.result = core::ptr::null_mut() };
7401                         CResult_NodeInfoDecodeErrorZPtr { result }
7402                 } else {
7403                         let err = unsafe { o.contents.err };
7404                         unsafe { o.contents.err = core::ptr::null_mut(); }
7405                         CResult_NodeInfoDecodeErrorZPtr { err }
7406                 };
7407                 Self {
7408                         contents,
7409                         result_ok: o.result_ok,
7410                 }
7411         }
7412 }
7413 impl Clone for CResult_NodeInfoDecodeErrorZ {
7414         fn clone(&self) -> Self {
7415                 if self.result_ok {
7416                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7417                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7418                         } }
7419                 } else {
7420                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7421                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7422                         } }
7423                 }
7424         }
7425 }
7426 #[no_mangle]
7427 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7428 /// but with all dynamically-allocated buffers duplicated in new buffers.
7429 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7430 #[repr(C)]
7431 /// The contents of CResult_NetworkGraphDecodeErrorZ
7432 pub union CResult_NetworkGraphDecodeErrorZPtr {
7433         /// A pointer to the contents in the success state.
7434         /// Reading from this pointer when `result_ok` is not set is undefined.
7435         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7436         /// A pointer to the contents in the error state.
7437         /// Reading from this pointer when `result_ok` is set is undefined.
7438         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7439 }
7440 #[repr(C)]
7441 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7442 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7444 pub struct CResult_NetworkGraphDecodeErrorZ {
7445         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7446         /// `err` or `result` depending on the state of `result_ok`.
7447         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7448         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7449         pub result_ok: bool,
7450 }
7451 #[no_mangle]
7452 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7453 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7454         CResult_NetworkGraphDecodeErrorZ {
7455                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7456                         result: Box::into_raw(Box::new(o)),
7457                 },
7458                 result_ok: true,
7459         }
7460 }
7461 #[no_mangle]
7462 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7463 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7464         CResult_NetworkGraphDecodeErrorZ {
7465                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7466                         err: Box::into_raw(Box::new(e)),
7467                 },
7468                 result_ok: false,
7469         }
7470 }
7471 /// Checks if the given object is currently in the success state
7472 #[no_mangle]
7473 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7474         o.result_ok
7475 }
7476 #[no_mangle]
7477 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7478 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7479 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7480         fn drop(&mut self) {
7481                 if self.result_ok {
7482                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7483                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7484                         }
7485                 } else {
7486                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7487                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7488                         }
7489                 }
7490         }
7491 }
7492 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7493         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7494                 let contents = if o.result_ok {
7495                         let result = unsafe { o.contents.result };
7496                         unsafe { o.contents.result = core::ptr::null_mut() };
7497                         CResult_NetworkGraphDecodeErrorZPtr { result }
7498                 } else {
7499                         let err = unsafe { o.contents.err };
7500                         unsafe { o.contents.err = core::ptr::null_mut(); }
7501                         CResult_NetworkGraphDecodeErrorZPtr { err }
7502                 };
7503                 Self {
7504                         contents,
7505                         result_ok: o.result_ok,
7506                 }
7507         }
7508 }
7509 #[repr(C)]
7510 #[derive(Clone)]
7511 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7512 pub enum COption_CVec_SocketAddressZZ {
7513         /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7514         Some(crate::c_types::derived::CVec_SocketAddressZ),
7515         /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7516         None
7517 }
7518 impl COption_CVec_SocketAddressZZ {
7519         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7520                 if let Self::None = self { false } else { true }
7521         }
7522         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7523                 !self.is_some()
7524         }
7525         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7526                 if let Self::Some(v) = self { v } else { unreachable!() }
7527         }
7528 }
7529 #[no_mangle]
7530 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7531 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7532         COption_CVec_SocketAddressZZ::Some(o)
7533 }
7534 #[no_mangle]
7535 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7536 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7537         COption_CVec_SocketAddressZZ::None
7538 }
7539 #[no_mangle]
7540 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7541 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7542 #[no_mangle]
7543 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7544 /// but with all dynamically-allocated buffers duplicated in new buffers.
7545 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
7546 #[repr(C)]
7547 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
7548 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
7549         /// A pointer to the contents in the success state.
7550         /// Reading from this pointer when `result_ok` is not set is undefined.
7551         pub result: *mut crate::lightning::events::bump_transaction::ChannelDerivationParameters,
7552         /// A pointer to the contents in the error state.
7553         /// Reading from this pointer when `result_ok` is set is undefined.
7554         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7555 }
7556 #[repr(C)]
7557 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
7558 /// containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
7559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7560 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
7561         /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
7562         /// `err` or `result` depending on the state of `result_ok`.
7563         pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
7564         /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
7565         pub result_ok: bool,
7566 }
7567 #[no_mangle]
7568 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
7569 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
7570         CResult_ChannelDerivationParametersDecodeErrorZ {
7571                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7572                         result: Box::into_raw(Box::new(o)),
7573                 },
7574                 result_ok: true,
7575         }
7576 }
7577 #[no_mangle]
7578 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
7579 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
7580         CResult_ChannelDerivationParametersDecodeErrorZ {
7581                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7582                         err: Box::into_raw(Box::new(e)),
7583                 },
7584                 result_ok: false,
7585         }
7586 }
7587 /// Checks if the given object is currently in the success state
7588 #[no_mangle]
7589 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
7590         o.result_ok
7591 }
7592 #[no_mangle]
7593 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
7594 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
7595 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
7596         fn drop(&mut self) {
7597                 if self.result_ok {
7598                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7599                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7600                         }
7601                 } else {
7602                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7603                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7604                         }
7605                 }
7606         }
7607 }
7608 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
7609         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
7610                 let contents = if o.result_ok {
7611                         let result = unsafe { o.contents.result };
7612                         unsafe { o.contents.result = core::ptr::null_mut() };
7613                         CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
7614                 } else {
7615                         let err = unsafe { o.contents.err };
7616                         unsafe { o.contents.err = core::ptr::null_mut(); }
7617                         CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
7618                 };
7619                 Self {
7620                         contents,
7621                         result_ok: o.result_ok,
7622                 }
7623         }
7624 }
7625 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
7626         fn clone(&self) -> Self {
7627                 if self.result_ok {
7628                         Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7629                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
7630                         } }
7631                 } else {
7632                         Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7633                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7634                         } }
7635                 }
7636         }
7637 }
7638 #[no_mangle]
7639 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
7640 /// but with all dynamically-allocated buffers duplicated in new buffers.
7641 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
7642 #[repr(C)]
7643 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
7644 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
7645         /// A pointer to the contents in the success state.
7646         /// Reading from this pointer when `result_ok` is not set is undefined.
7647         pub result: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7648         /// A pointer to the contents in the error state.
7649         /// Reading from this pointer when `result_ok` is set is undefined.
7650         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7651 }
7652 #[repr(C)]
7653 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
7654 /// containing a crate::lightning::events::bump_transaction::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7656 pub struct CResult_HTLCDescriptorDecodeErrorZ {
7657         /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
7658         /// `err` or `result` depending on the state of `result_ok`.
7659         pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
7660         /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
7661         pub result_ok: bool,
7662 }
7663 #[no_mangle]
7664 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
7665 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
7666         CResult_HTLCDescriptorDecodeErrorZ {
7667                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7668                         result: Box::into_raw(Box::new(o)),
7669                 },
7670                 result_ok: true,
7671         }
7672 }
7673 #[no_mangle]
7674 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
7675 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
7676         CResult_HTLCDescriptorDecodeErrorZ {
7677                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7678                         err: Box::into_raw(Box::new(e)),
7679                 },
7680                 result_ok: false,
7681         }
7682 }
7683 /// Checks if the given object is currently in the success state
7684 #[no_mangle]
7685 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
7686         o.result_ok
7687 }
7688 #[no_mangle]
7689 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
7690 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
7691 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
7692         fn drop(&mut self) {
7693                 if self.result_ok {
7694                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7695                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7696                         }
7697                 } else {
7698                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7699                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7700                         }
7701                 }
7702         }
7703 }
7704 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
7705         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7706                 let contents = if o.result_ok {
7707                         let result = unsafe { o.contents.result };
7708                         unsafe { o.contents.result = core::ptr::null_mut() };
7709                         CResult_HTLCDescriptorDecodeErrorZPtr { result }
7710                 } else {
7711                         let err = unsafe { o.contents.err };
7712                         unsafe { o.contents.err = core::ptr::null_mut(); }
7713                         CResult_HTLCDescriptorDecodeErrorZPtr { err }
7714                 };
7715                 Self {
7716                         contents,
7717                         result_ok: o.result_ok,
7718                 }
7719         }
7720 }
7721 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
7722         fn clone(&self) -> Self {
7723                 if self.result_ok {
7724                         Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7725                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
7726                         } }
7727                 } else {
7728                         Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7729                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7730                         } }
7731                 }
7732         }
7733 }
7734 #[no_mangle]
7735 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
7736 /// but with all dynamically-allocated buffers duplicated in new buffers.
7737 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
7738 #[repr(C)]
7739 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
7740 /// This corresponds to std::vector in C++
7741 pub struct CVec_HTLCOutputInCommitmentZ {
7742         /// The elements in the array.
7743         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7744         pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
7745         /// The number of elements pointed to by `data`.
7746         pub datalen: usize
7747 }
7748 impl CVec_HTLCOutputInCommitmentZ {
7749         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
7750                 if self.datalen == 0 { return Vec::new(); }
7751                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7752                 self.data = core::ptr::null_mut();
7753                 self.datalen = 0;
7754                 ret
7755         }
7756         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
7757                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7758         }
7759 }
7760 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
7761         fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
7762                 let datalen = v.len();
7763                 let data = Box::into_raw(v.into_boxed_slice());
7764                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7765         }
7766 }
7767 #[no_mangle]
7768 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7769 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
7770 impl Drop for CVec_HTLCOutputInCommitmentZ {
7771         fn drop(&mut self) {
7772                 if self.datalen == 0 { return; }
7773                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7774         }
7775 }
7776 impl Clone for CVec_HTLCOutputInCommitmentZ {
7777         fn clone(&self) -> Self {
7778                 let mut res = Vec::new();
7779                 if self.datalen == 0 { return Self::from(res); }
7780                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7781                 Self::from(res)
7782         }
7783 }
7784 #[repr(C)]
7785 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
7786 /// This corresponds to std::vector in C++
7787 pub struct CVec_HTLCDescriptorZ {
7788         /// The elements in the array.
7789         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7790         pub data: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7791         /// The number of elements pointed to by `data`.
7792         pub datalen: usize
7793 }
7794 impl CVec_HTLCDescriptorZ {
7795         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::HTLCDescriptor> {
7796                 if self.datalen == 0 { return Vec::new(); }
7797                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7798                 self.data = core::ptr::null_mut();
7799                 self.datalen = 0;
7800                 ret
7801         }
7802         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::HTLCDescriptor] {
7803                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7804         }
7805 }
7806 impl From<Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7807         fn from(v: Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>) -> Self {
7808                 let datalen = v.len();
7809                 let data = Box::into_raw(v.into_boxed_slice());
7810                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7811         }
7812 }
7813 #[no_mangle]
7814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7815 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
7816 impl Drop for CVec_HTLCDescriptorZ {
7817         fn drop(&mut self) {
7818                 if self.datalen == 0 { return; }
7819                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7820         }
7821 }
7822 impl Clone for CVec_HTLCDescriptorZ {
7823         fn clone(&self) -> Self {
7824                 let mut res = Vec::new();
7825                 if self.datalen == 0 { return Self::from(res); }
7826                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7827                 Self::from(res)
7828         }
7829 }
7830 #[repr(C)]
7831 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
7832 /// This corresponds to std::vector in C++
7833 pub struct CVec_UtxoZ {
7834         /// The elements in the array.
7835         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7836         pub data: *mut crate::lightning::events::bump_transaction::Utxo,
7837         /// The number of elements pointed to by `data`.
7838         pub datalen: usize
7839 }
7840 impl CVec_UtxoZ {
7841         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
7842                 if self.datalen == 0 { return Vec::new(); }
7843                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7844                 self.data = core::ptr::null_mut();
7845                 self.datalen = 0;
7846                 ret
7847         }
7848         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
7849                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7850         }
7851 }
7852 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
7853         fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
7854                 let datalen = v.len();
7855                 let data = Box::into_raw(v.into_boxed_slice());
7856                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7857         }
7858 }
7859 #[no_mangle]
7860 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7861 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
7862 impl Drop for CVec_UtxoZ {
7863         fn drop(&mut self) {
7864                 if self.datalen == 0 { return; }
7865                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7866         }
7867 }
7868 impl Clone for CVec_UtxoZ {
7869         fn clone(&self) -> Self {
7870                 let mut res = Vec::new();
7871                 if self.datalen == 0 { return Self::from(res); }
7872                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7873                 Self::from(res)
7874         }
7875 }
7876 #[repr(C)]
7877 #[derive(Clone)]
7878 /// An enum which can either contain a crate::c_types::TxOut or not
7879 pub enum COption_TxOutZ {
7880         /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
7881         Some(crate::c_types::TxOut),
7882         /// When we're in this state, this COption_TxOutZ contains nothing
7883         None
7884 }
7885 impl COption_TxOutZ {
7886         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7887                 if let Self::None = self { false } else { true }
7888         }
7889         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7890                 !self.is_some()
7891         }
7892         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
7893                 if let Self::Some(v) = self { v } else { unreachable!() }
7894         }
7895 }
7896 #[no_mangle]
7897 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
7898 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
7899         COption_TxOutZ::Some(o)
7900 }
7901 #[no_mangle]
7902 /// Constructs a new COption_TxOutZ containing nothing
7903 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
7904         COption_TxOutZ::None
7905 }
7906 #[no_mangle]
7907 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
7908 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
7909 #[no_mangle]
7910 /// Creates a new COption_TxOutZ which has the same data as `orig`
7911 /// but with all dynamically-allocated buffers duplicated in new buffers.
7912 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
7913 #[repr(C)]
7914 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
7915 /// This corresponds to std::vector in C++
7916 pub struct CVec_InputZ {
7917         /// The elements in the array.
7918         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7919         pub data: *mut crate::lightning::events::bump_transaction::Input,
7920         /// The number of elements pointed to by `data`.
7921         pub datalen: usize
7922 }
7923 impl CVec_InputZ {
7924         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
7925                 if self.datalen == 0 { return Vec::new(); }
7926                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7927                 self.data = core::ptr::null_mut();
7928                 self.datalen = 0;
7929                 ret
7930         }
7931         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
7932                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7933         }
7934 }
7935 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
7936         fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
7937                 let datalen = v.len();
7938                 let data = Box::into_raw(v.into_boxed_slice());
7939                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7940         }
7941 }
7942 #[no_mangle]
7943 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7944 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
7945 impl Drop for CVec_InputZ {
7946         fn drop(&mut self) {
7947                 if self.datalen == 0 { return; }
7948                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7949         }
7950 }
7951 impl Clone for CVec_InputZ {
7952         fn clone(&self) -> Self {
7953                 let mut res = Vec::new();
7954                 if self.datalen == 0 { return Self::from(res); }
7955                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7956                 Self::from(res)
7957         }
7958 }
7959 #[repr(C)]
7960 /// The contents of CResult_CoinSelectionNoneZ
7961 pub union CResult_CoinSelectionNoneZPtr {
7962         /// A pointer to the contents in the success state.
7963         /// Reading from this pointer when `result_ok` is not set is undefined.
7964         pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
7965         /// Note that this value is always NULL, as there are no contents in the Err variant
7966         pub err: *mut core::ffi::c_void,
7967 }
7968 #[repr(C)]
7969 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
7970 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
7971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7972 pub struct CResult_CoinSelectionNoneZ {
7973         /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
7974         /// `err` or `result` depending on the state of `result_ok`.
7975         pub contents: CResult_CoinSelectionNoneZPtr,
7976         /// Whether this CResult_CoinSelectionNoneZ represents a success state.
7977         pub result_ok: bool,
7978 }
7979 #[no_mangle]
7980 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
7981 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
7982         CResult_CoinSelectionNoneZ {
7983                 contents: CResult_CoinSelectionNoneZPtr {
7984                         result: Box::into_raw(Box::new(o)),
7985                 },
7986                 result_ok: true,
7987         }
7988 }
7989 #[no_mangle]
7990 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
7991 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
7992         CResult_CoinSelectionNoneZ {
7993                 contents: CResult_CoinSelectionNoneZPtr {
7994                         err: core::ptr::null_mut(),
7995                 },
7996                 result_ok: false,
7997         }
7998 }
7999 /// Checks if the given object is currently in the success state
8000 #[no_mangle]
8001 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
8002         o.result_ok
8003 }
8004 #[no_mangle]
8005 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
8006 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
8007 impl Drop for CResult_CoinSelectionNoneZ {
8008         fn drop(&mut self) {
8009                 if self.result_ok {
8010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8012                         }
8013                 } else {
8014                 }
8015         }
8016 }
8017 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
8018         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
8019                 let contents = if o.result_ok {
8020                         let result = unsafe { o.contents.result };
8021                         unsafe { o.contents.result = core::ptr::null_mut() };
8022                         CResult_CoinSelectionNoneZPtr { result }
8023                 } else {
8024                         let _ = unsafe { Box::from_raw(o.contents.err) };
8025                         o.contents.err = core::ptr::null_mut();
8026                         CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
8027                 };
8028                 Self {
8029                         contents,
8030                         result_ok: o.result_ok,
8031                 }
8032         }
8033 }
8034 impl Clone for CResult_CoinSelectionNoneZ {
8035         fn clone(&self) -> Self {
8036                 if self.result_ok {
8037                         Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
8038                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
8039                         } }
8040                 } else {
8041                         Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
8042                                 err: core::ptr::null_mut()
8043                         } }
8044                 }
8045         }
8046 }
8047 #[no_mangle]
8048 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
8049 /// but with all dynamically-allocated buffers duplicated in new buffers.
8050 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
8051 #[repr(C)]
8052 /// The contents of CResult_CVec_UtxoZNoneZ
8053 pub union CResult_CVec_UtxoZNoneZPtr {
8054         /// A pointer to the contents in the success state.
8055         /// Reading from this pointer when `result_ok` is not set is undefined.
8056         pub result: *mut crate::c_types::derived::CVec_UtxoZ,
8057         /// Note that this value is always NULL, as there are no contents in the Err variant
8058         pub err: *mut core::ffi::c_void,
8059 }
8060 #[repr(C)]
8061 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
8062 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
8063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8064 pub struct CResult_CVec_UtxoZNoneZ {
8065         /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
8066         /// `err` or `result` depending on the state of `result_ok`.
8067         pub contents: CResult_CVec_UtxoZNoneZPtr,
8068         /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
8069         pub result_ok: bool,
8070 }
8071 #[no_mangle]
8072 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
8073 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
8074         CResult_CVec_UtxoZNoneZ {
8075                 contents: CResult_CVec_UtxoZNoneZPtr {
8076                         result: Box::into_raw(Box::new(o)),
8077                 },
8078                 result_ok: true,
8079         }
8080 }
8081 #[no_mangle]
8082 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
8083 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
8084         CResult_CVec_UtxoZNoneZ {
8085                 contents: CResult_CVec_UtxoZNoneZPtr {
8086                         err: core::ptr::null_mut(),
8087                 },
8088                 result_ok: false,
8089         }
8090 }
8091 /// Checks if the given object is currently in the success state
8092 #[no_mangle]
8093 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
8094         o.result_ok
8095 }
8096 #[no_mangle]
8097 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
8098 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
8099 impl Drop for CResult_CVec_UtxoZNoneZ {
8100         fn drop(&mut self) {
8101                 if self.result_ok {
8102                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8103                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8104                         }
8105                 } else {
8106                 }
8107         }
8108 }
8109 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
8110         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
8111                 let contents = if o.result_ok {
8112                         let result = unsafe { o.contents.result };
8113                         unsafe { o.contents.result = core::ptr::null_mut() };
8114                         CResult_CVec_UtxoZNoneZPtr { result }
8115                 } else {
8116                         let _ = unsafe { Box::from_raw(o.contents.err) };
8117                         o.contents.err = core::ptr::null_mut();
8118                         CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
8119                 };
8120                 Self {
8121                         contents,
8122                         result_ok: o.result_ok,
8123                 }
8124         }
8125 }
8126 impl Clone for CResult_CVec_UtxoZNoneZ {
8127         fn clone(&self) -> Self {
8128                 if self.result_ok {
8129                         Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
8130                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
8131                         } }
8132                 } else {
8133                         Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
8134                                 err: core::ptr::null_mut()
8135                         } }
8136                 }
8137         }
8138 }
8139 #[no_mangle]
8140 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
8141 /// but with all dynamically-allocated buffers duplicated in new buffers.
8142 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
8143 #[repr(C)]
8144 /// A tuple of 2 elements. See the individual fields for the types contained.
8145 pub struct C2Tuple_u64u16Z {
8146         /// The element at position 0
8147         pub a: u64,
8148         /// The element at position 1
8149         pub b: u16,
8150 }
8151 impl From<(u64, u16)> for C2Tuple_u64u16Z {
8152         fn from (tup: (u64, u16)) -> Self {
8153                 Self {
8154                         a: tup.0,
8155                         b: tup.1,
8156                 }
8157         }
8158 }
8159 impl C2Tuple_u64u16Z {
8160         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
8161                 (self.a, self.b)
8162         }
8163 }
8164 impl Clone for C2Tuple_u64u16Z {
8165         fn clone(&self) -> Self {
8166                 Self {
8167                         a: Clone::clone(&self.a),
8168                         b: Clone::clone(&self.b),
8169                 }
8170         }
8171 }
8172 #[no_mangle]
8173 /// Creates a new tuple which has the same data as `orig`
8174 /// but with all dynamically-allocated buffers duplicated in new buffers.
8175 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
8176 /// Creates a new C2Tuple_u64u16Z from the contained elements.
8177 #[no_mangle]
8178 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
8179         C2Tuple_u64u16Z { a, b, }
8180 }
8181
8182 #[no_mangle]
8183 /// Frees any resources used by the C2Tuple_u64u16Z.
8184 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
8185 #[repr(C)]
8186 #[derive(Clone)]
8187 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
8188 pub enum COption_C2Tuple_u64u16ZZ {
8189         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
8190         Some(crate::c_types::derived::C2Tuple_u64u16Z),
8191         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
8192         None
8193 }
8194 impl COption_C2Tuple_u64u16ZZ {
8195         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8196                 if let Self::None = self { false } else { true }
8197         }
8198         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8199                 !self.is_some()
8200         }
8201         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
8202                 if let Self::Some(v) = self { v } else { unreachable!() }
8203         }
8204 }
8205 #[no_mangle]
8206 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
8207 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
8208         COption_C2Tuple_u64u16ZZ::Some(o)
8209 }
8210 #[no_mangle]
8211 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
8212 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
8213         COption_C2Tuple_u64u16ZZ::None
8214 }
8215 #[no_mangle]
8216 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
8217 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
8218 #[no_mangle]
8219 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
8220 /// but with all dynamically-allocated buffers duplicated in new buffers.
8221 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
8222 #[repr(C)]
8223 #[derive(Clone)]
8224 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
8225 pub enum COption_ChannelShutdownStateZ {
8226         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
8227         Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
8228         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
8229         None
8230 }
8231 impl COption_ChannelShutdownStateZ {
8232         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8233                 if let Self::None = self { false } else { true }
8234         }
8235         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8236                 !self.is_some()
8237         }
8238         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
8239                 if let Self::Some(v) = self { v } else { unreachable!() }
8240         }
8241 }
8242 #[no_mangle]
8243 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
8244 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
8245         COption_ChannelShutdownStateZ::Some(o)
8246 }
8247 #[no_mangle]
8248 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
8249 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
8250         COption_ChannelShutdownStateZ::None
8251 }
8252 #[no_mangle]
8253 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
8254 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
8255 #[no_mangle]
8256 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
8257 /// but with all dynamically-allocated buffers duplicated in new buffers.
8258 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
8259 #[repr(C)]
8260 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
8261 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
8262         /// A pointer to the contents in the success state.
8263         /// Reading from this pointer when `result_ok` is not set is undefined.
8264         pub result: *mut crate::c_types::ThirtyTwoBytes,
8265         /// A pointer to the contents in the error state.
8266         /// Reading from this pointer when `result_ok` is set is undefined.
8267         pub err: *mut crate::lightning::util::errors::APIError,
8268 }
8269 #[repr(C)]
8270 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
8271 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8273 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
8274         /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
8275         /// `err` or `result` depending on the state of `result_ok`.
8276         pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
8277         /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
8278         pub result_ok: bool,
8279 }
8280 #[no_mangle]
8281 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
8282 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
8283         CResult_ThirtyTwoBytesAPIErrorZ {
8284                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8285                         result: Box::into_raw(Box::new(o)),
8286                 },
8287                 result_ok: true,
8288         }
8289 }
8290 #[no_mangle]
8291 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
8292 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
8293         CResult_ThirtyTwoBytesAPIErrorZ {
8294                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8295                         err: Box::into_raw(Box::new(e)),
8296                 },
8297                 result_ok: false,
8298         }
8299 }
8300 /// Checks if the given object is currently in the success state
8301 #[no_mangle]
8302 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
8303         o.result_ok
8304 }
8305 #[no_mangle]
8306 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
8307 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
8308 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
8309         fn drop(&mut self) {
8310                 if self.result_ok {
8311                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8312                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8313                         }
8314                 } else {
8315                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8316                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8317                         }
8318                 }
8319         }
8320 }
8321 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
8322         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8323                 let contents = if o.result_ok {
8324                         let result = unsafe { o.contents.result };
8325                         unsafe { o.contents.result = core::ptr::null_mut() };
8326                         CResult_ThirtyTwoBytesAPIErrorZPtr { result }
8327                 } else {
8328                         let err = unsafe { o.contents.err };
8329                         unsafe { o.contents.err = core::ptr::null_mut(); }
8330                         CResult_ThirtyTwoBytesAPIErrorZPtr { err }
8331                 };
8332                 Self {
8333                         contents,
8334                         result_ok: o.result_ok,
8335                 }
8336         }
8337 }
8338 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
8339         fn clone(&self) -> Self {
8340                 if self.result_ok {
8341                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8342                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8343                         } }
8344                 } else {
8345                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8346                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8347                         } }
8348                 }
8349         }
8350 }
8351 #[no_mangle]
8352 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
8353 /// but with all dynamically-allocated buffers duplicated in new buffers.
8354 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
8355 #[repr(C)]
8356 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8357 /// This corresponds to std::vector in C++
8358 pub struct CVec_RecentPaymentDetailsZ {
8359         /// The elements in the array.
8360         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8361         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8362         /// The number of elements pointed to by `data`.
8363         pub datalen: usize
8364 }
8365 impl CVec_RecentPaymentDetailsZ {
8366         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8367                 if self.datalen == 0 { return Vec::new(); }
8368                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8369                 self.data = core::ptr::null_mut();
8370                 self.datalen = 0;
8371                 ret
8372         }
8373         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8374                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8375         }
8376 }
8377 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8378         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8379                 let datalen = v.len();
8380                 let data = Box::into_raw(v.into_boxed_slice());
8381                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8382         }
8383 }
8384 #[no_mangle]
8385 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8386 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8387 impl Drop for CVec_RecentPaymentDetailsZ {
8388         fn drop(&mut self) {
8389                 if self.datalen == 0 { return; }
8390                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8391         }
8392 }
8393 #[repr(C)]
8394 /// The contents of CResult_NonePaymentSendFailureZ
8395 pub union CResult_NonePaymentSendFailureZPtr {
8396         /// Note that this value is always NULL, as there are no contents in the OK variant
8397         pub result: *mut core::ffi::c_void,
8398         /// A pointer to the contents in the error state.
8399         /// Reading from this pointer when `result_ok` is set is undefined.
8400         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8401 }
8402 #[repr(C)]
8403 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8404 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8405 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8406 pub struct CResult_NonePaymentSendFailureZ {
8407         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8408         /// `err` or `result` depending on the state of `result_ok`.
8409         pub contents: CResult_NonePaymentSendFailureZPtr,
8410         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8411         pub result_ok: bool,
8412 }
8413 #[no_mangle]
8414 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8415 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8416         CResult_NonePaymentSendFailureZ {
8417                 contents: CResult_NonePaymentSendFailureZPtr {
8418                         result: core::ptr::null_mut(),
8419                 },
8420                 result_ok: true,
8421         }
8422 }
8423 #[no_mangle]
8424 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8425 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8426         CResult_NonePaymentSendFailureZ {
8427                 contents: CResult_NonePaymentSendFailureZPtr {
8428                         err: Box::into_raw(Box::new(e)),
8429                 },
8430                 result_ok: false,
8431         }
8432 }
8433 /// Checks if the given object is currently in the success state
8434 #[no_mangle]
8435 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8436         o.result_ok
8437 }
8438 #[no_mangle]
8439 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8440 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8441 impl Drop for CResult_NonePaymentSendFailureZ {
8442         fn drop(&mut self) {
8443                 if self.result_ok {
8444                 } else {
8445                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8446                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8447                         }
8448                 }
8449         }
8450 }
8451 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8452         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8453                 let contents = if o.result_ok {
8454                         let _ = unsafe { Box::from_raw(o.contents.result) };
8455                         o.contents.result = core::ptr::null_mut();
8456                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8457                 } else {
8458                         let err = unsafe { o.contents.err };
8459                         unsafe { o.contents.err = core::ptr::null_mut(); }
8460                         CResult_NonePaymentSendFailureZPtr { err }
8461                 };
8462                 Self {
8463                         contents,
8464                         result_ok: o.result_ok,
8465                 }
8466         }
8467 }
8468 impl Clone for CResult_NonePaymentSendFailureZ {
8469         fn clone(&self) -> Self {
8470                 if self.result_ok {
8471                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8472                                 result: core::ptr::null_mut()
8473                         } }
8474                 } else {
8475                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8476                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8477                         } }
8478                 }
8479         }
8480 }
8481 #[no_mangle]
8482 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8483 /// but with all dynamically-allocated buffers duplicated in new buffers.
8484 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8485 #[repr(C)]
8486 /// The contents of CResult_NoneRetryableSendFailureZ
8487 pub union CResult_NoneRetryableSendFailureZPtr {
8488         /// Note that this value is always NULL, as there are no contents in the OK variant
8489         pub result: *mut core::ffi::c_void,
8490         /// A pointer to the contents in the error state.
8491         /// Reading from this pointer when `result_ok` is set is undefined.
8492         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8493 }
8494 #[repr(C)]
8495 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8496 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8498 pub struct CResult_NoneRetryableSendFailureZ {
8499         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8500         /// `err` or `result` depending on the state of `result_ok`.
8501         pub contents: CResult_NoneRetryableSendFailureZPtr,
8502         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8503         pub result_ok: bool,
8504 }
8505 #[no_mangle]
8506 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8507 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8508         CResult_NoneRetryableSendFailureZ {
8509                 contents: CResult_NoneRetryableSendFailureZPtr {
8510                         result: core::ptr::null_mut(),
8511                 },
8512                 result_ok: true,
8513         }
8514 }
8515 #[no_mangle]
8516 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8517 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8518         CResult_NoneRetryableSendFailureZ {
8519                 contents: CResult_NoneRetryableSendFailureZPtr {
8520                         err: Box::into_raw(Box::new(e)),
8521                 },
8522                 result_ok: false,
8523         }
8524 }
8525 /// Checks if the given object is currently in the success state
8526 #[no_mangle]
8527 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8528         o.result_ok
8529 }
8530 #[no_mangle]
8531 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8532 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8533 impl Drop for CResult_NoneRetryableSendFailureZ {
8534         fn drop(&mut self) {
8535                 if self.result_ok {
8536                 } else {
8537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8539                         }
8540                 }
8541         }
8542 }
8543 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8544         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8545                 let contents = if o.result_ok {
8546                         let _ = unsafe { Box::from_raw(o.contents.result) };
8547                         o.contents.result = core::ptr::null_mut();
8548                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8549                 } else {
8550                         let err = unsafe { o.contents.err };
8551                         unsafe { o.contents.err = core::ptr::null_mut(); }
8552                         CResult_NoneRetryableSendFailureZPtr { err }
8553                 };
8554                 Self {
8555                         contents,
8556                         result_ok: o.result_ok,
8557                 }
8558         }
8559 }
8560 impl Clone for CResult_NoneRetryableSendFailureZ {
8561         fn clone(&self) -> Self {
8562                 if self.result_ok {
8563                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8564                                 result: core::ptr::null_mut()
8565                         } }
8566                 } else {
8567                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8569                         } }
8570                 }
8571         }
8572 }
8573 #[no_mangle]
8574 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8575 /// but with all dynamically-allocated buffers duplicated in new buffers.
8576 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8577 #[repr(C)]
8578 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
8579 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8580         /// A pointer to the contents in the success state.
8581         /// Reading from this pointer when `result_ok` is not set is undefined.
8582         pub result: *mut crate::c_types::ThirtyTwoBytes,
8583         /// A pointer to the contents in the error state.
8584         /// Reading from this pointer when `result_ok` is set is undefined.
8585         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8586 }
8587 #[repr(C)]
8588 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
8589 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8591 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
8592         /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
8593         /// `err` or `result` depending on the state of `result_ok`.
8594         pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
8595         /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
8596         pub result_ok: bool,
8597 }
8598 #[no_mangle]
8599 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
8600 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8601         CResult_ThirtyTwoBytesPaymentSendFailureZ {
8602                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8603                         result: Box::into_raw(Box::new(o)),
8604                 },
8605                 result_ok: true,
8606         }
8607 }
8608 #[no_mangle]
8609 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
8610 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8611         CResult_ThirtyTwoBytesPaymentSendFailureZ {
8612                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8613                         err: Box::into_raw(Box::new(e)),
8614                 },
8615                 result_ok: false,
8616         }
8617 }
8618 /// Checks if the given object is currently in the success state
8619 #[no_mangle]
8620 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
8621         o.result_ok
8622 }
8623 #[no_mangle]
8624 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
8625 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
8626 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8627         fn drop(&mut self) {
8628                 if self.result_ok {
8629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8631                         }
8632                 } else {
8633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8635                         }
8636                 }
8637         }
8638 }
8639 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8640         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8641                 let contents = if o.result_ok {
8642                         let result = unsafe { o.contents.result };
8643                         unsafe { o.contents.result = core::ptr::null_mut() };
8644                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
8645                 } else {
8646                         let err = unsafe { o.contents.err };
8647                         unsafe { o.contents.err = core::ptr::null_mut(); }
8648                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
8649                 };
8650                 Self {
8651                         contents,
8652                         result_ok: o.result_ok,
8653                 }
8654         }
8655 }
8656 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8657         fn clone(&self) -> Self {
8658                 if self.result_ok {
8659                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8660                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8661                         } }
8662                 } else {
8663                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8664                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8665                         } }
8666                 }
8667         }
8668 }
8669 #[no_mangle]
8670 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
8671 /// but with all dynamically-allocated buffers duplicated in new buffers.
8672 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
8673 #[repr(C)]
8674 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
8675 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8676         /// A pointer to the contents in the success state.
8677         /// Reading from this pointer when `result_ok` is not set is undefined.
8678         pub result: *mut crate::c_types::ThirtyTwoBytes,
8679         /// A pointer to the contents in the error state.
8680         /// Reading from this pointer when `result_ok` is set is undefined.
8681         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8682 }
8683 #[repr(C)]
8684 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
8685 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8687 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
8688         /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
8689         /// `err` or `result` depending on the state of `result_ok`.
8690         pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
8691         /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
8692         pub result_ok: bool,
8693 }
8694 #[no_mangle]
8695 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
8696 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
8697         CResult_ThirtyTwoBytesRetryableSendFailureZ {
8698                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8699                         result: Box::into_raw(Box::new(o)),
8700                 },
8701                 result_ok: true,
8702         }
8703 }
8704 #[no_mangle]
8705 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
8706 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
8707         CResult_ThirtyTwoBytesRetryableSendFailureZ {
8708                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8709                         err: Box::into_raw(Box::new(e)),
8710                 },
8711                 result_ok: false,
8712         }
8713 }
8714 /// Checks if the given object is currently in the success state
8715 #[no_mangle]
8716 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
8717         o.result_ok
8718 }
8719 #[no_mangle]
8720 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
8721 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
8722 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8723         fn drop(&mut self) {
8724                 if self.result_ok {
8725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8727                         }
8728                 } else {
8729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8731                         }
8732                 }
8733         }
8734 }
8735 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8736         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8737                 let contents = if o.result_ok {
8738                         let result = unsafe { o.contents.result };
8739                         unsafe { o.contents.result = core::ptr::null_mut() };
8740                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
8741                 } else {
8742                         let err = unsafe { o.contents.err };
8743                         unsafe { o.contents.err = core::ptr::null_mut(); }
8744                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
8745                 };
8746                 Self {
8747                         contents,
8748                         result_ok: o.result_ok,
8749                 }
8750         }
8751 }
8752 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8753         fn clone(&self) -> Self {
8754                 if self.result_ok {
8755                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8756                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8757                         } }
8758                 } else {
8759                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8760                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8761                         } }
8762                 }
8763         }
8764 }
8765 #[no_mangle]
8766 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
8767 /// but with all dynamically-allocated buffers duplicated in new buffers.
8768 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
8769 #[repr(C)]
8770 /// A tuple of 2 elements. See the individual fields for the types contained.
8771 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8772         /// The element at position 0
8773         pub a: crate::c_types::ThirtyTwoBytes,
8774         /// The element at position 1
8775         pub b: crate::c_types::ThirtyTwoBytes,
8776 }
8777 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8778         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8779                 Self {
8780                         a: tup.0,
8781                         b: tup.1,
8782                 }
8783         }
8784 }
8785 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8786         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8787                 (self.a, self.b)
8788         }
8789 }
8790 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8791         fn clone(&self) -> Self {
8792                 Self {
8793                         a: Clone::clone(&self.a),
8794                         b: Clone::clone(&self.b),
8795                 }
8796         }
8797 }
8798 #[no_mangle]
8799 /// Creates a new tuple which has the same data as `orig`
8800 /// but with all dynamically-allocated buffers duplicated in new buffers.
8801 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
8802 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
8803 #[no_mangle]
8804 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8805         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
8806 }
8807
8808 #[no_mangle]
8809 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
8810 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
8811 #[repr(C)]
8812 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
8813 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8814         /// A pointer to the contents in the success state.
8815         /// Reading from this pointer when `result_ok` is not set is undefined.
8816         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
8817         /// A pointer to the contents in the error state.
8818         /// Reading from this pointer when `result_ok` is set is undefined.
8819         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8820 }
8821 #[repr(C)]
8822 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
8823 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8825 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8826         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
8827         /// `err` or `result` depending on the state of `result_ok`.
8828         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
8829         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
8830         pub result_ok: bool,
8831 }
8832 #[no_mangle]
8833 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
8834 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8835         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8836                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8837                         result: Box::into_raw(Box::new(o)),
8838                 },
8839                 result_ok: true,
8840         }
8841 }
8842 #[no_mangle]
8843 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
8844 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8845         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8846                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8847                         err: Box::into_raw(Box::new(e)),
8848                 },
8849                 result_ok: false,
8850         }
8851 }
8852 /// Checks if the given object is currently in the success state
8853 #[no_mangle]
8854 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
8855         o.result_ok
8856 }
8857 #[no_mangle]
8858 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
8859 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
8860 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8861         fn drop(&mut self) {
8862                 if self.result_ok {
8863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8865                         }
8866                 } else {
8867                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8868                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8869                         }
8870                 }
8871         }
8872 }
8873 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8874         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8875                 let contents = if o.result_ok {
8876                         let result = unsafe { o.contents.result };
8877                         unsafe { o.contents.result = core::ptr::null_mut() };
8878                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
8879                 } else {
8880                         let err = unsafe { o.contents.err };
8881                         unsafe { o.contents.err = core::ptr::null_mut(); }
8882                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
8883                 };
8884                 Self {
8885                         contents,
8886                         result_ok: o.result_ok,
8887                 }
8888         }
8889 }
8890 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8891         fn clone(&self) -> Self {
8892                 if self.result_ok {
8893                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8894                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
8895                         } }
8896                 } else {
8897                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8898                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8899                         } }
8900                 }
8901         }
8902 }
8903 #[no_mangle]
8904 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
8905 /// but with all dynamically-allocated buffers duplicated in new buffers.
8906 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
8907 #[repr(C)]
8908 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
8909 /// This corresponds to std::vector in C++
8910 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8911         /// The elements in the array.
8912         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8913         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
8914         /// The number of elements pointed to by `data`.
8915         pub datalen: usize
8916 }
8917 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8918         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
8919                 if self.datalen == 0 { return Vec::new(); }
8920                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8921                 self.data = core::ptr::null_mut();
8922                 self.datalen = 0;
8923                 ret
8924         }
8925         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
8926                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8927         }
8928 }
8929 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8930         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
8931                 let datalen = v.len();
8932                 let data = Box::into_raw(v.into_boxed_slice());
8933                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8934         }
8935 }
8936 #[no_mangle]
8937 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8938 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
8939 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8940         fn drop(&mut self) {
8941                 if self.datalen == 0 { return; }
8942                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8943         }
8944 }
8945 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8946         fn clone(&self) -> Self {
8947                 let mut res = Vec::new();
8948                 if self.datalen == 0 { return Self::from(res); }
8949                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8950                 Self::from(res)
8951         }
8952 }
8953 #[repr(C)]
8954 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
8955 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8956         /// A pointer to the contents in the success state.
8957         /// Reading from this pointer when `result_ok` is not set is undefined.
8958         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
8959         /// A pointer to the contents in the error state.
8960         /// Reading from this pointer when `result_ok` is set is undefined.
8961         pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
8962 }
8963 #[repr(C)]
8964 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
8965 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
8966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8967 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8968         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
8969         /// `err` or `result` depending on the state of `result_ok`.
8970         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
8971         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
8972         pub result_ok: bool,
8973 }
8974 #[no_mangle]
8975 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
8976 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8977         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8978                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8979                         result: Box::into_raw(Box::new(o)),
8980                 },
8981                 result_ok: true,
8982         }
8983 }
8984 #[no_mangle]
8985 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
8986 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8987         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8988                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8989                         err: Box::into_raw(Box::new(e)),
8990                 },
8991                 result_ok: false,
8992         }
8993 }
8994 /// Checks if the given object is currently in the success state
8995 #[no_mangle]
8996 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
8997         o.result_ok
8998 }
8999 #[no_mangle]
9000 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
9001 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
9002 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9003         fn drop(&mut self) {
9004                 if self.result_ok {
9005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9007                         }
9008                 } else {
9009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9011                         }
9012                 }
9013         }
9014 }
9015 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9016         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
9017                 let contents = if o.result_ok {
9018                         let result = unsafe { o.contents.result };
9019                         unsafe { o.contents.result = core::ptr::null_mut() };
9020                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
9021                 } else {
9022                         let err = unsafe { o.contents.err };
9023                         unsafe { o.contents.err = core::ptr::null_mut(); }
9024                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
9025                 };
9026                 Self {
9027                         contents,
9028                         result_ok: o.result_ok,
9029                 }
9030         }
9031 }
9032 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9033         fn clone(&self) -> Self {
9034                 if self.result_ok {
9035                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9036                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
9037                         } }
9038                 } else {
9039                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9040                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
9041                         } }
9042                 }
9043         }
9044 }
9045 #[no_mangle]
9046 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
9047 /// but with all dynamically-allocated buffers duplicated in new buffers.
9048 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
9049 #[repr(C)]
9050 /// A tuple of 2 elements. See the individual fields for the types contained.
9051 pub struct C2Tuple_ThirtyTwoBytesPublicKeyZ {
9052         /// The element at position 0
9053         pub a: crate::c_types::ThirtyTwoBytes,
9054         /// The element at position 1
9055         pub b: crate::c_types::PublicKey,
9056 }
9057 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)> for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9058         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)) -> Self {
9059                 Self {
9060                         a: tup.0,
9061                         b: tup.1,
9062                 }
9063         }
9064 }
9065 impl C2Tuple_ThirtyTwoBytesPublicKeyZ {
9066         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey) {
9067                 (self.a, self.b)
9068         }
9069 }
9070 impl Clone for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9071         fn clone(&self) -> Self {
9072                 Self {
9073                         a: Clone::clone(&self.a),
9074                         b: Clone::clone(&self.b),
9075                 }
9076         }
9077 }
9078 #[no_mangle]
9079 /// Creates a new tuple which has the same data as `orig`
9080 /// but with all dynamically-allocated buffers duplicated in new buffers.
9081 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig: &C2Tuple_ThirtyTwoBytesPublicKeyZ) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { Clone::clone(&orig) }
9082 /// Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements.
9083 #[no_mangle]
9084 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::PublicKey) -> C2Tuple_ThirtyTwoBytesPublicKeyZ {
9085         C2Tuple_ThirtyTwoBytesPublicKeyZ { a, b, }
9086 }
9087
9088 #[no_mangle]
9089 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ.
9090 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res: C2Tuple_ThirtyTwoBytesPublicKeyZ) { }
9091 #[repr(C)]
9092 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size.
9093 /// This corresponds to std::vector in C++
9094 pub struct CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9095         /// The elements in the array.
9096         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9097         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ,
9098         /// The number of elements pointed to by `data`.
9099         pub datalen: usize
9100 }
9101 impl CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9102         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ> {
9103                 if self.datalen == 0 { return Vec::new(); }
9104                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9105                 self.data = core::ptr::null_mut();
9106                 self.datalen = 0;
9107                 ret
9108         }
9109         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ] {
9110                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9111         }
9112 }
9113 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>> for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9114         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>) -> Self {
9115                 let datalen = v.len();
9116                 let data = Box::into_raw(v.into_boxed_slice());
9117                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9118         }
9119 }
9120 #[no_mangle]
9121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9122 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ) { }
9123 impl Drop for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9124         fn drop(&mut self) {
9125                 if self.datalen == 0 { return; }
9126                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9127         }
9128 }
9129 impl Clone for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9130         fn clone(&self) -> Self {
9131                 let mut res = Vec::new();
9132                 if self.datalen == 0 { return Self::from(res); }
9133                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9134                 Self::from(res)
9135         }
9136 }
9137 #[repr(C)]
9138 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9139 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9140         /// A pointer to the contents in the success state.
9141         /// Reading from this pointer when `result_ok` is not set is undefined.
9142         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9143         /// Note that this value is always NULL, as there are no contents in the Err variant
9144         pub err: *mut core::ffi::c_void,
9145 }
9146 #[repr(C)]
9147 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9148 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9150 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9151         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9152         /// `err` or `result` depending on the state of `result_ok`.
9153         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9154         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9155         pub result_ok: bool,
9156 }
9157 #[no_mangle]
9158 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9159 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9160         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9161                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9162                         result: Box::into_raw(Box::new(o)),
9163                 },
9164                 result_ok: true,
9165         }
9166 }
9167 #[no_mangle]
9168 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9169 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9170         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9171                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9172                         err: core::ptr::null_mut(),
9173                 },
9174                 result_ok: false,
9175         }
9176 }
9177 /// Checks if the given object is currently in the success state
9178 #[no_mangle]
9179 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9180         o.result_ok
9181 }
9182 #[no_mangle]
9183 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9184 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9185 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9186         fn drop(&mut self) {
9187                 if self.result_ok {
9188                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9189                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9190                         }
9191                 } else {
9192                 }
9193         }
9194 }
9195 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9196         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9197                 let contents = if o.result_ok {
9198                         let result = unsafe { o.contents.result };
9199                         unsafe { o.contents.result = core::ptr::null_mut() };
9200                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9201                 } else {
9202                         let _ = unsafe { Box::from_raw(o.contents.err) };
9203                         o.contents.err = core::ptr::null_mut();
9204                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9205                 };
9206                 Self {
9207                         contents,
9208                         result_ok: o.result_ok,
9209                 }
9210         }
9211 }
9212 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9213         fn clone(&self) -> Self {
9214                 if self.result_ok {
9215                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9216                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9217                         } }
9218                 } else {
9219                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9220                                 err: core::ptr::null_mut()
9221                         } }
9222                 }
9223         }
9224 }
9225 #[no_mangle]
9226 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9227 /// but with all dynamically-allocated buffers duplicated in new buffers.
9228 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9229 #[repr(C)]
9230 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9231 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9232         /// A pointer to the contents in the success state.
9233         /// Reading from this pointer when `result_ok` is not set is undefined.
9234         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9235         /// A pointer to the contents in the error state.
9236         /// Reading from this pointer when `result_ok` is set is undefined.
9237         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9238 }
9239 #[repr(C)]
9240 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9241 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9243 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9244         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9245         /// `err` or `result` depending on the state of `result_ok`.
9246         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9247         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9248         pub result_ok: bool,
9249 }
9250 #[no_mangle]
9251 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9252 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9253         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9254                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9255                         result: Box::into_raw(Box::new(o)),
9256                 },
9257                 result_ok: true,
9258         }
9259 }
9260 #[no_mangle]
9261 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9262 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9263         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9264                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9265                         err: Box::into_raw(Box::new(e)),
9266                 },
9267                 result_ok: false,
9268         }
9269 }
9270 /// Checks if the given object is currently in the success state
9271 #[no_mangle]
9272 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9273         o.result_ok
9274 }
9275 #[no_mangle]
9276 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9277 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9278 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9279         fn drop(&mut self) {
9280                 if self.result_ok {
9281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9283                         }
9284                 } else {
9285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9287                         }
9288                 }
9289         }
9290 }
9291 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9292         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9293                 let contents = if o.result_ok {
9294                         let result = unsafe { o.contents.result };
9295                         unsafe { o.contents.result = core::ptr::null_mut() };
9296                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9297                 } else {
9298                         let err = unsafe { o.contents.err };
9299                         unsafe { o.contents.err = core::ptr::null_mut(); }
9300                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9301                 };
9302                 Self {
9303                         contents,
9304                         result_ok: o.result_ok,
9305                 }
9306         }
9307 }
9308 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9309         fn clone(&self) -> Self {
9310                 if self.result_ok {
9311                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9312                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9313                         } }
9314                 } else {
9315                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9316                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9317                         } }
9318                 }
9319         }
9320 }
9321 #[no_mangle]
9322 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9323 /// but with all dynamically-allocated buffers duplicated in new buffers.
9324 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9325 #[repr(C)]
9326 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9327 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9328         /// A pointer to the contents in the success state.
9329         /// Reading from this pointer when `result_ok` is not set is undefined.
9330         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9331         /// A pointer to the contents in the error state.
9332         /// Reading from this pointer when `result_ok` is set is undefined.
9333         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9334 }
9335 #[repr(C)]
9336 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9337 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9339 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9340         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9341         /// `err` or `result` depending on the state of `result_ok`.
9342         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9343         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9344         pub result_ok: bool,
9345 }
9346 #[no_mangle]
9347 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9348 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9349         CResult_ChannelCounterpartyDecodeErrorZ {
9350                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9351                         result: Box::into_raw(Box::new(o)),
9352                 },
9353                 result_ok: true,
9354         }
9355 }
9356 #[no_mangle]
9357 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9358 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9359         CResult_ChannelCounterpartyDecodeErrorZ {
9360                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9361                         err: Box::into_raw(Box::new(e)),
9362                 },
9363                 result_ok: false,
9364         }
9365 }
9366 /// Checks if the given object is currently in the success state
9367 #[no_mangle]
9368 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9369         o.result_ok
9370 }
9371 #[no_mangle]
9372 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9373 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9374 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9375         fn drop(&mut self) {
9376                 if self.result_ok {
9377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9379                         }
9380                 } else {
9381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9383                         }
9384                 }
9385         }
9386 }
9387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9389                 let contents = if o.result_ok {
9390                         let result = unsafe { o.contents.result };
9391                         unsafe { o.contents.result = core::ptr::null_mut() };
9392                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9393                 } else {
9394                         let err = unsafe { o.contents.err };
9395                         unsafe { o.contents.err = core::ptr::null_mut(); }
9396                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9397                 };
9398                 Self {
9399                         contents,
9400                         result_ok: o.result_ok,
9401                 }
9402         }
9403 }
9404 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9405         fn clone(&self) -> Self {
9406                 if self.result_ok {
9407                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9409                         } }
9410                 } else {
9411                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9413                         } }
9414                 }
9415         }
9416 }
9417 #[no_mangle]
9418 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9419 /// but with all dynamically-allocated buffers duplicated in new buffers.
9420 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9421 #[repr(C)]
9422 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9423 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9424         /// A pointer to the contents in the success state.
9425         /// Reading from this pointer when `result_ok` is not set is undefined.
9426         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9427         /// A pointer to the contents in the error state.
9428         /// Reading from this pointer when `result_ok` is set is undefined.
9429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9430 }
9431 #[repr(C)]
9432 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9433 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9435 pub struct CResult_ChannelDetailsDecodeErrorZ {
9436         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9437         /// `err` or `result` depending on the state of `result_ok`.
9438         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9439         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9440         pub result_ok: bool,
9441 }
9442 #[no_mangle]
9443 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9444 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9445         CResult_ChannelDetailsDecodeErrorZ {
9446                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9447                         result: Box::into_raw(Box::new(o)),
9448                 },
9449                 result_ok: true,
9450         }
9451 }
9452 #[no_mangle]
9453 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9454 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9455         CResult_ChannelDetailsDecodeErrorZ {
9456                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9457                         err: Box::into_raw(Box::new(e)),
9458                 },
9459                 result_ok: false,
9460         }
9461 }
9462 /// Checks if the given object is currently in the success state
9463 #[no_mangle]
9464 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9465         o.result_ok
9466 }
9467 #[no_mangle]
9468 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9469 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9470 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9471         fn drop(&mut self) {
9472                 if self.result_ok {
9473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9475                         }
9476                 } else {
9477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9479                         }
9480                 }
9481         }
9482 }
9483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9485                 let contents = if o.result_ok {
9486                         let result = unsafe { o.contents.result };
9487                         unsafe { o.contents.result = core::ptr::null_mut() };
9488                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9489                 } else {
9490                         let err = unsafe { o.contents.err };
9491                         unsafe { o.contents.err = core::ptr::null_mut(); }
9492                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9493                 };
9494                 Self {
9495                         contents,
9496                         result_ok: o.result_ok,
9497                 }
9498         }
9499 }
9500 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9501         fn clone(&self) -> Self {
9502                 if self.result_ok {
9503                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9504                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9505                         } }
9506                 } else {
9507                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9509                         } }
9510                 }
9511         }
9512 }
9513 #[no_mangle]
9514 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9515 /// but with all dynamically-allocated buffers duplicated in new buffers.
9516 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9517 #[repr(C)]
9518 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9519 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9520         /// A pointer to the contents in the success state.
9521         /// Reading from this pointer when `result_ok` is not set is undefined.
9522         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9523         /// A pointer to the contents in the error state.
9524         /// Reading from this pointer when `result_ok` is set is undefined.
9525         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9526 }
9527 #[repr(C)]
9528 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9529 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9531 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9532         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9533         /// `err` or `result` depending on the state of `result_ok`.
9534         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9535         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9536         pub result_ok: bool,
9537 }
9538 #[no_mangle]
9539 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9540 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9541         CResult_PhantomRouteHintsDecodeErrorZ {
9542                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9543                         result: Box::into_raw(Box::new(o)),
9544                 },
9545                 result_ok: true,
9546         }
9547 }
9548 #[no_mangle]
9549 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9550 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9551         CResult_PhantomRouteHintsDecodeErrorZ {
9552                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9553                         err: Box::into_raw(Box::new(e)),
9554                 },
9555                 result_ok: false,
9556         }
9557 }
9558 /// Checks if the given object is currently in the success state
9559 #[no_mangle]
9560 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9561         o.result_ok
9562 }
9563 #[no_mangle]
9564 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9565 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9566 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9567         fn drop(&mut self) {
9568                 if self.result_ok {
9569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9571                         }
9572                 } else {
9573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9575                         }
9576                 }
9577         }
9578 }
9579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9580         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9581                 let contents = if o.result_ok {
9582                         let result = unsafe { o.contents.result };
9583                         unsafe { o.contents.result = core::ptr::null_mut() };
9584                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9585                 } else {
9586                         let err = unsafe { o.contents.err };
9587                         unsafe { o.contents.err = core::ptr::null_mut(); }
9588                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9589                 };
9590                 Self {
9591                         contents,
9592                         result_ok: o.result_ok,
9593                 }
9594         }
9595 }
9596 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9597         fn clone(&self) -> Self {
9598                 if self.result_ok {
9599                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9600                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9601                         } }
9602                 } else {
9603                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9605                         } }
9606                 }
9607         }
9608 }
9609 #[no_mangle]
9610 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9611 /// but with all dynamically-allocated buffers duplicated in new buffers.
9612 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9613 #[repr(C)]
9614 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9615 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9616         /// A pointer to the contents in the success state.
9617         /// Reading from this pointer when `result_ok` is not set is undefined.
9618         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9619         /// A pointer to the contents in the error state.
9620         /// Reading from this pointer when `result_ok` is set is undefined.
9621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9622 }
9623 #[repr(C)]
9624 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9625 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9627 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9628         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9629         /// `err` or `result` depending on the state of `result_ok`.
9630         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9631         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9632         pub result_ok: bool,
9633 }
9634 #[no_mangle]
9635 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9636 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9637         CResult_ChannelShutdownStateDecodeErrorZ {
9638                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9639                         result: Box::into_raw(Box::new(o)),
9640                 },
9641                 result_ok: true,
9642         }
9643 }
9644 #[no_mangle]
9645 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9646 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9647         CResult_ChannelShutdownStateDecodeErrorZ {
9648                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9649                         err: Box::into_raw(Box::new(e)),
9650                 },
9651                 result_ok: false,
9652         }
9653 }
9654 /// Checks if the given object is currently in the success state
9655 #[no_mangle]
9656 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9657         o.result_ok
9658 }
9659 #[no_mangle]
9660 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9661 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9662 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9663         fn drop(&mut self) {
9664                 if self.result_ok {
9665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9667                         }
9668                 } else {
9669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9671                         }
9672                 }
9673         }
9674 }
9675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9677                 let contents = if o.result_ok {
9678                         let result = unsafe { o.contents.result };
9679                         unsafe { o.contents.result = core::ptr::null_mut() };
9680                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9681                 } else {
9682                         let err = unsafe { o.contents.err };
9683                         unsafe { o.contents.err = core::ptr::null_mut(); }
9684                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9685                 };
9686                 Self {
9687                         contents,
9688                         result_ok: o.result_ok,
9689                 }
9690         }
9691 }
9692 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9693         fn clone(&self) -> Self {
9694                 if self.result_ok {
9695                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9697                         } }
9698                 } else {
9699                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9701                         } }
9702                 }
9703         }
9704 }
9705 #[no_mangle]
9706 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9707 /// but with all dynamically-allocated buffers duplicated in new buffers.
9708 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9709 #[repr(C)]
9710 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9711 /// This corresponds to std::vector in C++
9712 pub struct CVec_ChannelMonitorZ {
9713         /// The elements in the array.
9714         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9715         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9716         /// The number of elements pointed to by `data`.
9717         pub datalen: usize
9718 }
9719 impl CVec_ChannelMonitorZ {
9720         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9721                 if self.datalen == 0 { return Vec::new(); }
9722                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9723                 self.data = core::ptr::null_mut();
9724                 self.datalen = 0;
9725                 ret
9726         }
9727         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9728                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9729         }
9730 }
9731 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9732         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9733                 let datalen = v.len();
9734                 let data = Box::into_raw(v.into_boxed_slice());
9735                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9736         }
9737 }
9738 #[no_mangle]
9739 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9740 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9741 impl Drop for CVec_ChannelMonitorZ {
9742         fn drop(&mut self) {
9743                 if self.datalen == 0 { return; }
9744                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9745         }
9746 }
9747 impl Clone for CVec_ChannelMonitorZ {
9748         fn clone(&self) -> Self {
9749                 let mut res = Vec::new();
9750                 if self.datalen == 0 { return Self::from(res); }
9751                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9752                 Self::from(res)
9753         }
9754 }
9755 #[repr(C)]
9756 /// A tuple of 2 elements. See the individual fields for the types contained.
9757 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
9758         /// The element at position 0
9759         pub a: crate::c_types::ThirtyTwoBytes,
9760         /// The element at position 1
9761         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9762 }
9763 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
9764         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9765                 Self {
9766                         a: tup.0,
9767                         b: tup.1,
9768                 }
9769         }
9770 }
9771 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
9772         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9773                 (self.a, self.b)
9774         }
9775 }
9776 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
9777 #[no_mangle]
9778 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
9779         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
9780 }
9781
9782 #[no_mangle]
9783 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
9784 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
9785 #[repr(C)]
9786 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
9787 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9788         /// A pointer to the contents in the success state.
9789         /// Reading from this pointer when `result_ok` is not set is undefined.
9790         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
9791         /// A pointer to the contents in the error state.
9792         /// Reading from this pointer when `result_ok` is set is undefined.
9793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9794 }
9795 #[repr(C)]
9796 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9797 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9800         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
9801         /// `err` or `result` depending on the state of `result_ok`.
9802         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
9803         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
9804         pub result_ok: bool,
9805 }
9806 #[no_mangle]
9807 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
9808 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9809         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9810                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9811                         result: Box::into_raw(Box::new(o)),
9812                 },
9813                 result_ok: true,
9814         }
9815 }
9816 #[no_mangle]
9817 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
9818 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9819         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9820                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9821                         err: Box::into_raw(Box::new(e)),
9822                 },
9823                 result_ok: false,
9824         }
9825 }
9826 /// Checks if the given object is currently in the success state
9827 #[no_mangle]
9828 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
9829         o.result_ok
9830 }
9831 #[no_mangle]
9832 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
9833 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
9834 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9835         fn drop(&mut self) {
9836                 if self.result_ok {
9837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9839                         }
9840                 } else {
9841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9843                         }
9844                 }
9845         }
9846 }
9847 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9848         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9849                 let contents = if o.result_ok {
9850                         let result = unsafe { o.contents.result };
9851                         unsafe { o.contents.result = core::ptr::null_mut() };
9852                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
9853                 } else {
9854                         let err = unsafe { o.contents.err };
9855                         unsafe { o.contents.err = core::ptr::null_mut(); }
9856                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
9857                 };
9858                 Self {
9859                         contents,
9860                         result_ok: o.result_ok,
9861                 }
9862         }
9863 }
9864 #[repr(C)]
9865 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
9866 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9867         /// A pointer to the contents in the success state.
9868         /// Reading from this pointer when `result_ok` is not set is undefined.
9869         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
9870         /// A pointer to the contents in the error state.
9871         /// Reading from this pointer when `result_ok` is set is undefined.
9872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9873 }
9874 #[repr(C)]
9875 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
9876 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
9877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9878 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
9879         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
9880         /// `err` or `result` depending on the state of `result_ok`.
9881         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
9882         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
9883         pub result_ok: bool,
9884 }
9885 #[no_mangle]
9886 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
9887 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9888         CResult_MaxDustHTLCExposureDecodeErrorZ {
9889                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9890                         result: Box::into_raw(Box::new(o)),
9891                 },
9892                 result_ok: true,
9893         }
9894 }
9895 #[no_mangle]
9896 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
9897 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9898         CResult_MaxDustHTLCExposureDecodeErrorZ {
9899                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9900                         err: Box::into_raw(Box::new(e)),
9901                 },
9902                 result_ok: false,
9903         }
9904 }
9905 /// Checks if the given object is currently in the success state
9906 #[no_mangle]
9907 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
9908         o.result_ok
9909 }
9910 #[no_mangle]
9911 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
9912 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
9913 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
9914         fn drop(&mut self) {
9915                 if self.result_ok {
9916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9918                         }
9919                 } else {
9920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9922                         }
9923                 }
9924         }
9925 }
9926 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
9927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
9928                 let contents = if o.result_ok {
9929                         let result = unsafe { o.contents.result };
9930                         unsafe { o.contents.result = core::ptr::null_mut() };
9931                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
9932                 } else {
9933                         let err = unsafe { o.contents.err };
9934                         unsafe { o.contents.err = core::ptr::null_mut(); }
9935                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
9936                 };
9937                 Self {
9938                         contents,
9939                         result_ok: o.result_ok,
9940                 }
9941         }
9942 }
9943 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
9944         fn clone(&self) -> Self {
9945                 if self.result_ok {
9946                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9947                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
9948                         } }
9949                 } else {
9950                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9952                         } }
9953                 }
9954         }
9955 }
9956 #[no_mangle]
9957 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
9958 /// but with all dynamically-allocated buffers duplicated in new buffers.
9959 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
9960 #[repr(C)]
9961 /// The contents of CResult_ChannelConfigDecodeErrorZ
9962 pub union CResult_ChannelConfigDecodeErrorZPtr {
9963         /// A pointer to the contents in the success state.
9964         /// Reading from this pointer when `result_ok` is not set is undefined.
9965         pub result: *mut crate::lightning::util::config::ChannelConfig,
9966         /// A pointer to the contents in the error state.
9967         /// Reading from this pointer when `result_ok` is set is undefined.
9968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9969 }
9970 #[repr(C)]
9971 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9972 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9974 pub struct CResult_ChannelConfigDecodeErrorZ {
9975         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9976         /// `err` or `result` depending on the state of `result_ok`.
9977         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9978         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9979         pub result_ok: bool,
9980 }
9981 #[no_mangle]
9982 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9983 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9984         CResult_ChannelConfigDecodeErrorZ {
9985                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9986                         result: Box::into_raw(Box::new(o)),
9987                 },
9988                 result_ok: true,
9989         }
9990 }
9991 #[no_mangle]
9992 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9993 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9994         CResult_ChannelConfigDecodeErrorZ {
9995                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9996                         err: Box::into_raw(Box::new(e)),
9997                 },
9998                 result_ok: false,
9999         }
10000 }
10001 /// Checks if the given object is currently in the success state
10002 #[no_mangle]
10003 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10004         o.result_ok
10005 }
10006 #[no_mangle]
10007 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10008 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10009 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10010         fn drop(&mut self) {
10011                 if self.result_ok {
10012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10014                         }
10015                 } else {
10016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10018                         }
10019                 }
10020         }
10021 }
10022 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10024                 let contents = if o.result_ok {
10025                         let result = unsafe { o.contents.result };
10026                         unsafe { o.contents.result = core::ptr::null_mut() };
10027                         CResult_ChannelConfigDecodeErrorZPtr { result }
10028                 } else {
10029                         let err = unsafe { o.contents.err };
10030                         unsafe { o.contents.err = core::ptr::null_mut(); }
10031                         CResult_ChannelConfigDecodeErrorZPtr { err }
10032                 };
10033                 Self {
10034                         contents,
10035                         result_ok: o.result_ok,
10036                 }
10037         }
10038 }
10039 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10040         fn clone(&self) -> Self {
10041                 if self.result_ok {
10042                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10043                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10044                         } }
10045                 } else {
10046                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10048                         } }
10049                 }
10050         }
10051 }
10052 #[no_mangle]
10053 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10054 /// but with all dynamically-allocated buffers duplicated in new buffers.
10055 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10056 #[repr(C)]
10057 #[derive(Clone)]
10058 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
10059 pub enum COption_MaxDustHTLCExposureZ {
10060         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
10061         Some(crate::lightning::util::config::MaxDustHTLCExposure),
10062         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
10063         None
10064 }
10065 impl COption_MaxDustHTLCExposureZ {
10066         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10067                 if let Self::None = self { false } else { true }
10068         }
10069         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10070                 !self.is_some()
10071         }
10072         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
10073                 if let Self::Some(v) = self { v } else { unreachable!() }
10074         }
10075 }
10076 #[no_mangle]
10077 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
10078 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
10079         COption_MaxDustHTLCExposureZ::Some(o)
10080 }
10081 #[no_mangle]
10082 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
10083 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
10084         COption_MaxDustHTLCExposureZ::None
10085 }
10086 #[no_mangle]
10087 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
10088 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
10089 #[no_mangle]
10090 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
10091 /// but with all dynamically-allocated buffers duplicated in new buffers.
10092 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
10093 #[repr(C)]
10094 #[derive(Clone)]
10095 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10096 pub enum COption_APIErrorZ {
10097         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10098         Some(crate::lightning::util::errors::APIError),
10099         /// When we're in this state, this COption_APIErrorZ contains nothing
10100         None
10101 }
10102 impl COption_APIErrorZ {
10103         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10104                 if let Self::None = self { false } else { true }
10105         }
10106         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10107                 !self.is_some()
10108         }
10109         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10110                 if let Self::Some(v) = self { v } else { unreachable!() }
10111         }
10112 }
10113 #[no_mangle]
10114 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10115 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10116         COption_APIErrorZ::Some(o)
10117 }
10118 #[no_mangle]
10119 /// Constructs a new COption_APIErrorZ containing nothing
10120 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10121         COption_APIErrorZ::None
10122 }
10123 #[no_mangle]
10124 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10125 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10126 #[no_mangle]
10127 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10128 /// but with all dynamically-allocated buffers duplicated in new buffers.
10129 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10130 #[repr(C)]
10131 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10132 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10133         /// A pointer to the contents in the success state.
10134         /// Reading from this pointer when `result_ok` is not set is undefined.
10135         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10136         /// A pointer to the contents in the error state.
10137         /// Reading from this pointer when `result_ok` is set is undefined.
10138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10139 }
10140 #[repr(C)]
10141 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10142 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10145         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10146         /// `err` or `result` depending on the state of `result_ok`.
10147         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10148         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10149         pub result_ok: bool,
10150 }
10151 #[no_mangle]
10152 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10153 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10154         CResult_COption_APIErrorZDecodeErrorZ {
10155                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10156                         result: Box::into_raw(Box::new(o)),
10157                 },
10158                 result_ok: true,
10159         }
10160 }
10161 #[no_mangle]
10162 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10163 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10164         CResult_COption_APIErrorZDecodeErrorZ {
10165                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10166                         err: Box::into_raw(Box::new(e)),
10167                 },
10168                 result_ok: false,
10169         }
10170 }
10171 /// Checks if the given object is currently in the success state
10172 #[no_mangle]
10173 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10174         o.result_ok
10175 }
10176 #[no_mangle]
10177 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10178 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10179 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10180         fn drop(&mut self) {
10181                 if self.result_ok {
10182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10184                         }
10185                 } else {
10186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10188                         }
10189                 }
10190         }
10191 }
10192 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10193         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10194                 let contents = if o.result_ok {
10195                         let result = unsafe { o.contents.result };
10196                         unsafe { o.contents.result = core::ptr::null_mut() };
10197                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
10198                 } else {
10199                         let err = unsafe { o.contents.err };
10200                         unsafe { o.contents.err = core::ptr::null_mut(); }
10201                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
10202                 };
10203                 Self {
10204                         contents,
10205                         result_ok: o.result_ok,
10206                 }
10207         }
10208 }
10209 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10210         fn clone(&self) -> Self {
10211                 if self.result_ok {
10212                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10213                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10214                         } }
10215                 } else {
10216                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10218                         } }
10219                 }
10220         }
10221 }
10222 #[no_mangle]
10223 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10224 /// but with all dynamically-allocated buffers duplicated in new buffers.
10225 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10226 #[repr(C)]
10227 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10228 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10229         /// A pointer to the contents in the success state.
10230         /// Reading from this pointer when `result_ok` is not set is undefined.
10231         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10232         /// A pointer to the contents in the error state.
10233         /// Reading from this pointer when `result_ok` is set is undefined.
10234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10235 }
10236 #[repr(C)]
10237 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10238 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10240 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10241         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10242         /// `err` or `result` depending on the state of `result_ok`.
10243         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10244         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10245         pub result_ok: bool,
10246 }
10247 #[no_mangle]
10248 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10249 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10250         CResult_ChannelMonitorUpdateDecodeErrorZ {
10251                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10252                         result: Box::into_raw(Box::new(o)),
10253                 },
10254                 result_ok: true,
10255         }
10256 }
10257 #[no_mangle]
10258 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10259 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10260         CResult_ChannelMonitorUpdateDecodeErrorZ {
10261                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10262                         err: Box::into_raw(Box::new(e)),
10263                 },
10264                 result_ok: false,
10265         }
10266 }
10267 /// Checks if the given object is currently in the success state
10268 #[no_mangle]
10269 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10270         o.result_ok
10271 }
10272 #[no_mangle]
10273 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10274 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10275 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10276         fn drop(&mut self) {
10277                 if self.result_ok {
10278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10280                         }
10281                 } else {
10282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10284                         }
10285                 }
10286         }
10287 }
10288 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10290                 let contents = if o.result_ok {
10291                         let result = unsafe { o.contents.result };
10292                         unsafe { o.contents.result = core::ptr::null_mut() };
10293                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10294                 } else {
10295                         let err = unsafe { o.contents.err };
10296                         unsafe { o.contents.err = core::ptr::null_mut(); }
10297                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10298                 };
10299                 Self {
10300                         contents,
10301                         result_ok: o.result_ok,
10302                 }
10303         }
10304 }
10305 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10306         fn clone(&self) -> Self {
10307                 if self.result_ok {
10308                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10309                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10310                         } }
10311                 } else {
10312                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10314                         } }
10315                 }
10316         }
10317 }
10318 #[no_mangle]
10319 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10320 /// but with all dynamically-allocated buffers duplicated in new buffers.
10321 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10322 #[repr(C)]
10323 #[derive(Clone)]
10324 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10325 pub enum COption_MonitorEventZ {
10326         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10327         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10328         /// When we're in this state, this COption_MonitorEventZ contains nothing
10329         None
10330 }
10331 impl COption_MonitorEventZ {
10332         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10333                 if let Self::None = self { false } else { true }
10334         }
10335         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10336                 !self.is_some()
10337         }
10338         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10339                 if let Self::Some(v) = self { v } else { unreachable!() }
10340         }
10341 }
10342 #[no_mangle]
10343 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10344 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10345         COption_MonitorEventZ::Some(o)
10346 }
10347 #[no_mangle]
10348 /// Constructs a new COption_MonitorEventZ containing nothing
10349 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10350         COption_MonitorEventZ::None
10351 }
10352 #[no_mangle]
10353 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10354 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10355 #[no_mangle]
10356 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10357 /// but with all dynamically-allocated buffers duplicated in new buffers.
10358 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10359 #[repr(C)]
10360 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10361 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10362         /// A pointer to the contents in the success state.
10363         /// Reading from this pointer when `result_ok` is not set is undefined.
10364         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10365         /// A pointer to the contents in the error state.
10366         /// Reading from this pointer when `result_ok` is set is undefined.
10367         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10368 }
10369 #[repr(C)]
10370 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10371 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10373 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10374         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10375         /// `err` or `result` depending on the state of `result_ok`.
10376         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10377         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10378         pub result_ok: bool,
10379 }
10380 #[no_mangle]
10381 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10382 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10383         CResult_COption_MonitorEventZDecodeErrorZ {
10384                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10385                         result: Box::into_raw(Box::new(o)),
10386                 },
10387                 result_ok: true,
10388         }
10389 }
10390 #[no_mangle]
10391 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10392 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10393         CResult_COption_MonitorEventZDecodeErrorZ {
10394                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10395                         err: Box::into_raw(Box::new(e)),
10396                 },
10397                 result_ok: false,
10398         }
10399 }
10400 /// Checks if the given object is currently in the success state
10401 #[no_mangle]
10402 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10403         o.result_ok
10404 }
10405 #[no_mangle]
10406 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10407 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10408 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10409         fn drop(&mut self) {
10410                 if self.result_ok {
10411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10413                         }
10414                 } else {
10415                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10416                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10417                         }
10418                 }
10419         }
10420 }
10421 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10422         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10423                 let contents = if o.result_ok {
10424                         let result = unsafe { o.contents.result };
10425                         unsafe { o.contents.result = core::ptr::null_mut() };
10426                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10427                 } else {
10428                         let err = unsafe { o.contents.err };
10429                         unsafe { o.contents.err = core::ptr::null_mut(); }
10430                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10431                 };
10432                 Self {
10433                         contents,
10434                         result_ok: o.result_ok,
10435                 }
10436         }
10437 }
10438 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10439         fn clone(&self) -> Self {
10440                 if self.result_ok {
10441                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10442                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10443                         } }
10444                 } else {
10445                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10446                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10447                         } }
10448                 }
10449         }
10450 }
10451 #[no_mangle]
10452 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10453 /// but with all dynamically-allocated buffers duplicated in new buffers.
10454 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10455 #[repr(C)]
10456 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10457 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10458         /// A pointer to the contents in the success state.
10459         /// Reading from this pointer when `result_ok` is not set is undefined.
10460         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10461         /// A pointer to the contents in the error state.
10462         /// Reading from this pointer when `result_ok` is set is undefined.
10463         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10464 }
10465 #[repr(C)]
10466 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10467 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10469 pub struct CResult_HTLCUpdateDecodeErrorZ {
10470         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10471         /// `err` or `result` depending on the state of `result_ok`.
10472         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10473         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10474         pub result_ok: bool,
10475 }
10476 #[no_mangle]
10477 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10478 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10479         CResult_HTLCUpdateDecodeErrorZ {
10480                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10481                         result: Box::into_raw(Box::new(o)),
10482                 },
10483                 result_ok: true,
10484         }
10485 }
10486 #[no_mangle]
10487 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10488 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10489         CResult_HTLCUpdateDecodeErrorZ {
10490                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10491                         err: Box::into_raw(Box::new(e)),
10492                 },
10493                 result_ok: false,
10494         }
10495 }
10496 /// Checks if the given object is currently in the success state
10497 #[no_mangle]
10498 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10499         o.result_ok
10500 }
10501 #[no_mangle]
10502 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10503 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10504 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10505         fn drop(&mut self) {
10506                 if self.result_ok {
10507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10509                         }
10510                 } else {
10511                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10512                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10513                         }
10514                 }
10515         }
10516 }
10517 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10518         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10519                 let contents = if o.result_ok {
10520                         let result = unsafe { o.contents.result };
10521                         unsafe { o.contents.result = core::ptr::null_mut() };
10522                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10523                 } else {
10524                         let err = unsafe { o.contents.err };
10525                         unsafe { o.contents.err = core::ptr::null_mut(); }
10526                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10527                 };
10528                 Self {
10529                         contents,
10530                         result_ok: o.result_ok,
10531                 }
10532         }
10533 }
10534 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10535         fn clone(&self) -> Self {
10536                 if self.result_ok {
10537                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10538                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10539                         } }
10540                 } else {
10541                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10542                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10543                         } }
10544                 }
10545         }
10546 }
10547 #[no_mangle]
10548 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10549 /// but with all dynamically-allocated buffers duplicated in new buffers.
10550 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10551 #[repr(C)]
10552 /// A tuple of 2 elements. See the individual fields for the types contained.
10553 pub struct C2Tuple_OutPointCVec_u8ZZ {
10554         /// The element at position 0
10555         pub a: crate::lightning::chain::transaction::OutPoint,
10556         /// The element at position 1
10557         pub b: crate::c_types::derived::CVec_u8Z,
10558 }
10559 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
10560         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10561                 Self {
10562                         a: tup.0,
10563                         b: tup.1,
10564                 }
10565         }
10566 }
10567 impl C2Tuple_OutPointCVec_u8ZZ {
10568         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10569                 (self.a, self.b)
10570         }
10571 }
10572 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
10573         fn clone(&self) -> Self {
10574                 Self {
10575                         a: Clone::clone(&self.a),
10576                         b: Clone::clone(&self.b),
10577                 }
10578         }
10579 }
10580 #[no_mangle]
10581 /// Creates a new tuple which has the same data as `orig`
10582 /// but with all dynamically-allocated buffers duplicated in new buffers.
10583 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
10584 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
10585 #[no_mangle]
10586 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
10587         C2Tuple_OutPointCVec_u8ZZ { a, b, }
10588 }
10589
10590 #[no_mangle]
10591 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
10592 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
10593 #[repr(C)]
10594 /// A tuple of 2 elements. See the individual fields for the types contained.
10595 pub struct C2Tuple_u32CVec_u8ZZ {
10596         /// The element at position 0
10597         pub a: u32,
10598         /// The element at position 1
10599         pub b: crate::c_types::derived::CVec_u8Z,
10600 }
10601 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
10602         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10603                 Self {
10604                         a: tup.0,
10605                         b: tup.1,
10606                 }
10607         }
10608 }
10609 impl C2Tuple_u32CVec_u8ZZ {
10610         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10611                 (self.a, self.b)
10612         }
10613 }
10614 impl Clone for C2Tuple_u32CVec_u8ZZ {
10615         fn clone(&self) -> Self {
10616                 Self {
10617                         a: Clone::clone(&self.a),
10618                         b: Clone::clone(&self.b),
10619                 }
10620         }
10621 }
10622 #[no_mangle]
10623 /// Creates a new tuple which has the same data as `orig`
10624 /// but with all dynamically-allocated buffers duplicated in new buffers.
10625 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
10626 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
10627 #[no_mangle]
10628 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
10629         C2Tuple_u32CVec_u8ZZ { a, b, }
10630 }
10631
10632 #[no_mangle]
10633 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
10634 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
10635 #[repr(C)]
10636 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
10637 /// This corresponds to std::vector in C++
10638 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
10639         /// The elements in the array.
10640         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10641         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
10642         /// The number of elements pointed to by `data`.
10643         pub datalen: usize
10644 }
10645 impl CVec_C2Tuple_u32CVec_u8ZZZ {
10646         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
10647                 if self.datalen == 0 { return Vec::new(); }
10648                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10649                 self.data = core::ptr::null_mut();
10650                 self.datalen = 0;
10651                 ret
10652         }
10653         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
10654                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10655         }
10656 }
10657 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
10658         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
10659                 let datalen = v.len();
10660                 let data = Box::into_raw(v.into_boxed_slice());
10661                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10662         }
10663 }
10664 #[no_mangle]
10665 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10666 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
10667 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
10668         fn drop(&mut self) {
10669                 if self.datalen == 0 { return; }
10670                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10671         }
10672 }
10673 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
10674         fn clone(&self) -> Self {
10675                 let mut res = Vec::new();
10676                 if self.datalen == 0 { return Self::from(res); }
10677                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10678                 Self::from(res)
10679         }
10680 }
10681 #[repr(C)]
10682 /// A tuple of 2 elements. See the individual fields for the types contained.
10683 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10684         /// The element at position 0
10685         pub a: crate::c_types::ThirtyTwoBytes,
10686         /// The element at position 1
10687         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
10688 }
10689 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10690         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
10691                 Self {
10692                         a: tup.0,
10693                         b: tup.1,
10694                 }
10695         }
10696 }
10697 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10698         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
10699                 (self.a, self.b)
10700         }
10701 }
10702 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10703         fn clone(&self) -> Self {
10704                 Self {
10705                         a: Clone::clone(&self.a),
10706                         b: Clone::clone(&self.b),
10707                 }
10708         }
10709 }
10710 #[no_mangle]
10711 /// Creates a new tuple which has the same data as `orig`
10712 /// but with all dynamically-allocated buffers duplicated in new buffers.
10713 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
10714 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
10715 #[no_mangle]
10716 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10717         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
10718 }
10719
10720 #[no_mangle]
10721 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
10722 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
10723 #[repr(C)]
10724 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
10725 /// This corresponds to std::vector in C++
10726 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10727         /// The elements in the array.
10728         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10729         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
10730         /// The number of elements pointed to by `data`.
10731         pub datalen: usize
10732 }
10733 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10734         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
10735                 if self.datalen == 0 { return Vec::new(); }
10736                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10737                 self.data = core::ptr::null_mut();
10738                 self.datalen = 0;
10739                 ret
10740         }
10741         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
10742                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10743         }
10744 }
10745 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10746         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
10747                 let datalen = v.len();
10748                 let data = Box::into_raw(v.into_boxed_slice());
10749                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10750         }
10751 }
10752 #[no_mangle]
10753 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10754 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
10755 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10756         fn drop(&mut self) {
10757                 if self.datalen == 0 { return; }
10758                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10759         }
10760 }
10761 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10762         fn clone(&self) -> Self {
10763                 let mut res = Vec::new();
10764                 if self.datalen == 0 { return Self::from(res); }
10765                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10766                 Self::from(res)
10767         }
10768 }
10769 #[repr(C)]
10770 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
10771 /// This corresponds to std::vector in C++
10772 pub struct CVec_CommitmentTransactionZ {
10773         /// The elements in the array.
10774         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10775         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
10776         /// The number of elements pointed to by `data`.
10777         pub datalen: usize
10778 }
10779 impl CVec_CommitmentTransactionZ {
10780         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
10781                 if self.datalen == 0 { return Vec::new(); }
10782                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10783                 self.data = core::ptr::null_mut();
10784                 self.datalen = 0;
10785                 ret
10786         }
10787         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
10788                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10789         }
10790 }
10791 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
10792         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
10793                 let datalen = v.len();
10794                 let data = Box::into_raw(v.into_boxed_slice());
10795                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10796         }
10797 }
10798 #[no_mangle]
10799 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10800 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
10801 impl Drop for CVec_CommitmentTransactionZ {
10802         fn drop(&mut self) {
10803                 if self.datalen == 0 { return; }
10804                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10805         }
10806 }
10807 impl Clone for CVec_CommitmentTransactionZ {
10808         fn clone(&self) -> Self {
10809                 let mut res = Vec::new();
10810                 if self.datalen == 0 { return Self::from(res); }
10811                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10812                 Self::from(res)
10813         }
10814 }
10815 #[repr(C)]
10816 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
10817 /// This corresponds to std::vector in C++
10818 pub struct CVec_TransactionZ {
10819         /// The elements in the array.
10820         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10821         pub data: *mut crate::c_types::Transaction,
10822         /// The number of elements pointed to by `data`.
10823         pub datalen: usize
10824 }
10825 impl CVec_TransactionZ {
10826         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
10827                 if self.datalen == 0 { return Vec::new(); }
10828                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10829                 self.data = core::ptr::null_mut();
10830                 self.datalen = 0;
10831                 ret
10832         }
10833         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
10834                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10835         }
10836 }
10837 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
10838         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
10839                 let datalen = v.len();
10840                 let data = Box::into_raw(v.into_boxed_slice());
10841                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10842         }
10843 }
10844 #[no_mangle]
10845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10846 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
10847 impl Drop for CVec_TransactionZ {
10848         fn drop(&mut self) {
10849                 if self.datalen == 0 { return; }
10850                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10851         }
10852 }
10853 impl Clone for CVec_TransactionZ {
10854         fn clone(&self) -> Self {
10855                 let mut res = Vec::new();
10856                 if self.datalen == 0 { return Self::from(res); }
10857                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10858                 Self::from(res)
10859         }
10860 }
10861 #[repr(C)]
10862 /// A tuple of 2 elements. See the individual fields for the types contained.
10863 pub struct C2Tuple_u32TxOutZ {
10864         /// The element at position 0
10865         pub a: u32,
10866         /// The element at position 1
10867         pub b: crate::c_types::TxOut,
10868 }
10869 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
10870         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
10871                 Self {
10872                         a: tup.0,
10873                         b: tup.1,
10874                 }
10875         }
10876 }
10877 impl C2Tuple_u32TxOutZ {
10878         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
10879                 (self.a, self.b)
10880         }
10881 }
10882 impl Clone for C2Tuple_u32TxOutZ {
10883         fn clone(&self) -> Self {
10884                 Self {
10885                         a: Clone::clone(&self.a),
10886                         b: Clone::clone(&self.b),
10887                 }
10888         }
10889 }
10890 #[no_mangle]
10891 /// Creates a new tuple which has the same data as `orig`
10892 /// but with all dynamically-allocated buffers duplicated in new buffers.
10893 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
10894 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
10895 #[no_mangle]
10896 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
10897         C2Tuple_u32TxOutZ { a, b, }
10898 }
10899
10900 #[no_mangle]
10901 /// Frees any resources used by the C2Tuple_u32TxOutZ.
10902 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
10903 #[repr(C)]
10904 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
10905 /// This corresponds to std::vector in C++
10906 pub struct CVec_C2Tuple_u32TxOutZZ {
10907         /// The elements in the array.
10908         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10909         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
10910         /// The number of elements pointed to by `data`.
10911         pub datalen: usize
10912 }
10913 impl CVec_C2Tuple_u32TxOutZZ {
10914         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
10915                 if self.datalen == 0 { return Vec::new(); }
10916                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10917                 self.data = core::ptr::null_mut();
10918                 self.datalen = 0;
10919                 ret
10920         }
10921         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
10922                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10923         }
10924 }
10925 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
10926         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
10927                 let datalen = v.len();
10928                 let data = Box::into_raw(v.into_boxed_slice());
10929                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10930         }
10931 }
10932 #[no_mangle]
10933 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10934 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
10935 impl Drop for CVec_C2Tuple_u32TxOutZZ {
10936         fn drop(&mut self) {
10937                 if self.datalen == 0 { return; }
10938                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10939         }
10940 }
10941 impl Clone for CVec_C2Tuple_u32TxOutZZ {
10942         fn clone(&self) -> Self {
10943                 let mut res = Vec::new();
10944                 if self.datalen == 0 { return Self::from(res); }
10945                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10946                 Self::from(res)
10947         }
10948 }
10949 #[repr(C)]
10950 /// A tuple of 2 elements. See the individual fields for the types contained.
10951 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10952         /// The element at position 0
10953         pub a: crate::c_types::ThirtyTwoBytes,
10954         /// The element at position 1
10955         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
10956 }
10957 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10958         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
10959                 Self {
10960                         a: tup.0,
10961                         b: tup.1,
10962                 }
10963         }
10964 }
10965 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10966         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
10967                 (self.a, self.b)
10968         }
10969 }
10970 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10971         fn clone(&self) -> Self {
10972                 Self {
10973                         a: Clone::clone(&self.a),
10974                         b: Clone::clone(&self.b),
10975                 }
10976         }
10977 }
10978 #[no_mangle]
10979 /// Creates a new tuple which has the same data as `orig`
10980 /// but with all dynamically-allocated buffers duplicated in new buffers.
10981 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
10982 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10983 #[no_mangle]
10984 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10985         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
10986 }
10987
10988 #[no_mangle]
10989 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
10990 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
10991 #[repr(C)]
10992 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
10993 /// This corresponds to std::vector in C++
10994 pub struct CVec_TransactionOutputsZ {
10995         /// The elements in the array.
10996         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10997         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
10998         /// The number of elements pointed to by `data`.
10999         pub datalen: usize
11000 }
11001 impl CVec_TransactionOutputsZ {
11002         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11003                 if self.datalen == 0 { return Vec::new(); }
11004                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11005                 self.data = core::ptr::null_mut();
11006                 self.datalen = 0;
11007                 ret
11008         }
11009         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11010                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11011         }
11012 }
11013 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11014         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11015                 let datalen = v.len();
11016                 let data = Box::into_raw(v.into_boxed_slice());
11017                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11018         }
11019 }
11020 #[no_mangle]
11021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11022 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11023 impl Drop for CVec_TransactionOutputsZ {
11024         fn drop(&mut self) {
11025                 if self.datalen == 0 { return; }
11026                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11027         }
11028 }
11029 impl Clone for CVec_TransactionOutputsZ {
11030         fn clone(&self) -> Self {
11031                 let mut res = Vec::new();
11032                 if self.datalen == 0 { return Self::from(res); }
11033                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11034                 Self::from(res)
11035         }
11036 }
11037 #[repr(C)]
11038 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11039 /// This corresponds to std::vector in C++
11040 pub struct CVec_BalanceZ {
11041         /// The elements in the array.
11042         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11043         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11044         /// The number of elements pointed to by `data`.
11045         pub datalen: usize
11046 }
11047 impl CVec_BalanceZ {
11048         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11049                 if self.datalen == 0 { return Vec::new(); }
11050                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11051                 self.data = core::ptr::null_mut();
11052                 self.datalen = 0;
11053                 ret
11054         }
11055         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11056                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11057         }
11058 }
11059 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11060         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11061                 let datalen = v.len();
11062                 let data = Box::into_raw(v.into_boxed_slice());
11063                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11064         }
11065 }
11066 #[no_mangle]
11067 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11068 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11069 impl Drop for CVec_BalanceZ {
11070         fn drop(&mut self) {
11071                 if self.datalen == 0 { return; }
11072                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11073         }
11074 }
11075 impl Clone for CVec_BalanceZ {
11076         fn clone(&self) -> Self {
11077                 let mut res = Vec::new();
11078                 if self.datalen == 0 { return Self::from(res); }
11079                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11080                 Self::from(res)
11081         }
11082 }
11083 #[repr(C)]
11084 /// A tuple of 2 elements. See the individual fields for the types contained.
11085 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11086         /// The element at position 0
11087         pub a: crate::c_types::ThirtyTwoBytes,
11088         /// The element at position 1
11089         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
11090 }
11091 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11092         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
11093                 Self {
11094                         a: tup.0,
11095                         b: tup.1,
11096                 }
11097         }
11098 }
11099 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11100         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
11101                 (self.a, self.b)
11102         }
11103 }
11104 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11105         fn clone(&self) -> Self {
11106                 Self {
11107                         a: Clone::clone(&self.a),
11108                         b: Clone::clone(&self.b),
11109                 }
11110         }
11111 }
11112 #[no_mangle]
11113 /// Creates a new tuple which has the same data as `orig`
11114 /// but with all dynamically-allocated buffers duplicated in new buffers.
11115 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
11116 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
11117 #[no_mangle]
11118 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11119         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
11120 }
11121
11122 #[no_mangle]
11123 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
11124 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
11125 #[repr(C)]
11126 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
11127 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11128         /// A pointer to the contents in the success state.
11129         /// Reading from this pointer when `result_ok` is not set is undefined.
11130         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
11131         /// A pointer to the contents in the error state.
11132         /// Reading from this pointer when `result_ok` is set is undefined.
11133         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11134 }
11135 #[repr(C)]
11136 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11137 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11139 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11140         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
11141         /// `err` or `result` depending on the state of `result_ok`.
11142         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
11143         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
11144         pub result_ok: bool,
11145 }
11146 #[no_mangle]
11147 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
11148 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11149         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11150                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11151                         result: Box::into_raw(Box::new(o)),
11152                 },
11153                 result_ok: true,
11154         }
11155 }
11156 #[no_mangle]
11157 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
11158 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11159         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11160                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11161                         err: Box::into_raw(Box::new(e)),
11162                 },
11163                 result_ok: false,
11164         }
11165 }
11166 /// Checks if the given object is currently in the success state
11167 #[no_mangle]
11168 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
11169         o.result_ok
11170 }
11171 #[no_mangle]
11172 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
11173 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
11174 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11175         fn drop(&mut self) {
11176                 if self.result_ok {
11177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11179                         }
11180                 } else {
11181                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11182                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11183                         }
11184                 }
11185         }
11186 }
11187 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11188         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11189                 let contents = if o.result_ok {
11190                         let result = unsafe { o.contents.result };
11191                         unsafe { o.contents.result = core::ptr::null_mut() };
11192                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
11193                 } else {
11194                         let err = unsafe { o.contents.err };
11195                         unsafe { o.contents.err = core::ptr::null_mut(); }
11196                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
11197                 };
11198                 Self {
11199                         contents,
11200                         result_ok: o.result_ok,
11201                 }
11202         }
11203 }
11204 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11205         fn clone(&self) -> Self {
11206                 if self.result_ok {
11207                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11208                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
11209                         } }
11210                 } else {
11211                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11212                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11213                         } }
11214                 }
11215         }
11216 }
11217 #[no_mangle]
11218 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
11219 /// but with all dynamically-allocated buffers duplicated in new buffers.
11220 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
11221 #[repr(C)]
11222 /// A tuple of 2 elements. See the individual fields for the types contained.
11223 pub struct C2Tuple_PublicKeyTypeZ {
11224         /// The element at position 0
11225         pub a: crate::c_types::PublicKey,
11226         /// The element at position 1
11227         pub b: crate::lightning::ln::wire::Type,
11228 }
11229 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11230         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11231                 Self {
11232                         a: tup.0,
11233                         b: tup.1,
11234                 }
11235         }
11236 }
11237 impl C2Tuple_PublicKeyTypeZ {
11238         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11239                 (self.a, self.b)
11240         }
11241 }
11242 impl Clone for C2Tuple_PublicKeyTypeZ {
11243         fn clone(&self) -> Self {
11244                 Self {
11245                         a: Clone::clone(&self.a),
11246                         b: Clone::clone(&self.b),
11247                 }
11248         }
11249 }
11250 #[no_mangle]
11251 /// Creates a new tuple which has the same data as `orig`
11252 /// but with all dynamically-allocated buffers duplicated in new buffers.
11253 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
11254 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11255 #[no_mangle]
11256 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11257         C2Tuple_PublicKeyTypeZ { a, b, }
11258 }
11259
11260 #[no_mangle]
11261 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11262 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11263 #[repr(C)]
11264 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11265 /// This corresponds to std::vector in C++
11266 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11267         /// The elements in the array.
11268         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11269         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11270         /// The number of elements pointed to by `data`.
11271         pub datalen: usize
11272 }
11273 impl CVec_C2Tuple_PublicKeyTypeZZ {
11274         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11275                 if self.datalen == 0 { return Vec::new(); }
11276                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11277                 self.data = core::ptr::null_mut();
11278                 self.datalen = 0;
11279                 ret
11280         }
11281         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11282                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11283         }
11284 }
11285 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11286         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11287                 let datalen = v.len();
11288                 let data = Box::into_raw(v.into_boxed_slice());
11289                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11290         }
11291 }
11292 #[no_mangle]
11293 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11294 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11295 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11296         fn drop(&mut self) {
11297                 if self.datalen == 0 { return; }
11298                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11299         }
11300 }
11301 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
11302         fn clone(&self) -> Self {
11303                 let mut res = Vec::new();
11304                 if self.datalen == 0 { return Self::from(res); }
11305                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11306                 Self::from(res)
11307         }
11308 }
11309 #[repr(C)]
11310 #[derive(Clone)]
11311 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
11312 pub enum COption_OffersMessageZ {
11313         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
11314         Some(crate::lightning::onion_message::offers::OffersMessage),
11315         /// When we're in this state, this COption_OffersMessageZ contains nothing
11316         None
11317 }
11318 impl COption_OffersMessageZ {
11319         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11320                 if let Self::None = self { false } else { true }
11321         }
11322         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11323                 !self.is_some()
11324         }
11325         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
11326                 if let Self::Some(v) = self { v } else { unreachable!() }
11327         }
11328 }
11329 #[no_mangle]
11330 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
11331 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
11332         COption_OffersMessageZ::Some(o)
11333 }
11334 #[no_mangle]
11335 /// Constructs a new COption_OffersMessageZ containing nothing
11336 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
11337         COption_OffersMessageZ::None
11338 }
11339 #[no_mangle]
11340 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
11341 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
11342 #[no_mangle]
11343 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
11344 /// but with all dynamically-allocated buffers duplicated in new buffers.
11345 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
11346 #[repr(C)]
11347 #[derive(Clone)]
11348 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11349 pub enum COption_CustomOnionMessageContentsZ {
11350         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11351         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11352         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11353         None
11354 }
11355 impl COption_CustomOnionMessageContentsZ {
11356         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11357                 if let Self::None = self { false } else { true }
11358         }
11359         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11360                 !self.is_some()
11361         }
11362         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11363                 if let Self::Some(v) = self { v } else { unreachable!() }
11364         }
11365 }
11366 #[no_mangle]
11367 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11368 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11369         COption_CustomOnionMessageContentsZ::Some(o)
11370 }
11371 #[no_mangle]
11372 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11373 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11374         COption_CustomOnionMessageContentsZ::None
11375 }
11376 #[no_mangle]
11377 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11378 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11379 #[no_mangle]
11380 /// Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig`
11381 /// but with all dynamically-allocated buffers duplicated in new buffers.
11382 pub extern "C" fn COption_CustomOnionMessageContentsZ_clone(orig: &COption_CustomOnionMessageContentsZ) -> COption_CustomOnionMessageContentsZ { Clone::clone(&orig) }
11383 #[repr(C)]
11384 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11385 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11386         /// A pointer to the contents in the success state.
11387         /// Reading from this pointer when `result_ok` is not set is undefined.
11388         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11389         /// A pointer to the contents in the error state.
11390         /// Reading from this pointer when `result_ok` is set is undefined.
11391         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11392 }
11393 #[repr(C)]
11394 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11397 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11398         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11399         /// `err` or `result` depending on the state of `result_ok`.
11400         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11401         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11402         pub result_ok: bool,
11403 }
11404 #[no_mangle]
11405 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11407         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11408                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11409                         result: Box::into_raw(Box::new(o)),
11410                 },
11411                 result_ok: true,
11412         }
11413 }
11414 #[no_mangle]
11415 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11417         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11418                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11419                         err: Box::into_raw(Box::new(e)),
11420                 },
11421                 result_ok: false,
11422         }
11423 }
11424 /// Checks if the given object is currently in the success state
11425 #[no_mangle]
11426 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11427         o.result_ok
11428 }
11429 #[no_mangle]
11430 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11431 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11432 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11433         fn drop(&mut self) {
11434                 if self.result_ok {
11435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11437                         }
11438                 } else {
11439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11441                         }
11442                 }
11443         }
11444 }
11445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11446         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11447                 let contents = if o.result_ok {
11448                         let result = unsafe { o.contents.result };
11449                         unsafe { o.contents.result = core::ptr::null_mut() };
11450                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11451                 } else {
11452                         let err = unsafe { o.contents.err };
11453                         unsafe { o.contents.err = core::ptr::null_mut(); }
11454                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11455                 };
11456                 Self {
11457                         contents,
11458                         result_ok: o.result_ok,
11459                 }
11460         }
11461 }
11462 impl Clone for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11463         fn clone(&self) -> Self {
11464                 if self.result_ok {
11465                         Self { result_ok: true, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11466                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_CustomOnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
11467                         } }
11468                 } else {
11469                         Self { result_ok: false, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11471                         } }
11472                 }
11473         }
11474 }
11475 #[no_mangle]
11476 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
11479 #[repr(C)]
11480 #[derive(Clone)]
11481 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
11482 pub enum COption_TypeZ {
11483         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
11484         Some(crate::lightning::ln::wire::Type),
11485         /// When we're in this state, this COption_TypeZ contains nothing
11486         None
11487 }
11488 impl COption_TypeZ {
11489         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11490                 if let Self::None = self { false } else { true }
11491         }
11492         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11493                 !self.is_some()
11494         }
11495         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
11496                 if let Self::Some(v) = self { v } else { unreachable!() }
11497         }
11498 }
11499 #[no_mangle]
11500 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11501 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
11502         COption_TypeZ::Some(o)
11503 }
11504 #[no_mangle]
11505 /// Constructs a new COption_TypeZ containing nothing
11506 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
11507         COption_TypeZ::None
11508 }
11509 #[no_mangle]
11510 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11511 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
11512 #[no_mangle]
11513 /// Creates a new COption_TypeZ which has the same data as `orig`
11514 /// but with all dynamically-allocated buffers duplicated in new buffers.
11515 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
11516 #[repr(C)]
11517 /// The contents of CResult_COption_TypeZDecodeErrorZ
11518 pub union CResult_COption_TypeZDecodeErrorZPtr {
11519         /// A pointer to the contents in the success state.
11520         /// Reading from this pointer when `result_ok` is not set is undefined.
11521         pub result: *mut crate::c_types::derived::COption_TypeZ,
11522         /// A pointer to the contents in the error state.
11523         /// Reading from this pointer when `result_ok` is set is undefined.
11524         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11525 }
11526 #[repr(C)]
11527 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
11528 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11530 pub struct CResult_COption_TypeZDecodeErrorZ {
11531         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
11532         /// `err` or `result` depending on the state of `result_ok`.
11533         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
11534         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
11535         pub result_ok: bool,
11536 }
11537 #[no_mangle]
11538 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11539 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
11540         CResult_COption_TypeZDecodeErrorZ {
11541                 contents: CResult_COption_TypeZDecodeErrorZPtr {
11542                         result: Box::into_raw(Box::new(o)),
11543                 },
11544                 result_ok: true,
11545         }
11546 }
11547 #[no_mangle]
11548 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11549 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
11550         CResult_COption_TypeZDecodeErrorZ {
11551                 contents: CResult_COption_TypeZDecodeErrorZPtr {
11552                         err: Box::into_raw(Box::new(e)),
11553                 },
11554                 result_ok: false,
11555         }
11556 }
11557 /// Checks if the given object is currently in the success state
11558 #[no_mangle]
11559 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11560         o.result_ok
11561 }
11562 #[no_mangle]
11563 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11564 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11565 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11566         fn drop(&mut self) {
11567                 if self.result_ok {
11568                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11569                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11570                         }
11571                 } else {
11572                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11573                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11574                         }
11575                 }
11576         }
11577 }
11578 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11579         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11580                 let contents = if o.result_ok {
11581                         let result = unsafe { o.contents.result };
11582                         unsafe { o.contents.result = core::ptr::null_mut() };
11583                         CResult_COption_TypeZDecodeErrorZPtr { result }
11584                 } else {
11585                         let err = unsafe { o.contents.err };
11586                         unsafe { o.contents.err = core::ptr::null_mut(); }
11587                         CResult_COption_TypeZDecodeErrorZPtr { err }
11588                 };
11589                 Self {
11590                         contents,
11591                         result_ok: o.result_ok,
11592                 }
11593         }
11594 }
11595 impl Clone for CResult_COption_TypeZDecodeErrorZ {
11596         fn clone(&self) -> Self {
11597                 if self.result_ok {
11598                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
11599                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
11600                         } }
11601                 } else {
11602                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
11603                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11604                         } }
11605                 }
11606         }
11607 }
11608 #[no_mangle]
11609 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
11610 /// but with all dynamically-allocated buffers duplicated in new buffers.
11611 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
11612 #[repr(C)]
11613 #[derive(Clone)]
11614 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
11615 pub enum COption_SocketAddressZ {
11616         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
11617         Some(crate::lightning::ln::msgs::SocketAddress),
11618         /// When we're in this state, this COption_SocketAddressZ contains nothing
11619         None
11620 }
11621 impl COption_SocketAddressZ {
11622         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11623                 if let Self::None = self { false } else { true }
11624         }
11625         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11626                 !self.is_some()
11627         }
11628         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
11629                 if let Self::Some(v) = self { v } else { unreachable!() }
11630         }
11631 }
11632 #[no_mangle]
11633 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
11634 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
11635         COption_SocketAddressZ::Some(o)
11636 }
11637 #[no_mangle]
11638 /// Constructs a new COption_SocketAddressZ containing nothing
11639 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
11640         COption_SocketAddressZ::None
11641 }
11642 #[no_mangle]
11643 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
11644 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
11645 #[no_mangle]
11646 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
11647 /// but with all dynamically-allocated buffers duplicated in new buffers.
11648 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
11649 #[repr(C)]
11650 /// A tuple of 2 elements. See the individual fields for the types contained.
11651 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
11652         /// The element at position 0
11653         pub a: crate::c_types::PublicKey,
11654         /// The element at position 1
11655         pub b: crate::c_types::derived::COption_SocketAddressZ,
11656 }
11657 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11658         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
11659                 Self {
11660                         a: tup.0,
11661                         b: tup.1,
11662                 }
11663         }
11664 }
11665 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
11666         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
11667                 (self.a, self.b)
11668         }
11669 }
11670 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11671         fn clone(&self) -> Self {
11672                 Self {
11673                         a: Clone::clone(&self.a),
11674                         b: Clone::clone(&self.b),
11675                 }
11676         }
11677 }
11678 #[no_mangle]
11679 /// Creates a new tuple which has the same data as `orig`
11680 /// but with all dynamically-allocated buffers duplicated in new buffers.
11681 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
11682 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
11683 #[no_mangle]
11684 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
11685         C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
11686 }
11687
11688 #[no_mangle]
11689 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
11690 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
11691 #[repr(C)]
11692 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
11693 /// This corresponds to std::vector in C++
11694 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11695         /// The elements in the array.
11696         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11697         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
11698         /// The number of elements pointed to by `data`.
11699         pub datalen: usize
11700 }
11701 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11702         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
11703                 if self.datalen == 0 { return Vec::new(); }
11704                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11705                 self.data = core::ptr::null_mut();
11706                 self.datalen = 0;
11707                 ret
11708         }
11709         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
11710                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11711         }
11712 }
11713 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11714         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
11715                 let datalen = v.len();
11716                 let data = Box::into_raw(v.into_boxed_slice());
11717                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11718         }
11719 }
11720 #[no_mangle]
11721 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11722 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
11723 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11724         fn drop(&mut self) {
11725                 if self.datalen == 0 { return; }
11726                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11727         }
11728 }
11729 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11730         fn clone(&self) -> Self {
11731                 let mut res = Vec::new();
11732                 if self.datalen == 0 { return Self::from(res); }
11733                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11734                 Self::from(res)
11735         }
11736 }
11737 #[repr(C)]
11738 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11739 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11740         /// A pointer to the contents in the success state.
11741         /// Reading from this pointer when `result_ok` is not set is undefined.
11742         pub result: *mut crate::c_types::derived::CVec_u8Z,
11743         /// A pointer to the contents in the error state.
11744         /// Reading from this pointer when `result_ok` is set is undefined.
11745         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11746 }
11747 #[repr(C)]
11748 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11749 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11751 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11752         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11753         /// `err` or `result` depending on the state of `result_ok`.
11754         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11755         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11756         pub result_ok: bool,
11757 }
11758 #[no_mangle]
11759 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11760 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11761         CResult_CVec_u8ZPeerHandleErrorZ {
11762                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11763                         result: Box::into_raw(Box::new(o)),
11764                 },
11765                 result_ok: true,
11766         }
11767 }
11768 #[no_mangle]
11769 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11770 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11771         CResult_CVec_u8ZPeerHandleErrorZ {
11772                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11773                         err: Box::into_raw(Box::new(e)),
11774                 },
11775                 result_ok: false,
11776         }
11777 }
11778 /// Checks if the given object is currently in the success state
11779 #[no_mangle]
11780 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11781         o.result_ok
11782 }
11783 #[no_mangle]
11784 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11785 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11786 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11787         fn drop(&mut self) {
11788                 if self.result_ok {
11789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11791                         }
11792                 } else {
11793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11795                         }
11796                 }
11797         }
11798 }
11799 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11800         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11801                 let contents = if o.result_ok {
11802                         let result = unsafe { o.contents.result };
11803                         unsafe { o.contents.result = core::ptr::null_mut() };
11804                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11805                 } else {
11806                         let err = unsafe { o.contents.err };
11807                         unsafe { o.contents.err = core::ptr::null_mut(); }
11808                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11809                 };
11810                 Self {
11811                         contents,
11812                         result_ok: o.result_ok,
11813                 }
11814         }
11815 }
11816 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11817         fn clone(&self) -> Self {
11818                 if self.result_ok {
11819                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11820                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11821                         } }
11822                 } else {
11823                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11825                         } }
11826                 }
11827         }
11828 }
11829 #[no_mangle]
11830 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11831 /// but with all dynamically-allocated buffers duplicated in new buffers.
11832 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11833 #[repr(C)]
11834 /// The contents of CResult_NonePeerHandleErrorZ
11835 pub union CResult_NonePeerHandleErrorZPtr {
11836         /// Note that this value is always NULL, as there are no contents in the OK variant
11837         pub result: *mut core::ffi::c_void,
11838         /// A pointer to the contents in the error state.
11839         /// Reading from this pointer when `result_ok` is set is undefined.
11840         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11841 }
11842 #[repr(C)]
11843 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11844 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11845 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11846 pub struct CResult_NonePeerHandleErrorZ {
11847         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11848         /// `err` or `result` depending on the state of `result_ok`.
11849         pub contents: CResult_NonePeerHandleErrorZPtr,
11850         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11851         pub result_ok: bool,
11852 }
11853 #[no_mangle]
11854 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11855 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11856         CResult_NonePeerHandleErrorZ {
11857                 contents: CResult_NonePeerHandleErrorZPtr {
11858                         result: core::ptr::null_mut(),
11859                 },
11860                 result_ok: true,
11861         }
11862 }
11863 #[no_mangle]
11864 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11865 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11866         CResult_NonePeerHandleErrorZ {
11867                 contents: CResult_NonePeerHandleErrorZPtr {
11868                         err: Box::into_raw(Box::new(e)),
11869                 },
11870                 result_ok: false,
11871         }
11872 }
11873 /// Checks if the given object is currently in the success state
11874 #[no_mangle]
11875 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11876         o.result_ok
11877 }
11878 #[no_mangle]
11879 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11880 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11881 impl Drop for CResult_NonePeerHandleErrorZ {
11882         fn drop(&mut self) {
11883                 if self.result_ok {
11884                 } else {
11885                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11886                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11887                         }
11888                 }
11889         }
11890 }
11891 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11892         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11893                 let contents = if o.result_ok {
11894                         let _ = unsafe { Box::from_raw(o.contents.result) };
11895                         o.contents.result = core::ptr::null_mut();
11896                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11897                 } else {
11898                         let err = unsafe { o.contents.err };
11899                         unsafe { o.contents.err = core::ptr::null_mut(); }
11900                         CResult_NonePeerHandleErrorZPtr { err }
11901                 };
11902                 Self {
11903                         contents,
11904                         result_ok: o.result_ok,
11905                 }
11906         }
11907 }
11908 impl Clone for CResult_NonePeerHandleErrorZ {
11909         fn clone(&self) -> Self {
11910                 if self.result_ok {
11911                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11912                                 result: core::ptr::null_mut()
11913                         } }
11914                 } else {
11915                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11916                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11917                         } }
11918                 }
11919         }
11920 }
11921 #[no_mangle]
11922 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11923 /// but with all dynamically-allocated buffers duplicated in new buffers.
11924 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11925 #[repr(C)]
11926 /// The contents of CResult_boolPeerHandleErrorZ
11927 pub union CResult_boolPeerHandleErrorZPtr {
11928         /// A pointer to the contents in the success state.
11929         /// Reading from this pointer when `result_ok` is not set is undefined.
11930         pub result: *mut bool,
11931         /// A pointer to the contents in the error state.
11932         /// Reading from this pointer when `result_ok` is set is undefined.
11933         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11934 }
11935 #[repr(C)]
11936 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11937 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11939 pub struct CResult_boolPeerHandleErrorZ {
11940         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11941         /// `err` or `result` depending on the state of `result_ok`.
11942         pub contents: CResult_boolPeerHandleErrorZPtr,
11943         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11944         pub result_ok: bool,
11945 }
11946 #[no_mangle]
11947 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11948 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11949         CResult_boolPeerHandleErrorZ {
11950                 contents: CResult_boolPeerHandleErrorZPtr {
11951                         result: Box::into_raw(Box::new(o)),
11952                 },
11953                 result_ok: true,
11954         }
11955 }
11956 #[no_mangle]
11957 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11958 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11959         CResult_boolPeerHandleErrorZ {
11960                 contents: CResult_boolPeerHandleErrorZPtr {
11961                         err: Box::into_raw(Box::new(e)),
11962                 },
11963                 result_ok: false,
11964         }
11965 }
11966 /// Checks if the given object is currently in the success state
11967 #[no_mangle]
11968 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11969         o.result_ok
11970 }
11971 #[no_mangle]
11972 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11973 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11974 impl Drop for CResult_boolPeerHandleErrorZ {
11975         fn drop(&mut self) {
11976                 if self.result_ok {
11977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11979                         }
11980                 } else {
11981                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11982                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11983                         }
11984                 }
11985         }
11986 }
11987 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11988         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11989                 let contents = if o.result_ok {
11990                         let result = unsafe { o.contents.result };
11991                         unsafe { o.contents.result = core::ptr::null_mut() };
11992                         CResult_boolPeerHandleErrorZPtr { result }
11993                 } else {
11994                         let err = unsafe { o.contents.err };
11995                         unsafe { o.contents.err = core::ptr::null_mut(); }
11996                         CResult_boolPeerHandleErrorZPtr { err }
11997                 };
11998                 Self {
11999                         contents,
12000                         result_ok: o.result_ok,
12001                 }
12002         }
12003 }
12004 impl Clone for CResult_boolPeerHandleErrorZ {
12005         fn clone(&self) -> Self {
12006                 if self.result_ok {
12007                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12008                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12009                         } }
12010                 } else {
12011                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12012                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12013                         } }
12014                 }
12015         }
12016 }
12017 #[no_mangle]
12018 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12019 /// but with all dynamically-allocated buffers duplicated in new buffers.
12020 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12021 #[repr(C)]
12022 /// The contents of CResult_u32GraphSyncErrorZ
12023 pub union CResult_u32GraphSyncErrorZPtr {
12024         /// A pointer to the contents in the success state.
12025         /// Reading from this pointer when `result_ok` is not set is undefined.
12026         pub result: *mut u32,
12027         /// A pointer to the contents in the error state.
12028         /// Reading from this pointer when `result_ok` is set is undefined.
12029         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12030 }
12031 #[repr(C)]
12032 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12033 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12035 pub struct CResult_u32GraphSyncErrorZ {
12036         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12037         /// `err` or `result` depending on the state of `result_ok`.
12038         pub contents: CResult_u32GraphSyncErrorZPtr,
12039         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12040         pub result_ok: bool,
12041 }
12042 #[no_mangle]
12043 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12044 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12045         CResult_u32GraphSyncErrorZ {
12046                 contents: CResult_u32GraphSyncErrorZPtr {
12047                         result: Box::into_raw(Box::new(o)),
12048                 },
12049                 result_ok: true,
12050         }
12051 }
12052 #[no_mangle]
12053 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12054 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12055         CResult_u32GraphSyncErrorZ {
12056                 contents: CResult_u32GraphSyncErrorZPtr {
12057                         err: Box::into_raw(Box::new(e)),
12058                 },
12059                 result_ok: false,
12060         }
12061 }
12062 /// Checks if the given object is currently in the success state
12063 #[no_mangle]
12064 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12065         o.result_ok
12066 }
12067 #[no_mangle]
12068 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12069 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12070 impl Drop for CResult_u32GraphSyncErrorZ {
12071         fn drop(&mut self) {
12072                 if self.result_ok {
12073                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12074                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12075                         }
12076                 } else {
12077                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12078                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12079                         }
12080                 }
12081         }
12082 }
12083 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12084         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12085                 let contents = if o.result_ok {
12086                         let result = unsafe { o.contents.result };
12087                         unsafe { o.contents.result = core::ptr::null_mut() };
12088                         CResult_u32GraphSyncErrorZPtr { result }
12089                 } else {
12090                         let err = unsafe { o.contents.err };
12091                         unsafe { o.contents.err = core::ptr::null_mut(); }
12092                         CResult_u32GraphSyncErrorZPtr { err }
12093                 };
12094                 Self {
12095                         contents,
12096                         result_ok: o.result_ok,
12097                 }
12098         }
12099 }
12100 #[repr(C)]
12101 /// The contents of CResult_CVec_u8ZIOErrorZ
12102 pub union CResult_CVec_u8ZIOErrorZPtr {
12103         /// A pointer to the contents in the success state.
12104         /// Reading from this pointer when `result_ok` is not set is undefined.
12105         pub result: *mut crate::c_types::derived::CVec_u8Z,
12106         /// A pointer to the contents in the error state.
12107         /// Reading from this pointer when `result_ok` is set is undefined.
12108         pub err: *mut crate::c_types::IOError,
12109 }
12110 #[repr(C)]
12111 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
12112 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
12113 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12114 pub struct CResult_CVec_u8ZIOErrorZ {
12115         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
12116         /// `err` or `result` depending on the state of `result_ok`.
12117         pub contents: CResult_CVec_u8ZIOErrorZPtr,
12118         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
12119         pub result_ok: bool,
12120 }
12121 #[no_mangle]
12122 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
12123 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
12124         CResult_CVec_u8ZIOErrorZ {
12125                 contents: CResult_CVec_u8ZIOErrorZPtr {
12126                         result: Box::into_raw(Box::new(o)),
12127                 },
12128                 result_ok: true,
12129         }
12130 }
12131 #[no_mangle]
12132 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
12133 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
12134         CResult_CVec_u8ZIOErrorZ {
12135                 contents: CResult_CVec_u8ZIOErrorZPtr {
12136                         err: Box::into_raw(Box::new(e)),
12137                 },
12138                 result_ok: false,
12139         }
12140 }
12141 /// Checks if the given object is currently in the success state
12142 #[no_mangle]
12143 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
12144         o.result_ok
12145 }
12146 #[no_mangle]
12147 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
12148 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
12149 impl Drop for CResult_CVec_u8ZIOErrorZ {
12150         fn drop(&mut self) {
12151                 if self.result_ok {
12152                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12153                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12154                         }
12155                 } else {
12156                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12157                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12158                         }
12159                 }
12160         }
12161 }
12162 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
12163         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
12164                 let contents = if o.result_ok {
12165                         let result = unsafe { o.contents.result };
12166                         unsafe { o.contents.result = core::ptr::null_mut() };
12167                         CResult_CVec_u8ZIOErrorZPtr { result }
12168                 } else {
12169                         let err = unsafe { o.contents.err };
12170                         unsafe { o.contents.err = core::ptr::null_mut(); }
12171                         CResult_CVec_u8ZIOErrorZPtr { err }
12172                 };
12173                 Self {
12174                         contents,
12175                         result_ok: o.result_ok,
12176                 }
12177         }
12178 }
12179 impl Clone for CResult_CVec_u8ZIOErrorZ {
12180         fn clone(&self) -> Self {
12181                 if self.result_ok {
12182                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
12183                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12184                         } }
12185                 } else {
12186                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
12187                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12188                         } }
12189                 }
12190         }
12191 }
12192 #[no_mangle]
12193 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
12194 /// but with all dynamically-allocated buffers duplicated in new buffers.
12195 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
12196 #[repr(C)]
12197 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
12198 /// This corresponds to std::vector in C++
12199 pub struct CVec_StrZ {
12200         /// The elements in the array.
12201         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12202         pub data: *mut crate::c_types::Str,
12203         /// The number of elements pointed to by `data`.
12204         pub datalen: usize
12205 }
12206 impl CVec_StrZ {
12207         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
12208                 if self.datalen == 0 { return Vec::new(); }
12209                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12210                 self.data = core::ptr::null_mut();
12211                 self.datalen = 0;
12212                 ret
12213         }
12214         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
12215                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12216         }
12217 }
12218 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
12219         fn from(v: Vec<crate::c_types::Str>) -> Self {
12220                 let datalen = v.len();
12221                 let data = Box::into_raw(v.into_boxed_slice());
12222                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12223         }
12224 }
12225 #[no_mangle]
12226 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12227 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
12228 impl Drop for CVec_StrZ {
12229         fn drop(&mut self) {
12230                 if self.datalen == 0 { return; }
12231                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12232         }
12233 }
12234 impl Clone for CVec_StrZ {
12235         fn clone(&self) -> Self {
12236                 let mut res = Vec::new();
12237                 if self.datalen == 0 { return Self::from(res); }
12238                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12239                 Self::from(res)
12240         }
12241 }
12242 #[repr(C)]
12243 /// The contents of CResult_CVec_StrZIOErrorZ
12244 pub union CResult_CVec_StrZIOErrorZPtr {
12245         /// A pointer to the contents in the success state.
12246         /// Reading from this pointer when `result_ok` is not set is undefined.
12247         pub result: *mut crate::c_types::derived::CVec_StrZ,
12248         /// A pointer to the contents in the error state.
12249         /// Reading from this pointer when `result_ok` is set is undefined.
12250         pub err: *mut crate::c_types::IOError,
12251 }
12252 #[repr(C)]
12253 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
12254 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
12255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12256 pub struct CResult_CVec_StrZIOErrorZ {
12257         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
12258         /// `err` or `result` depending on the state of `result_ok`.
12259         pub contents: CResult_CVec_StrZIOErrorZPtr,
12260         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
12261         pub result_ok: bool,
12262 }
12263 #[no_mangle]
12264 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
12265 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
12266         CResult_CVec_StrZIOErrorZ {
12267                 contents: CResult_CVec_StrZIOErrorZPtr {
12268                         result: Box::into_raw(Box::new(o)),
12269                 },
12270                 result_ok: true,
12271         }
12272 }
12273 #[no_mangle]
12274 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
12275 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
12276         CResult_CVec_StrZIOErrorZ {
12277                 contents: CResult_CVec_StrZIOErrorZPtr {
12278                         err: Box::into_raw(Box::new(e)),
12279                 },
12280                 result_ok: false,
12281         }
12282 }
12283 /// Checks if the given object is currently in the success state
12284 #[no_mangle]
12285 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
12286         o.result_ok
12287 }
12288 #[no_mangle]
12289 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
12290 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
12291 impl Drop for CResult_CVec_StrZIOErrorZ {
12292         fn drop(&mut self) {
12293                 if self.result_ok {
12294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12296                         }
12297                 } else {
12298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12300                         }
12301                 }
12302         }
12303 }
12304 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
12305         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
12306                 let contents = if o.result_ok {
12307                         let result = unsafe { o.contents.result };
12308                         unsafe { o.contents.result = core::ptr::null_mut() };
12309                         CResult_CVec_StrZIOErrorZPtr { result }
12310                 } else {
12311                         let err = unsafe { o.contents.err };
12312                         unsafe { o.contents.err = core::ptr::null_mut(); }
12313                         CResult_CVec_StrZIOErrorZPtr { err }
12314                 };
12315                 Self {
12316                         contents,
12317                         result_ok: o.result_ok,
12318                 }
12319         }
12320 }
12321 impl Clone for CResult_CVec_StrZIOErrorZ {
12322         fn clone(&self) -> Self {
12323                 if self.result_ok {
12324                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
12325                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
12326                         } }
12327                 } else {
12328                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
12329                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12330                         } }
12331                 }
12332         }
12333 }
12334 #[no_mangle]
12335 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
12336 /// but with all dynamically-allocated buffers duplicated in new buffers.
12337 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
12338 #[repr(C)]
12339 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
12340 /// This corresponds to std::vector in C++
12341 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12342         /// The elements in the array.
12343         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12344         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12345         /// The number of elements pointed to by `data`.
12346         pub datalen: usize
12347 }
12348 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12349         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
12350                 if self.datalen == 0 { return Vec::new(); }
12351                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12352                 self.data = core::ptr::null_mut();
12353                 self.datalen = 0;
12354                 ret
12355         }
12356         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
12357                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12358         }
12359 }
12360 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12361         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
12362                 let datalen = v.len();
12363                 let data = Box::into_raw(v.into_boxed_slice());
12364                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12365         }
12366 }
12367 #[no_mangle]
12368 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12369 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
12370 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12371         fn drop(&mut self) {
12372                 if self.datalen == 0 { return; }
12373                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12374         }
12375 }
12376 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12377         fn clone(&self) -> Self {
12378                 let mut res = Vec::new();
12379                 if self.datalen == 0 { return Self::from(res); }
12380                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12381                 Self::from(res)
12382         }
12383 }
12384 #[repr(C)]
12385 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
12386 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12387         /// A pointer to the contents in the success state.
12388         /// Reading from this pointer when `result_ok` is not set is undefined.
12389         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
12390         /// A pointer to the contents in the error state.
12391         /// Reading from this pointer when `result_ok` is set is undefined.
12392         pub err: *mut crate::c_types::IOError,
12393 }
12394 #[repr(C)]
12395 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
12396 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
12397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12398 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12399         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
12400         /// `err` or `result` depending on the state of `result_ok`.
12401         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
12402         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
12403         pub result_ok: bool,
12404 }
12405 #[no_mangle]
12406 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
12407 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12408         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12409                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12410                         result: Box::into_raw(Box::new(o)),
12411                 },
12412                 result_ok: true,
12413         }
12414 }
12415 #[no_mangle]
12416 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
12417 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12418         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12419                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12420                         err: Box::into_raw(Box::new(e)),
12421                 },
12422                 result_ok: false,
12423         }
12424 }
12425 /// Checks if the given object is currently in the success state
12426 #[no_mangle]
12427 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
12428         o.result_ok
12429 }
12430 #[no_mangle]
12431 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
12432 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
12433 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12434         fn drop(&mut self) {
12435                 if self.result_ok {
12436                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12437                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12438                         }
12439                 } else {
12440                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12441                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12442                         }
12443                 }
12444         }
12445 }
12446 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12447         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
12448                 let contents = if o.result_ok {
12449                         let result = unsafe { o.contents.result };
12450                         unsafe { o.contents.result = core::ptr::null_mut() };
12451                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
12452                 } else {
12453                         let err = unsafe { o.contents.err };
12454                         unsafe { o.contents.err = core::ptr::null_mut(); }
12455                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
12456                 };
12457                 Self {
12458                         contents,
12459                         result_ok: o.result_ok,
12460                 }
12461         }
12462 }
12463 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12464         fn clone(&self) -> Self {
12465                 if self.result_ok {
12466                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12467                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
12468                         } }
12469                 } else {
12470                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12471                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12472                         } }
12473                 }
12474         }
12475 }
12476 #[no_mangle]
12477 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
12478 /// but with all dynamically-allocated buffers duplicated in new buffers.
12479 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
12480 #[repr(C)]
12481 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
12482 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12483         /// A pointer to the contents in the success state.
12484         /// Reading from this pointer when `result_ok` is not set is undefined.
12485         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12486         /// A pointer to the contents in the error state.
12487         /// Reading from this pointer when `result_ok` is set is undefined.
12488         pub err: *mut crate::c_types::IOError,
12489 }
12490 #[repr(C)]
12491 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
12492 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
12493 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12494 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12495         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
12496         /// `err` or `result` depending on the state of `result_ok`.
12497         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
12498         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
12499         pub result_ok: bool,
12500 }
12501 #[no_mangle]
12502 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
12503 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12504         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12505                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12506                         result: Box::into_raw(Box::new(o)),
12507                 },
12508                 result_ok: true,
12509         }
12510 }
12511 #[no_mangle]
12512 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
12513 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12514         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12515                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12516                         err: Box::into_raw(Box::new(e)),
12517                 },
12518                 result_ok: false,
12519         }
12520 }
12521 /// Checks if the given object is currently in the success state
12522 #[no_mangle]
12523 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
12524         o.result_ok
12525 }
12526 #[no_mangle]
12527 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
12528 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
12529 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12530         fn drop(&mut self) {
12531                 if self.result_ok {
12532                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12533                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12534                         }
12535                 } else {
12536                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12537                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12538                         }
12539                 }
12540         }
12541 }
12542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12543         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
12544                 let contents = if o.result_ok {
12545                         let result = unsafe { o.contents.result };
12546                         unsafe { o.contents.result = core::ptr::null_mut() };
12547                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
12548                 } else {
12549                         let err = unsafe { o.contents.err };
12550                         unsafe { o.contents.err = core::ptr::null_mut(); }
12551                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
12552                 };
12553                 Self {
12554                         contents,
12555                         result_ok: o.result_ok,
12556                 }
12557         }
12558 }
12559 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12560         fn clone(&self) -> Self {
12561                 if self.result_ok {
12562                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12563                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12564                         } }
12565                 } else {
12566                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12567                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12568                         } }
12569                 }
12570         }
12571 }
12572 #[no_mangle]
12573 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
12574 /// but with all dynamically-allocated buffers duplicated in new buffers.
12575 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
12576 #[repr(C)]
12577 #[derive(Clone)]
12578 /// An enum which can either contain a crate::c_types::SecretKey or not
12579 pub enum COption_SecretKeyZ {
12580         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
12581         Some(crate::c_types::SecretKey),
12582         /// When we're in this state, this COption_SecretKeyZ contains nothing
12583         None
12584 }
12585 impl COption_SecretKeyZ {
12586         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12587                 if let Self::None = self { false } else { true }
12588         }
12589         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12590                 !self.is_some()
12591         }
12592         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
12593                 if let Self::Some(v) = self { v } else { unreachable!() }
12594         }
12595 }
12596 #[no_mangle]
12597 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
12598 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
12599         COption_SecretKeyZ::Some(o)
12600 }
12601 #[no_mangle]
12602 /// Constructs a new COption_SecretKeyZ containing nothing
12603 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
12604         COption_SecretKeyZ::None
12605 }
12606 #[no_mangle]
12607 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
12608 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
12609 #[no_mangle]
12610 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
12611 /// but with all dynamically-allocated buffers duplicated in new buffers.
12612 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
12613 #[repr(C)]
12614 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
12615 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
12616         /// A pointer to the contents in the success state.
12617         /// Reading from this pointer when `result_ok` is not set is undefined.
12618         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
12619         /// Note that this value is always NULL, as there are no contents in the Err variant
12620         pub err: *mut core::ffi::c_void,
12621 }
12622 #[repr(C)]
12623 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
12624 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
12625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12626 pub struct CResult_VerifiedInvoiceRequestNoneZ {
12627         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
12628         /// `err` or `result` depending on the state of `result_ok`.
12629         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
12630         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
12631         pub result_ok: bool,
12632 }
12633 #[no_mangle]
12634 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
12635 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
12636         CResult_VerifiedInvoiceRequestNoneZ {
12637                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12638                         result: Box::into_raw(Box::new(o)),
12639                 },
12640                 result_ok: true,
12641         }
12642 }
12643 #[no_mangle]
12644 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
12645 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
12646         CResult_VerifiedInvoiceRequestNoneZ {
12647                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12648                         err: core::ptr::null_mut(),
12649                 },
12650                 result_ok: false,
12651         }
12652 }
12653 /// Checks if the given object is currently in the success state
12654 #[no_mangle]
12655 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
12656         o.result_ok
12657 }
12658 #[no_mangle]
12659 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
12660 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
12661 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
12662         fn drop(&mut self) {
12663                 if self.result_ok {
12664                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12665                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12666                         }
12667                 } else {
12668                 }
12669         }
12670 }
12671 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
12672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
12673                 let contents = if o.result_ok {
12674                         let result = unsafe { o.contents.result };
12675                         unsafe { o.contents.result = core::ptr::null_mut() };
12676                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
12677                 } else {
12678                         let _ = unsafe { Box::from_raw(o.contents.err) };
12679                         o.contents.err = core::ptr::null_mut();
12680                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
12681                 };
12682                 Self {
12683                         contents,
12684                         result_ok: o.result_ok,
12685                 }
12686         }
12687 }
12688 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
12689         fn clone(&self) -> Self {
12690                 if self.result_ok {
12691                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12692                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
12693                         } }
12694                 } else {
12695                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12696                                 err: core::ptr::null_mut()
12697                         } }
12698                 }
12699         }
12700 }
12701 #[no_mangle]
12702 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
12703 /// but with all dynamically-allocated buffers duplicated in new buffers.
12704 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
12705 #[repr(C)]
12706 /// An enum which can either contain a  or not
12707 pub enum COption_NoneZ {
12708         /// When we're in this state, this COption_NoneZ contains a 
12709         Some,
12710         /// When we're in this state, this COption_NoneZ contains nothing
12711         None
12712 }
12713 impl COption_NoneZ {
12714         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12715                 if let Self::None = self { false } else { true }
12716         }
12717         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12718                 !self.is_some()
12719         }
12720 }
12721 #[no_mangle]
12722 /// Constructs a new COption_NoneZ containing a 
12723 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
12724         COption_NoneZ::Some
12725 }
12726 #[no_mangle]
12727 /// Constructs a new COption_NoneZ containing nothing
12728 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
12729         COption_NoneZ::None
12730 }
12731 #[no_mangle]
12732 /// Frees any resources associated with the , if we are in the Some state
12733 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
12734 #[repr(C)]
12735 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
12736 /// This corresponds to std::vector in C++
12737 pub struct CVec_WitnessZ {
12738         /// The elements in the array.
12739         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12740         pub data: *mut crate::c_types::Witness,
12741         /// The number of elements pointed to by `data`.
12742         pub datalen: usize
12743 }
12744 impl CVec_WitnessZ {
12745         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
12746                 if self.datalen == 0 { return Vec::new(); }
12747                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12748                 self.data = core::ptr::null_mut();
12749                 self.datalen = 0;
12750                 ret
12751         }
12752         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
12753                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12754         }
12755 }
12756 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
12757         fn from(v: Vec<crate::c_types::Witness>) -> Self {
12758                 let datalen = v.len();
12759                 let data = Box::into_raw(v.into_boxed_slice());
12760                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12761         }
12762 }
12763 #[no_mangle]
12764 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12765 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
12766 impl Drop for CVec_WitnessZ {
12767         fn drop(&mut self) {
12768                 if self.datalen == 0 { return; }
12769                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12770         }
12771 }
12772 impl Clone for CVec_WitnessZ {
12773         fn clone(&self) -> Self {
12774                 let mut res = Vec::new();
12775                 if self.datalen == 0 { return Self::from(res); }
12776                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12777                 Self::from(res)
12778         }
12779 }
12780 #[repr(C)]
12781 #[derive(Clone)]
12782 /// An enum which can either contain a i64 or not
12783 pub enum COption_i64Z {
12784         /// When we're in this state, this COption_i64Z contains a i64
12785         Some(i64),
12786         /// When we're in this state, this COption_i64Z contains nothing
12787         None
12788 }
12789 impl COption_i64Z {
12790         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12791                 if let Self::None = self { false } else { true }
12792         }
12793         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12794                 !self.is_some()
12795         }
12796         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
12797                 if let Self::Some(v) = self { v } else { unreachable!() }
12798         }
12799 }
12800 #[no_mangle]
12801 /// Constructs a new COption_i64Z containing a i64
12802 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
12803         COption_i64Z::Some(o)
12804 }
12805 #[no_mangle]
12806 /// Constructs a new COption_i64Z containing nothing
12807 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
12808         COption_i64Z::None
12809 }
12810 #[no_mangle]
12811 /// Frees any resources associated with the i64, if we are in the Some state
12812 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
12813 #[no_mangle]
12814 /// Creates a new COption_i64Z which has the same data as `orig`
12815 /// but with all dynamically-allocated buffers duplicated in new buffers.
12816 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
12817 #[repr(C)]
12818 /// The contents of CResult_SocketAddressDecodeErrorZ
12819 pub union CResult_SocketAddressDecodeErrorZPtr {
12820         /// A pointer to the contents in the success state.
12821         /// Reading from this pointer when `result_ok` is not set is undefined.
12822         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
12823         /// A pointer to the contents in the error state.
12824         /// Reading from this pointer when `result_ok` is set is undefined.
12825         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12826 }
12827 #[repr(C)]
12828 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
12829 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12831 pub struct CResult_SocketAddressDecodeErrorZ {
12832         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
12833         /// `err` or `result` depending on the state of `result_ok`.
12834         pub contents: CResult_SocketAddressDecodeErrorZPtr,
12835         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
12836         pub result_ok: bool,
12837 }
12838 #[no_mangle]
12839 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
12840 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
12841         CResult_SocketAddressDecodeErrorZ {
12842                 contents: CResult_SocketAddressDecodeErrorZPtr {
12843                         result: Box::into_raw(Box::new(o)),
12844                 },
12845                 result_ok: true,
12846         }
12847 }
12848 #[no_mangle]
12849 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
12850 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
12851         CResult_SocketAddressDecodeErrorZ {
12852                 contents: CResult_SocketAddressDecodeErrorZPtr {
12853                         err: Box::into_raw(Box::new(e)),
12854                 },
12855                 result_ok: false,
12856         }
12857 }
12858 /// Checks if the given object is currently in the success state
12859 #[no_mangle]
12860 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
12861         o.result_ok
12862 }
12863 #[no_mangle]
12864 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
12865 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
12866 impl Drop for CResult_SocketAddressDecodeErrorZ {
12867         fn drop(&mut self) {
12868                 if self.result_ok {
12869                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12870                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12871                         }
12872                 } else {
12873                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12874                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12875                         }
12876                 }
12877         }
12878 }
12879 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
12880         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12881                 let contents = if o.result_ok {
12882                         let result = unsafe { o.contents.result };
12883                         unsafe { o.contents.result = core::ptr::null_mut() };
12884                         CResult_SocketAddressDecodeErrorZPtr { result }
12885                 } else {
12886                         let err = unsafe { o.contents.err };
12887                         unsafe { o.contents.err = core::ptr::null_mut(); }
12888                         CResult_SocketAddressDecodeErrorZPtr { err }
12889                 };
12890                 Self {
12891                         contents,
12892                         result_ok: o.result_ok,
12893                 }
12894         }
12895 }
12896 impl Clone for CResult_SocketAddressDecodeErrorZ {
12897         fn clone(&self) -> Self {
12898                 if self.result_ok {
12899                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
12900                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
12901                         } }
12902                 } else {
12903                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
12904                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12905                         } }
12906                 }
12907         }
12908 }
12909 #[no_mangle]
12910 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
12911 /// but with all dynamically-allocated buffers duplicated in new buffers.
12912 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
12913 #[repr(C)]
12914 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
12915 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
12916         /// A pointer to the contents in the success state.
12917         /// Reading from this pointer when `result_ok` is not set is undefined.
12918         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
12919         /// A pointer to the contents in the error state.
12920         /// Reading from this pointer when `result_ok` is set is undefined.
12921         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
12922 }
12923 #[repr(C)]
12924 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
12925 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
12926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12927 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
12928         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
12929         /// `err` or `result` depending on the state of `result_ok`.
12930         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
12931         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
12932         pub result_ok: bool,
12933 }
12934 #[no_mangle]
12935 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
12936 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
12937         CResult_SocketAddressSocketAddressParseErrorZ {
12938                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12939                         result: Box::into_raw(Box::new(o)),
12940                 },
12941                 result_ok: true,
12942         }
12943 }
12944 #[no_mangle]
12945 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
12946 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
12947         CResult_SocketAddressSocketAddressParseErrorZ {
12948                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12949                         err: Box::into_raw(Box::new(e)),
12950                 },
12951                 result_ok: false,
12952         }
12953 }
12954 /// Checks if the given object is currently in the success state
12955 #[no_mangle]
12956 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
12957         o.result_ok
12958 }
12959 #[no_mangle]
12960 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
12961 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
12962 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
12963         fn drop(&mut self) {
12964                 if self.result_ok {
12965                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12966                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12967                         }
12968                 } else {
12969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12971                         }
12972                 }
12973         }
12974 }
12975 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
12976         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
12977                 let contents = if o.result_ok {
12978                         let result = unsafe { o.contents.result };
12979                         unsafe { o.contents.result = core::ptr::null_mut() };
12980                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
12981                 } else {
12982                         let err = unsafe { o.contents.err };
12983                         unsafe { o.contents.err = core::ptr::null_mut(); }
12984                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
12985                 };
12986                 Self {
12987                         contents,
12988                         result_ok: o.result_ok,
12989                 }
12990         }
12991 }
12992 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
12993         fn clone(&self) -> Self {
12994                 if self.result_ok {
12995                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12996                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
12997                         } }
12998                 } else {
12999                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13000                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
13001                         } }
13002                 }
13003         }
13004 }
13005 #[no_mangle]
13006 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
13007 /// but with all dynamically-allocated buffers duplicated in new buffers.
13008 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
13009 #[repr(C)]
13010 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13011 /// This corresponds to std::vector in C++
13012 pub struct CVec_UpdateAddHTLCZ {
13013         /// The elements in the array.
13014         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13015         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13016         /// The number of elements pointed to by `data`.
13017         pub datalen: usize
13018 }
13019 impl CVec_UpdateAddHTLCZ {
13020         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13021                 if self.datalen == 0 { return Vec::new(); }
13022                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13023                 self.data = core::ptr::null_mut();
13024                 self.datalen = 0;
13025                 ret
13026         }
13027         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13028                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13029         }
13030 }
13031 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13032         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13033                 let datalen = v.len();
13034                 let data = Box::into_raw(v.into_boxed_slice());
13035                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13036         }
13037 }
13038 #[no_mangle]
13039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13040 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13041 impl Drop for CVec_UpdateAddHTLCZ {
13042         fn drop(&mut self) {
13043                 if self.datalen == 0 { return; }
13044                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13045         }
13046 }
13047 impl Clone for CVec_UpdateAddHTLCZ {
13048         fn clone(&self) -> Self {
13049                 let mut res = Vec::new();
13050                 if self.datalen == 0 { return Self::from(res); }
13051                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13052                 Self::from(res)
13053         }
13054 }
13055 #[repr(C)]
13056 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13057 /// This corresponds to std::vector in C++
13058 pub struct CVec_UpdateFulfillHTLCZ {
13059         /// The elements in the array.
13060         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13061         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13062         /// The number of elements pointed to by `data`.
13063         pub datalen: usize
13064 }
13065 impl CVec_UpdateFulfillHTLCZ {
13066         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13067                 if self.datalen == 0 { return Vec::new(); }
13068                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13069                 self.data = core::ptr::null_mut();
13070                 self.datalen = 0;
13071                 ret
13072         }
13073         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13074                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13075         }
13076 }
13077 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13078         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13079                 let datalen = v.len();
13080                 let data = Box::into_raw(v.into_boxed_slice());
13081                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13082         }
13083 }
13084 #[no_mangle]
13085 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13086 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13087 impl Drop for CVec_UpdateFulfillHTLCZ {
13088         fn drop(&mut self) {
13089                 if self.datalen == 0 { return; }
13090                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13091         }
13092 }
13093 impl Clone for CVec_UpdateFulfillHTLCZ {
13094         fn clone(&self) -> Self {
13095                 let mut res = Vec::new();
13096                 if self.datalen == 0 { return Self::from(res); }
13097                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13098                 Self::from(res)
13099         }
13100 }
13101 #[repr(C)]
13102 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13103 /// This corresponds to std::vector in C++
13104 pub struct CVec_UpdateFailHTLCZ {
13105         /// The elements in the array.
13106         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13107         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13108         /// The number of elements pointed to by `data`.
13109         pub datalen: usize
13110 }
13111 impl CVec_UpdateFailHTLCZ {
13112         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13113                 if self.datalen == 0 { return Vec::new(); }
13114                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13115                 self.data = core::ptr::null_mut();
13116                 self.datalen = 0;
13117                 ret
13118         }
13119         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13120                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13121         }
13122 }
13123 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13124         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13125                 let datalen = v.len();
13126                 let data = Box::into_raw(v.into_boxed_slice());
13127                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13128         }
13129 }
13130 #[no_mangle]
13131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13132 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13133 impl Drop for CVec_UpdateFailHTLCZ {
13134         fn drop(&mut self) {
13135                 if self.datalen == 0 { return; }
13136                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13137         }
13138 }
13139 impl Clone for CVec_UpdateFailHTLCZ {
13140         fn clone(&self) -> Self {
13141                 let mut res = Vec::new();
13142                 if self.datalen == 0 { return Self::from(res); }
13143                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13144                 Self::from(res)
13145         }
13146 }
13147 #[repr(C)]
13148 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13149 /// This corresponds to std::vector in C++
13150 pub struct CVec_UpdateFailMalformedHTLCZ {
13151         /// The elements in the array.
13152         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13153         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13154         /// The number of elements pointed to by `data`.
13155         pub datalen: usize
13156 }
13157 impl CVec_UpdateFailMalformedHTLCZ {
13158         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13159                 if self.datalen == 0 { return Vec::new(); }
13160                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13161                 self.data = core::ptr::null_mut();
13162                 self.datalen = 0;
13163                 ret
13164         }
13165         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13166                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13167         }
13168 }
13169 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13170         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13171                 let datalen = v.len();
13172                 let data = Box::into_raw(v.into_boxed_slice());
13173                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13174         }
13175 }
13176 #[no_mangle]
13177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13178 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13179 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13180         fn drop(&mut self) {
13181                 if self.datalen == 0 { return; }
13182                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13183         }
13184 }
13185 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13186         fn clone(&self) -> Self {
13187                 let mut res = Vec::new();
13188                 if self.datalen == 0 { return Self::from(res); }
13189                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13190                 Self::from(res)
13191         }
13192 }
13193 #[repr(C)]
13194 /// The contents of CResult_AcceptChannelDecodeErrorZ
13195 pub union CResult_AcceptChannelDecodeErrorZPtr {
13196         /// A pointer to the contents in the success state.
13197         /// Reading from this pointer when `result_ok` is not set is undefined.
13198         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13199         /// A pointer to the contents in the error state.
13200         /// Reading from this pointer when `result_ok` is set is undefined.
13201         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13202 }
13203 #[repr(C)]
13204 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13205 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13207 pub struct CResult_AcceptChannelDecodeErrorZ {
13208         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13209         /// `err` or `result` depending on the state of `result_ok`.
13210         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13211         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13212         pub result_ok: bool,
13213 }
13214 #[no_mangle]
13215 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13216 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13217         CResult_AcceptChannelDecodeErrorZ {
13218                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13219                         result: Box::into_raw(Box::new(o)),
13220                 },
13221                 result_ok: true,
13222         }
13223 }
13224 #[no_mangle]
13225 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13226 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13227         CResult_AcceptChannelDecodeErrorZ {
13228                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13229                         err: Box::into_raw(Box::new(e)),
13230                 },
13231                 result_ok: false,
13232         }
13233 }
13234 /// Checks if the given object is currently in the success state
13235 #[no_mangle]
13236 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13237         o.result_ok
13238 }
13239 #[no_mangle]
13240 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13241 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13242 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13243         fn drop(&mut self) {
13244                 if self.result_ok {
13245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13247                         }
13248                 } else {
13249                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13250                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13251                         }
13252                 }
13253         }
13254 }
13255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13256         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13257                 let contents = if o.result_ok {
13258                         let result = unsafe { o.contents.result };
13259                         unsafe { o.contents.result = core::ptr::null_mut() };
13260                         CResult_AcceptChannelDecodeErrorZPtr { result }
13261                 } else {
13262                         let err = unsafe { o.contents.err };
13263                         unsafe { o.contents.err = core::ptr::null_mut(); }
13264                         CResult_AcceptChannelDecodeErrorZPtr { err }
13265                 };
13266                 Self {
13267                         contents,
13268                         result_ok: o.result_ok,
13269                 }
13270         }
13271 }
13272 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13273         fn clone(&self) -> Self {
13274                 if self.result_ok {
13275                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13276                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13277                         } }
13278                 } else {
13279                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13280                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13281                         } }
13282                 }
13283         }
13284 }
13285 #[no_mangle]
13286 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13287 /// but with all dynamically-allocated buffers duplicated in new buffers.
13288 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13289 #[repr(C)]
13290 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
13291 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
13292         /// A pointer to the contents in the success state.
13293         /// Reading from this pointer when `result_ok` is not set is undefined.
13294         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
13295         /// A pointer to the contents in the error state.
13296         /// Reading from this pointer when `result_ok` is set is undefined.
13297         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13298 }
13299 #[repr(C)]
13300 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
13301 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
13302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13303 pub struct CResult_AcceptChannelV2DecodeErrorZ {
13304         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
13305         /// `err` or `result` depending on the state of `result_ok`.
13306         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
13307         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
13308         pub result_ok: bool,
13309 }
13310 #[no_mangle]
13311 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
13312 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
13313         CResult_AcceptChannelV2DecodeErrorZ {
13314                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13315                         result: Box::into_raw(Box::new(o)),
13316                 },
13317                 result_ok: true,
13318         }
13319 }
13320 #[no_mangle]
13321 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
13322 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
13323         CResult_AcceptChannelV2DecodeErrorZ {
13324                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13325                         err: Box::into_raw(Box::new(e)),
13326                 },
13327                 result_ok: false,
13328         }
13329 }
13330 /// Checks if the given object is currently in the success state
13331 #[no_mangle]
13332 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
13333         o.result_ok
13334 }
13335 #[no_mangle]
13336 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
13337 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
13338 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
13339         fn drop(&mut self) {
13340                 if self.result_ok {
13341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13343                         }
13344                 } else {
13345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13347                         }
13348                 }
13349         }
13350 }
13351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
13352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
13353                 let contents = if o.result_ok {
13354                         let result = unsafe { o.contents.result };
13355                         unsafe { o.contents.result = core::ptr::null_mut() };
13356                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
13357                 } else {
13358                         let err = unsafe { o.contents.err };
13359                         unsafe { o.contents.err = core::ptr::null_mut(); }
13360                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
13361                 };
13362                 Self {
13363                         contents,
13364                         result_ok: o.result_ok,
13365                 }
13366         }
13367 }
13368 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
13369         fn clone(&self) -> Self {
13370                 if self.result_ok {
13371                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13372                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
13373                         } }
13374                 } else {
13375                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13377                         } }
13378                 }
13379         }
13380 }
13381 #[no_mangle]
13382 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
13383 /// but with all dynamically-allocated buffers duplicated in new buffers.
13384 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
13385 #[repr(C)]
13386 /// The contents of CResult_TxAddInputDecodeErrorZ
13387 pub union CResult_TxAddInputDecodeErrorZPtr {
13388         /// A pointer to the contents in the success state.
13389         /// Reading from this pointer when `result_ok` is not set is undefined.
13390         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
13391         /// A pointer to the contents in the error state.
13392         /// Reading from this pointer when `result_ok` is set is undefined.
13393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13394 }
13395 #[repr(C)]
13396 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
13397 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13399 pub struct CResult_TxAddInputDecodeErrorZ {
13400         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
13401         /// `err` or `result` depending on the state of `result_ok`.
13402         pub contents: CResult_TxAddInputDecodeErrorZPtr,
13403         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
13404         pub result_ok: bool,
13405 }
13406 #[no_mangle]
13407 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
13408 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
13409         CResult_TxAddInputDecodeErrorZ {
13410                 contents: CResult_TxAddInputDecodeErrorZPtr {
13411                         result: Box::into_raw(Box::new(o)),
13412                 },
13413                 result_ok: true,
13414         }
13415 }
13416 #[no_mangle]
13417 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
13418 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
13419         CResult_TxAddInputDecodeErrorZ {
13420                 contents: CResult_TxAddInputDecodeErrorZPtr {
13421                         err: Box::into_raw(Box::new(e)),
13422                 },
13423                 result_ok: false,
13424         }
13425 }
13426 /// Checks if the given object is currently in the success state
13427 #[no_mangle]
13428 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
13429         o.result_ok
13430 }
13431 #[no_mangle]
13432 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
13433 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
13434 impl Drop for CResult_TxAddInputDecodeErrorZ {
13435         fn drop(&mut self) {
13436                 if self.result_ok {
13437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13439                         }
13440                 } else {
13441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13443                         }
13444                 }
13445         }
13446 }
13447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
13448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13449                 let contents = if o.result_ok {
13450                         let result = unsafe { o.contents.result };
13451                         unsafe { o.contents.result = core::ptr::null_mut() };
13452                         CResult_TxAddInputDecodeErrorZPtr { result }
13453                 } else {
13454                         let err = unsafe { o.contents.err };
13455                         unsafe { o.contents.err = core::ptr::null_mut(); }
13456                         CResult_TxAddInputDecodeErrorZPtr { err }
13457                 };
13458                 Self {
13459                         contents,
13460                         result_ok: o.result_ok,
13461                 }
13462         }
13463 }
13464 impl Clone for CResult_TxAddInputDecodeErrorZ {
13465         fn clone(&self) -> Self {
13466                 if self.result_ok {
13467                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
13468                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
13469                         } }
13470                 } else {
13471                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
13472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13473                         } }
13474                 }
13475         }
13476 }
13477 #[no_mangle]
13478 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
13479 /// but with all dynamically-allocated buffers duplicated in new buffers.
13480 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
13481 #[repr(C)]
13482 /// The contents of CResult_TxAddOutputDecodeErrorZ
13483 pub union CResult_TxAddOutputDecodeErrorZPtr {
13484         /// A pointer to the contents in the success state.
13485         /// Reading from this pointer when `result_ok` is not set is undefined.
13486         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
13487         /// A pointer to the contents in the error state.
13488         /// Reading from this pointer when `result_ok` is set is undefined.
13489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13490 }
13491 #[repr(C)]
13492 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
13493 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13495 pub struct CResult_TxAddOutputDecodeErrorZ {
13496         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
13497         /// `err` or `result` depending on the state of `result_ok`.
13498         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
13499         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
13500         pub result_ok: bool,
13501 }
13502 #[no_mangle]
13503 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
13504 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
13505         CResult_TxAddOutputDecodeErrorZ {
13506                 contents: CResult_TxAddOutputDecodeErrorZPtr {
13507                         result: Box::into_raw(Box::new(o)),
13508                 },
13509                 result_ok: true,
13510         }
13511 }
13512 #[no_mangle]
13513 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
13514 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
13515         CResult_TxAddOutputDecodeErrorZ {
13516                 contents: CResult_TxAddOutputDecodeErrorZPtr {
13517                         err: Box::into_raw(Box::new(e)),
13518                 },
13519                 result_ok: false,
13520         }
13521 }
13522 /// Checks if the given object is currently in the success state
13523 #[no_mangle]
13524 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
13525         o.result_ok
13526 }
13527 #[no_mangle]
13528 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
13529 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
13530 impl Drop for CResult_TxAddOutputDecodeErrorZ {
13531         fn drop(&mut self) {
13532                 if self.result_ok {
13533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13535                         }
13536                 } else {
13537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13539                         }
13540                 }
13541         }
13542 }
13543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
13544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13545                 let contents = if o.result_ok {
13546                         let result = unsafe { o.contents.result };
13547                         unsafe { o.contents.result = core::ptr::null_mut() };
13548                         CResult_TxAddOutputDecodeErrorZPtr { result }
13549                 } else {
13550                         let err = unsafe { o.contents.err };
13551                         unsafe { o.contents.err = core::ptr::null_mut(); }
13552                         CResult_TxAddOutputDecodeErrorZPtr { err }
13553                 };
13554                 Self {
13555                         contents,
13556                         result_ok: o.result_ok,
13557                 }
13558         }
13559 }
13560 impl Clone for CResult_TxAddOutputDecodeErrorZ {
13561         fn clone(&self) -> Self {
13562                 if self.result_ok {
13563                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
13564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
13565                         } }
13566                 } else {
13567                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
13568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13569                         } }
13570                 }
13571         }
13572 }
13573 #[no_mangle]
13574 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
13575 /// but with all dynamically-allocated buffers duplicated in new buffers.
13576 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
13577 #[repr(C)]
13578 /// The contents of CResult_TxRemoveInputDecodeErrorZ
13579 pub union CResult_TxRemoveInputDecodeErrorZPtr {
13580         /// A pointer to the contents in the success state.
13581         /// Reading from this pointer when `result_ok` is not set is undefined.
13582         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
13583         /// A pointer to the contents in the error state.
13584         /// Reading from this pointer when `result_ok` is set is undefined.
13585         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13586 }
13587 #[repr(C)]
13588 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
13589 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13591 pub struct CResult_TxRemoveInputDecodeErrorZ {
13592         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
13593         /// `err` or `result` depending on the state of `result_ok`.
13594         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
13595         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
13596         pub result_ok: bool,
13597 }
13598 #[no_mangle]
13599 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
13600 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
13601         CResult_TxRemoveInputDecodeErrorZ {
13602                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13603                         result: Box::into_raw(Box::new(o)),
13604                 },
13605                 result_ok: true,
13606         }
13607 }
13608 #[no_mangle]
13609 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
13610 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
13611         CResult_TxRemoveInputDecodeErrorZ {
13612                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13613                         err: Box::into_raw(Box::new(e)),
13614                 },
13615                 result_ok: false,
13616         }
13617 }
13618 /// Checks if the given object is currently in the success state
13619 #[no_mangle]
13620 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
13621         o.result_ok
13622 }
13623 #[no_mangle]
13624 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
13625 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
13626 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
13627         fn drop(&mut self) {
13628                 if self.result_ok {
13629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13631                         }
13632                 } else {
13633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13635                         }
13636                 }
13637         }
13638 }
13639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
13640         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13641                 let contents = if o.result_ok {
13642                         let result = unsafe { o.contents.result };
13643                         unsafe { o.contents.result = core::ptr::null_mut() };
13644                         CResult_TxRemoveInputDecodeErrorZPtr { result }
13645                 } else {
13646                         let err = unsafe { o.contents.err };
13647                         unsafe { o.contents.err = core::ptr::null_mut(); }
13648                         CResult_TxRemoveInputDecodeErrorZPtr { err }
13649                 };
13650                 Self {
13651                         contents,
13652                         result_ok: o.result_ok,
13653                 }
13654         }
13655 }
13656 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
13657         fn clone(&self) -> Self {
13658                 if self.result_ok {
13659                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13660                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
13661                         } }
13662                 } else {
13663                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13664                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13665                         } }
13666                 }
13667         }
13668 }
13669 #[no_mangle]
13670 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
13671 /// but with all dynamically-allocated buffers duplicated in new buffers.
13672 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
13673 #[repr(C)]
13674 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
13675 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
13676         /// A pointer to the contents in the success state.
13677         /// Reading from this pointer when `result_ok` is not set is undefined.
13678         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
13679         /// A pointer to the contents in the error state.
13680         /// Reading from this pointer when `result_ok` is set is undefined.
13681         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13682 }
13683 #[repr(C)]
13684 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
13685 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13687 pub struct CResult_TxRemoveOutputDecodeErrorZ {
13688         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
13689         /// `err` or `result` depending on the state of `result_ok`.
13690         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
13691         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
13692         pub result_ok: bool,
13693 }
13694 #[no_mangle]
13695 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
13696 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
13697         CResult_TxRemoveOutputDecodeErrorZ {
13698                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13699                         result: Box::into_raw(Box::new(o)),
13700                 },
13701                 result_ok: true,
13702         }
13703 }
13704 #[no_mangle]
13705 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
13706 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
13707         CResult_TxRemoveOutputDecodeErrorZ {
13708                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13709                         err: Box::into_raw(Box::new(e)),
13710                 },
13711                 result_ok: false,
13712         }
13713 }
13714 /// Checks if the given object is currently in the success state
13715 #[no_mangle]
13716 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
13717         o.result_ok
13718 }
13719 #[no_mangle]
13720 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
13721 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
13722 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
13723         fn drop(&mut self) {
13724                 if self.result_ok {
13725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13727                         }
13728                 } else {
13729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13731                         }
13732                 }
13733         }
13734 }
13735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
13736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13737                 let contents = if o.result_ok {
13738                         let result = unsafe { o.contents.result };
13739                         unsafe { o.contents.result = core::ptr::null_mut() };
13740                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
13741                 } else {
13742                         let err = unsafe { o.contents.err };
13743                         unsafe { o.contents.err = core::ptr::null_mut(); }
13744                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
13745                 };
13746                 Self {
13747                         contents,
13748                         result_ok: o.result_ok,
13749                 }
13750         }
13751 }
13752 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
13753         fn clone(&self) -> Self {
13754                 if self.result_ok {
13755                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13756                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
13757                         } }
13758                 } else {
13759                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13760                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13761                         } }
13762                 }
13763         }
13764 }
13765 #[no_mangle]
13766 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
13767 /// but with all dynamically-allocated buffers duplicated in new buffers.
13768 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
13769 #[repr(C)]
13770 /// The contents of CResult_TxCompleteDecodeErrorZ
13771 pub union CResult_TxCompleteDecodeErrorZPtr {
13772         /// A pointer to the contents in the success state.
13773         /// Reading from this pointer when `result_ok` is not set is undefined.
13774         pub result: *mut crate::lightning::ln::msgs::TxComplete,
13775         /// A pointer to the contents in the error state.
13776         /// Reading from this pointer when `result_ok` is set is undefined.
13777         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13778 }
13779 #[repr(C)]
13780 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
13781 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
13782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13783 pub struct CResult_TxCompleteDecodeErrorZ {
13784         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
13785         /// `err` or `result` depending on the state of `result_ok`.
13786         pub contents: CResult_TxCompleteDecodeErrorZPtr,
13787         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
13788         pub result_ok: bool,
13789 }
13790 #[no_mangle]
13791 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
13792 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
13793         CResult_TxCompleteDecodeErrorZ {
13794                 contents: CResult_TxCompleteDecodeErrorZPtr {
13795                         result: Box::into_raw(Box::new(o)),
13796                 },
13797                 result_ok: true,
13798         }
13799 }
13800 #[no_mangle]
13801 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
13802 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
13803         CResult_TxCompleteDecodeErrorZ {
13804                 contents: CResult_TxCompleteDecodeErrorZPtr {
13805                         err: Box::into_raw(Box::new(e)),
13806                 },
13807                 result_ok: false,
13808         }
13809 }
13810 /// Checks if the given object is currently in the success state
13811 #[no_mangle]
13812 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
13813         o.result_ok
13814 }
13815 #[no_mangle]
13816 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
13817 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
13818 impl Drop for CResult_TxCompleteDecodeErrorZ {
13819         fn drop(&mut self) {
13820                 if self.result_ok {
13821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13823                         }
13824                 } else {
13825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13827                         }
13828                 }
13829         }
13830 }
13831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
13832         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
13833                 let contents = if o.result_ok {
13834                         let result = unsafe { o.contents.result };
13835                         unsafe { o.contents.result = core::ptr::null_mut() };
13836                         CResult_TxCompleteDecodeErrorZPtr { result }
13837                 } else {
13838                         let err = unsafe { o.contents.err };
13839                         unsafe { o.contents.err = core::ptr::null_mut(); }
13840                         CResult_TxCompleteDecodeErrorZPtr { err }
13841                 };
13842                 Self {
13843                         contents,
13844                         result_ok: o.result_ok,
13845                 }
13846         }
13847 }
13848 impl Clone for CResult_TxCompleteDecodeErrorZ {
13849         fn clone(&self) -> Self {
13850                 if self.result_ok {
13851                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
13852                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
13853                         } }
13854                 } else {
13855                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
13856                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13857                         } }
13858                 }
13859         }
13860 }
13861 #[no_mangle]
13862 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
13863 /// but with all dynamically-allocated buffers duplicated in new buffers.
13864 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
13865 #[repr(C)]
13866 /// The contents of CResult_TxSignaturesDecodeErrorZ
13867 pub union CResult_TxSignaturesDecodeErrorZPtr {
13868         /// A pointer to the contents in the success state.
13869         /// Reading from this pointer when `result_ok` is not set is undefined.
13870         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
13871         /// A pointer to the contents in the error state.
13872         /// Reading from this pointer when `result_ok` is set is undefined.
13873         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13874 }
13875 #[repr(C)]
13876 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
13877 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13879 pub struct CResult_TxSignaturesDecodeErrorZ {
13880         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
13881         /// `err` or `result` depending on the state of `result_ok`.
13882         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
13883         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
13884         pub result_ok: bool,
13885 }
13886 #[no_mangle]
13887 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
13888 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
13889         CResult_TxSignaturesDecodeErrorZ {
13890                 contents: CResult_TxSignaturesDecodeErrorZPtr {
13891                         result: Box::into_raw(Box::new(o)),
13892                 },
13893                 result_ok: true,
13894         }
13895 }
13896 #[no_mangle]
13897 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
13898 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
13899         CResult_TxSignaturesDecodeErrorZ {
13900                 contents: CResult_TxSignaturesDecodeErrorZPtr {
13901                         err: Box::into_raw(Box::new(e)),
13902                 },
13903                 result_ok: false,
13904         }
13905 }
13906 /// Checks if the given object is currently in the success state
13907 #[no_mangle]
13908 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
13909         o.result_ok
13910 }
13911 #[no_mangle]
13912 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
13913 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
13914 impl Drop for CResult_TxSignaturesDecodeErrorZ {
13915         fn drop(&mut self) {
13916                 if self.result_ok {
13917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13919                         }
13920                 } else {
13921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13923                         }
13924                 }
13925         }
13926 }
13927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
13928         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13929                 let contents = if o.result_ok {
13930                         let result = unsafe { o.contents.result };
13931                         unsafe { o.contents.result = core::ptr::null_mut() };
13932                         CResult_TxSignaturesDecodeErrorZPtr { result }
13933                 } else {
13934                         let err = unsafe { o.contents.err };
13935                         unsafe { o.contents.err = core::ptr::null_mut(); }
13936                         CResult_TxSignaturesDecodeErrorZPtr { err }
13937                 };
13938                 Self {
13939                         contents,
13940                         result_ok: o.result_ok,
13941                 }
13942         }
13943 }
13944 impl Clone for CResult_TxSignaturesDecodeErrorZ {
13945         fn clone(&self) -> Self {
13946                 if self.result_ok {
13947                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
13948                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
13949                         } }
13950                 } else {
13951                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
13952                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13953                         } }
13954                 }
13955         }
13956 }
13957 #[no_mangle]
13958 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
13959 /// but with all dynamically-allocated buffers duplicated in new buffers.
13960 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
13961 #[repr(C)]
13962 /// The contents of CResult_TxInitRbfDecodeErrorZ
13963 pub union CResult_TxInitRbfDecodeErrorZPtr {
13964         /// A pointer to the contents in the success state.
13965         /// Reading from this pointer when `result_ok` is not set is undefined.
13966         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
13967         /// A pointer to the contents in the error state.
13968         /// Reading from this pointer when `result_ok` is set is undefined.
13969         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13970 }
13971 #[repr(C)]
13972 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
13973 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
13974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13975 pub struct CResult_TxInitRbfDecodeErrorZ {
13976         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
13977         /// `err` or `result` depending on the state of `result_ok`.
13978         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
13979         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
13980         pub result_ok: bool,
13981 }
13982 #[no_mangle]
13983 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
13984 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
13985         CResult_TxInitRbfDecodeErrorZ {
13986                 contents: CResult_TxInitRbfDecodeErrorZPtr {
13987                         result: Box::into_raw(Box::new(o)),
13988                 },
13989                 result_ok: true,
13990         }
13991 }
13992 #[no_mangle]
13993 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
13994 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
13995         CResult_TxInitRbfDecodeErrorZ {
13996                 contents: CResult_TxInitRbfDecodeErrorZPtr {
13997                         err: Box::into_raw(Box::new(e)),
13998                 },
13999                 result_ok: false,
14000         }
14001 }
14002 /// Checks if the given object is currently in the success state
14003 #[no_mangle]
14004 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
14005         o.result_ok
14006 }
14007 #[no_mangle]
14008 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
14009 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
14010 impl Drop for CResult_TxInitRbfDecodeErrorZ {
14011         fn drop(&mut self) {
14012                 if self.result_ok {
14013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14015                         }
14016                 } else {
14017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14019                         }
14020                 }
14021         }
14022 }
14023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
14024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14025                 let contents = if o.result_ok {
14026                         let result = unsafe { o.contents.result };
14027                         unsafe { o.contents.result = core::ptr::null_mut() };
14028                         CResult_TxInitRbfDecodeErrorZPtr { result }
14029                 } else {
14030                         let err = unsafe { o.contents.err };
14031                         unsafe { o.contents.err = core::ptr::null_mut(); }
14032                         CResult_TxInitRbfDecodeErrorZPtr { err }
14033                 };
14034                 Self {
14035                         contents,
14036                         result_ok: o.result_ok,
14037                 }
14038         }
14039 }
14040 impl Clone for CResult_TxInitRbfDecodeErrorZ {
14041         fn clone(&self) -> Self {
14042                 if self.result_ok {
14043                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
14044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
14045                         } }
14046                 } else {
14047                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
14048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14049                         } }
14050                 }
14051         }
14052 }
14053 #[no_mangle]
14054 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
14055 /// but with all dynamically-allocated buffers duplicated in new buffers.
14056 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
14057 #[repr(C)]
14058 /// The contents of CResult_TxAckRbfDecodeErrorZ
14059 pub union CResult_TxAckRbfDecodeErrorZPtr {
14060         /// A pointer to the contents in the success state.
14061         /// Reading from this pointer when `result_ok` is not set is undefined.
14062         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
14063         /// A pointer to the contents in the error state.
14064         /// Reading from this pointer when `result_ok` is set is undefined.
14065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14066 }
14067 #[repr(C)]
14068 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
14069 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14071 pub struct CResult_TxAckRbfDecodeErrorZ {
14072         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
14073         /// `err` or `result` depending on the state of `result_ok`.
14074         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
14075         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
14076         pub result_ok: bool,
14077 }
14078 #[no_mangle]
14079 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
14080 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
14081         CResult_TxAckRbfDecodeErrorZ {
14082                 contents: CResult_TxAckRbfDecodeErrorZPtr {
14083                         result: Box::into_raw(Box::new(o)),
14084                 },
14085                 result_ok: true,
14086         }
14087 }
14088 #[no_mangle]
14089 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
14090 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
14091         CResult_TxAckRbfDecodeErrorZ {
14092                 contents: CResult_TxAckRbfDecodeErrorZPtr {
14093                         err: Box::into_raw(Box::new(e)),
14094                 },
14095                 result_ok: false,
14096         }
14097 }
14098 /// Checks if the given object is currently in the success state
14099 #[no_mangle]
14100 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
14101         o.result_ok
14102 }
14103 #[no_mangle]
14104 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
14105 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
14106 impl Drop for CResult_TxAckRbfDecodeErrorZ {
14107         fn drop(&mut self) {
14108                 if self.result_ok {
14109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14111                         }
14112                 } else {
14113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14115                         }
14116                 }
14117         }
14118 }
14119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
14120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14121                 let contents = if o.result_ok {
14122                         let result = unsafe { o.contents.result };
14123                         unsafe { o.contents.result = core::ptr::null_mut() };
14124                         CResult_TxAckRbfDecodeErrorZPtr { result }
14125                 } else {
14126                         let err = unsafe { o.contents.err };
14127                         unsafe { o.contents.err = core::ptr::null_mut(); }
14128                         CResult_TxAckRbfDecodeErrorZPtr { err }
14129                 };
14130                 Self {
14131                         contents,
14132                         result_ok: o.result_ok,
14133                 }
14134         }
14135 }
14136 impl Clone for CResult_TxAckRbfDecodeErrorZ {
14137         fn clone(&self) -> Self {
14138                 if self.result_ok {
14139                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
14140                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
14141                         } }
14142                 } else {
14143                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
14144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14145                         } }
14146                 }
14147         }
14148 }
14149 #[no_mangle]
14150 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
14151 /// but with all dynamically-allocated buffers duplicated in new buffers.
14152 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
14153 #[repr(C)]
14154 /// The contents of CResult_TxAbortDecodeErrorZ
14155 pub union CResult_TxAbortDecodeErrorZPtr {
14156         /// A pointer to the contents in the success state.
14157         /// Reading from this pointer when `result_ok` is not set is undefined.
14158         pub result: *mut crate::lightning::ln::msgs::TxAbort,
14159         /// A pointer to the contents in the error state.
14160         /// Reading from this pointer when `result_ok` is set is undefined.
14161         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14162 }
14163 #[repr(C)]
14164 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
14165 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
14166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14167 pub struct CResult_TxAbortDecodeErrorZ {
14168         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
14169         /// `err` or `result` depending on the state of `result_ok`.
14170         pub contents: CResult_TxAbortDecodeErrorZPtr,
14171         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
14172         pub result_ok: bool,
14173 }
14174 #[no_mangle]
14175 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
14176 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
14177         CResult_TxAbortDecodeErrorZ {
14178                 contents: CResult_TxAbortDecodeErrorZPtr {
14179                         result: Box::into_raw(Box::new(o)),
14180                 },
14181                 result_ok: true,
14182         }
14183 }
14184 #[no_mangle]
14185 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
14186 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
14187         CResult_TxAbortDecodeErrorZ {
14188                 contents: CResult_TxAbortDecodeErrorZPtr {
14189                         err: Box::into_raw(Box::new(e)),
14190                 },
14191                 result_ok: false,
14192         }
14193 }
14194 /// Checks if the given object is currently in the success state
14195 #[no_mangle]
14196 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
14197         o.result_ok
14198 }
14199 #[no_mangle]
14200 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
14201 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
14202 impl Drop for CResult_TxAbortDecodeErrorZ {
14203         fn drop(&mut self) {
14204                 if self.result_ok {
14205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14207                         }
14208                 } else {
14209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14211                         }
14212                 }
14213         }
14214 }
14215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
14216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
14217                 let contents = if o.result_ok {
14218                         let result = unsafe { o.contents.result };
14219                         unsafe { o.contents.result = core::ptr::null_mut() };
14220                         CResult_TxAbortDecodeErrorZPtr { result }
14221                 } else {
14222                         let err = unsafe { o.contents.err };
14223                         unsafe { o.contents.err = core::ptr::null_mut(); }
14224                         CResult_TxAbortDecodeErrorZPtr { err }
14225                 };
14226                 Self {
14227                         contents,
14228                         result_ok: o.result_ok,
14229                 }
14230         }
14231 }
14232 impl Clone for CResult_TxAbortDecodeErrorZ {
14233         fn clone(&self) -> Self {
14234                 if self.result_ok {
14235                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
14236                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
14237                         } }
14238                 } else {
14239                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
14240                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14241                         } }
14242                 }
14243         }
14244 }
14245 #[no_mangle]
14246 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
14247 /// but with all dynamically-allocated buffers duplicated in new buffers.
14248 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
14249 #[repr(C)]
14250 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14251 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14252         /// A pointer to the contents in the success state.
14253         /// Reading from this pointer when `result_ok` is not set is undefined.
14254         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14255         /// A pointer to the contents in the error state.
14256         /// Reading from this pointer when `result_ok` is set is undefined.
14257         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14258 }
14259 #[repr(C)]
14260 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14261 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14263 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14264         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14265         /// `err` or `result` depending on the state of `result_ok`.
14266         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14267         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14268         pub result_ok: bool,
14269 }
14270 #[no_mangle]
14271 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14272 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14273         CResult_AnnouncementSignaturesDecodeErrorZ {
14274                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14275                         result: Box::into_raw(Box::new(o)),
14276                 },
14277                 result_ok: true,
14278         }
14279 }
14280 #[no_mangle]
14281 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14282 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14283         CResult_AnnouncementSignaturesDecodeErrorZ {
14284                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14285                         err: Box::into_raw(Box::new(e)),
14286                 },
14287                 result_ok: false,
14288         }
14289 }
14290 /// Checks if the given object is currently in the success state
14291 #[no_mangle]
14292 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14293         o.result_ok
14294 }
14295 #[no_mangle]
14296 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14297 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14298 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14299         fn drop(&mut self) {
14300                 if self.result_ok {
14301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14303                         }
14304                 } else {
14305                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14306                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14307                         }
14308                 }
14309         }
14310 }
14311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14312         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14313                 let contents = if o.result_ok {
14314                         let result = unsafe { o.contents.result };
14315                         unsafe { o.contents.result = core::ptr::null_mut() };
14316                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14317                 } else {
14318                         let err = unsafe { o.contents.err };
14319                         unsafe { o.contents.err = core::ptr::null_mut(); }
14320                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14321                 };
14322                 Self {
14323                         contents,
14324                         result_ok: o.result_ok,
14325                 }
14326         }
14327 }
14328 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14329         fn clone(&self) -> Self {
14330                 if self.result_ok {
14331                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14332                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14333                         } }
14334                 } else {
14335                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14336                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14337                         } }
14338                 }
14339         }
14340 }
14341 #[no_mangle]
14342 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14343 /// but with all dynamically-allocated buffers duplicated in new buffers.
14344 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14345 #[repr(C)]
14346 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14347 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14348         /// A pointer to the contents in the success state.
14349         /// Reading from this pointer when `result_ok` is not set is undefined.
14350         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14351         /// A pointer to the contents in the error state.
14352         /// Reading from this pointer when `result_ok` is set is undefined.
14353         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14354 }
14355 #[repr(C)]
14356 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14357 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14359 pub struct CResult_ChannelReestablishDecodeErrorZ {
14360         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14361         /// `err` or `result` depending on the state of `result_ok`.
14362         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14363         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14364         pub result_ok: bool,
14365 }
14366 #[no_mangle]
14367 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14368 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14369         CResult_ChannelReestablishDecodeErrorZ {
14370                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14371                         result: Box::into_raw(Box::new(o)),
14372                 },
14373                 result_ok: true,
14374         }
14375 }
14376 #[no_mangle]
14377 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14378 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14379         CResult_ChannelReestablishDecodeErrorZ {
14380                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14381                         err: Box::into_raw(Box::new(e)),
14382                 },
14383                 result_ok: false,
14384         }
14385 }
14386 /// Checks if the given object is currently in the success state
14387 #[no_mangle]
14388 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14389         o.result_ok
14390 }
14391 #[no_mangle]
14392 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14393 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14394 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14395         fn drop(&mut self) {
14396                 if self.result_ok {
14397                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14398                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14399                         }
14400                 } else {
14401                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14402                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14403                         }
14404                 }
14405         }
14406 }
14407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14408         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14409                 let contents = if o.result_ok {
14410                         let result = unsafe { o.contents.result };
14411                         unsafe { o.contents.result = core::ptr::null_mut() };
14412                         CResult_ChannelReestablishDecodeErrorZPtr { result }
14413                 } else {
14414                         let err = unsafe { o.contents.err };
14415                         unsafe { o.contents.err = core::ptr::null_mut(); }
14416                         CResult_ChannelReestablishDecodeErrorZPtr { err }
14417                 };
14418                 Self {
14419                         contents,
14420                         result_ok: o.result_ok,
14421                 }
14422         }
14423 }
14424 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14425         fn clone(&self) -> Self {
14426                 if self.result_ok {
14427                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14428                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14429                         } }
14430                 } else {
14431                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14432                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14433                         } }
14434                 }
14435         }
14436 }
14437 #[no_mangle]
14438 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14439 /// but with all dynamically-allocated buffers duplicated in new buffers.
14440 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14441 #[repr(C)]
14442 /// The contents of CResult_ClosingSignedDecodeErrorZ
14443 pub union CResult_ClosingSignedDecodeErrorZPtr {
14444         /// A pointer to the contents in the success state.
14445         /// Reading from this pointer when `result_ok` is not set is undefined.
14446         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14447         /// A pointer to the contents in the error state.
14448         /// Reading from this pointer when `result_ok` is set is undefined.
14449         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14450 }
14451 #[repr(C)]
14452 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14453 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14455 pub struct CResult_ClosingSignedDecodeErrorZ {
14456         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14457         /// `err` or `result` depending on the state of `result_ok`.
14458         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14459         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14460         pub result_ok: bool,
14461 }
14462 #[no_mangle]
14463 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14464 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14465         CResult_ClosingSignedDecodeErrorZ {
14466                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14467                         result: Box::into_raw(Box::new(o)),
14468                 },
14469                 result_ok: true,
14470         }
14471 }
14472 #[no_mangle]
14473 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14474 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14475         CResult_ClosingSignedDecodeErrorZ {
14476                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14477                         err: Box::into_raw(Box::new(e)),
14478                 },
14479                 result_ok: false,
14480         }
14481 }
14482 /// Checks if the given object is currently in the success state
14483 #[no_mangle]
14484 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14485         o.result_ok
14486 }
14487 #[no_mangle]
14488 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14489 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14490 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14491         fn drop(&mut self) {
14492                 if self.result_ok {
14493                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14494                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14495                         }
14496                 } else {
14497                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14498                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14499                         }
14500                 }
14501         }
14502 }
14503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14504         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14505                 let contents = if o.result_ok {
14506                         let result = unsafe { o.contents.result };
14507                         unsafe { o.contents.result = core::ptr::null_mut() };
14508                         CResult_ClosingSignedDecodeErrorZPtr { result }
14509                 } else {
14510                         let err = unsafe { o.contents.err };
14511                         unsafe { o.contents.err = core::ptr::null_mut(); }
14512                         CResult_ClosingSignedDecodeErrorZPtr { err }
14513                 };
14514                 Self {
14515                         contents,
14516                         result_ok: o.result_ok,
14517                 }
14518         }
14519 }
14520 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14521         fn clone(&self) -> Self {
14522                 if self.result_ok {
14523                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14524                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14525                         } }
14526                 } else {
14527                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14528                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14529                         } }
14530                 }
14531         }
14532 }
14533 #[no_mangle]
14534 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14535 /// but with all dynamically-allocated buffers duplicated in new buffers.
14536 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14537 #[repr(C)]
14538 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14539 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14540         /// A pointer to the contents in the success state.
14541         /// Reading from this pointer when `result_ok` is not set is undefined.
14542         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14543         /// A pointer to the contents in the error state.
14544         /// Reading from this pointer when `result_ok` is set is undefined.
14545         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14546 }
14547 #[repr(C)]
14548 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14549 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14551 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14552         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14553         /// `err` or `result` depending on the state of `result_ok`.
14554         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14555         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14556         pub result_ok: bool,
14557 }
14558 #[no_mangle]
14559 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14560 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14561         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14562                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14563                         result: Box::into_raw(Box::new(o)),
14564                 },
14565                 result_ok: true,
14566         }
14567 }
14568 #[no_mangle]
14569 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14570 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14571         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14572                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14573                         err: Box::into_raw(Box::new(e)),
14574                 },
14575                 result_ok: false,
14576         }
14577 }
14578 /// Checks if the given object is currently in the success state
14579 #[no_mangle]
14580 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14581         o.result_ok
14582 }
14583 #[no_mangle]
14584 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14585 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14586 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14587         fn drop(&mut self) {
14588                 if self.result_ok {
14589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14591                         }
14592                 } else {
14593                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14594                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14595                         }
14596                 }
14597         }
14598 }
14599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14600         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14601                 let contents = if o.result_ok {
14602                         let result = unsafe { o.contents.result };
14603                         unsafe { o.contents.result = core::ptr::null_mut() };
14604                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14605                 } else {
14606                         let err = unsafe { o.contents.err };
14607                         unsafe { o.contents.err = core::ptr::null_mut(); }
14608                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14609                 };
14610                 Self {
14611                         contents,
14612                         result_ok: o.result_ok,
14613                 }
14614         }
14615 }
14616 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14617         fn clone(&self) -> Self {
14618                 if self.result_ok {
14619                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14620                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14621                         } }
14622                 } else {
14623                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14624                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14625                         } }
14626                 }
14627         }
14628 }
14629 #[no_mangle]
14630 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14631 /// but with all dynamically-allocated buffers duplicated in new buffers.
14632 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14633 #[repr(C)]
14634 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14635 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14636         /// A pointer to the contents in the success state.
14637         /// Reading from this pointer when `result_ok` is not set is undefined.
14638         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14639         /// A pointer to the contents in the error state.
14640         /// Reading from this pointer when `result_ok` is set is undefined.
14641         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14642 }
14643 #[repr(C)]
14644 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14645 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14647 pub struct CResult_CommitmentSignedDecodeErrorZ {
14648         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14649         /// `err` or `result` depending on the state of `result_ok`.
14650         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14651         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14652         pub result_ok: bool,
14653 }
14654 #[no_mangle]
14655 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14656 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14657         CResult_CommitmentSignedDecodeErrorZ {
14658                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14659                         result: Box::into_raw(Box::new(o)),
14660                 },
14661                 result_ok: true,
14662         }
14663 }
14664 #[no_mangle]
14665 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14666 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14667         CResult_CommitmentSignedDecodeErrorZ {
14668                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14669                         err: Box::into_raw(Box::new(e)),
14670                 },
14671                 result_ok: false,
14672         }
14673 }
14674 /// Checks if the given object is currently in the success state
14675 #[no_mangle]
14676 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14677         o.result_ok
14678 }
14679 #[no_mangle]
14680 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14681 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14682 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14683         fn drop(&mut self) {
14684                 if self.result_ok {
14685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14687                         }
14688                 } else {
14689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14691                         }
14692                 }
14693         }
14694 }
14695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
14696         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14697                 let contents = if o.result_ok {
14698                         let result = unsafe { o.contents.result };
14699                         unsafe { o.contents.result = core::ptr::null_mut() };
14700                         CResult_CommitmentSignedDecodeErrorZPtr { result }
14701                 } else {
14702                         let err = unsafe { o.contents.err };
14703                         unsafe { o.contents.err = core::ptr::null_mut(); }
14704                         CResult_CommitmentSignedDecodeErrorZPtr { err }
14705                 };
14706                 Self {
14707                         contents,
14708                         result_ok: o.result_ok,
14709                 }
14710         }
14711 }
14712 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
14713         fn clone(&self) -> Self {
14714                 if self.result_ok {
14715                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14716                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
14717                         } }
14718                 } else {
14719                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14720                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14721                         } }
14722                 }
14723         }
14724 }
14725 #[no_mangle]
14726 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14727 /// but with all dynamically-allocated buffers duplicated in new buffers.
14728 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
14729 #[repr(C)]
14730 /// The contents of CResult_FundingCreatedDecodeErrorZ
14731 pub union CResult_FundingCreatedDecodeErrorZPtr {
14732         /// A pointer to the contents in the success state.
14733         /// Reading from this pointer when `result_ok` is not set is undefined.
14734         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
14735         /// A pointer to the contents in the error state.
14736         /// Reading from this pointer when `result_ok` is set is undefined.
14737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14738 }
14739 #[repr(C)]
14740 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
14741 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
14742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14743 pub struct CResult_FundingCreatedDecodeErrorZ {
14744         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
14745         /// `err` or `result` depending on the state of `result_ok`.
14746         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
14747         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
14748         pub result_ok: bool,
14749 }
14750 #[no_mangle]
14751 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14752 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
14753         CResult_FundingCreatedDecodeErrorZ {
14754                 contents: CResult_FundingCreatedDecodeErrorZPtr {
14755                         result: Box::into_raw(Box::new(o)),
14756                 },
14757                 result_ok: true,
14758         }
14759 }
14760 #[no_mangle]
14761 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14762 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
14763         CResult_FundingCreatedDecodeErrorZ {
14764                 contents: CResult_FundingCreatedDecodeErrorZPtr {
14765                         err: Box::into_raw(Box::new(e)),
14766                 },
14767                 result_ok: false,
14768         }
14769 }
14770 /// Checks if the given object is currently in the success state
14771 #[no_mangle]
14772 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
14773         o.result_ok
14774 }
14775 #[no_mangle]
14776 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14777 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
14778 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14779         fn drop(&mut self) {
14780                 if self.result_ok {
14781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14783                         }
14784                 } else {
14785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14787                         }
14788                 }
14789         }
14790 }
14791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14792         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14793                 let contents = if o.result_ok {
14794                         let result = unsafe { o.contents.result };
14795                         unsafe { o.contents.result = core::ptr::null_mut() };
14796                         CResult_FundingCreatedDecodeErrorZPtr { result }
14797                 } else {
14798                         let err = unsafe { o.contents.err };
14799                         unsafe { o.contents.err = core::ptr::null_mut(); }
14800                         CResult_FundingCreatedDecodeErrorZPtr { err }
14801                 };
14802                 Self {
14803                         contents,
14804                         result_ok: o.result_ok,
14805                 }
14806         }
14807 }
14808 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14809         fn clone(&self) -> Self {
14810                 if self.result_ok {
14811                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14812                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14813                         } }
14814                 } else {
14815                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14816                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14817                         } }
14818                 }
14819         }
14820 }
14821 #[no_mangle]
14822 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14823 /// but with all dynamically-allocated buffers duplicated in new buffers.
14824 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14825 #[repr(C)]
14826 /// The contents of CResult_FundingSignedDecodeErrorZ
14827 pub union CResult_FundingSignedDecodeErrorZPtr {
14828         /// A pointer to the contents in the success state.
14829         /// Reading from this pointer when `result_ok` is not set is undefined.
14830         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14831         /// A pointer to the contents in the error state.
14832         /// Reading from this pointer when `result_ok` is set is undefined.
14833         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14834 }
14835 #[repr(C)]
14836 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14837 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14839 pub struct CResult_FundingSignedDecodeErrorZ {
14840         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14841         /// `err` or `result` depending on the state of `result_ok`.
14842         pub contents: CResult_FundingSignedDecodeErrorZPtr,
14843         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14844         pub result_ok: bool,
14845 }
14846 #[no_mangle]
14847 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14848 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14849         CResult_FundingSignedDecodeErrorZ {
14850                 contents: CResult_FundingSignedDecodeErrorZPtr {
14851                         result: Box::into_raw(Box::new(o)),
14852                 },
14853                 result_ok: true,
14854         }
14855 }
14856 #[no_mangle]
14857 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14858 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14859         CResult_FundingSignedDecodeErrorZ {
14860                 contents: CResult_FundingSignedDecodeErrorZPtr {
14861                         err: Box::into_raw(Box::new(e)),
14862                 },
14863                 result_ok: false,
14864         }
14865 }
14866 /// Checks if the given object is currently in the success state
14867 #[no_mangle]
14868 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14869         o.result_ok
14870 }
14871 #[no_mangle]
14872 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14873 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14874 impl Drop for CResult_FundingSignedDecodeErrorZ {
14875         fn drop(&mut self) {
14876                 if self.result_ok {
14877                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14878                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14879                         }
14880                 } else {
14881                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14882                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14883                         }
14884                 }
14885         }
14886 }
14887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14888         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14889                 let contents = if o.result_ok {
14890                         let result = unsafe { o.contents.result };
14891                         unsafe { o.contents.result = core::ptr::null_mut() };
14892                         CResult_FundingSignedDecodeErrorZPtr { result }
14893                 } else {
14894                         let err = unsafe { o.contents.err };
14895                         unsafe { o.contents.err = core::ptr::null_mut(); }
14896                         CResult_FundingSignedDecodeErrorZPtr { err }
14897                 };
14898                 Self {
14899                         contents,
14900                         result_ok: o.result_ok,
14901                 }
14902         }
14903 }
14904 impl Clone for CResult_FundingSignedDecodeErrorZ {
14905         fn clone(&self) -> Self {
14906                 if self.result_ok {
14907                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14908                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14909                         } }
14910                 } else {
14911                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14912                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14913                         } }
14914                 }
14915         }
14916 }
14917 #[no_mangle]
14918 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14919 /// but with all dynamically-allocated buffers duplicated in new buffers.
14920 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14921 #[repr(C)]
14922 /// The contents of CResult_ChannelReadyDecodeErrorZ
14923 pub union CResult_ChannelReadyDecodeErrorZPtr {
14924         /// A pointer to the contents in the success state.
14925         /// Reading from this pointer when `result_ok` is not set is undefined.
14926         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14927         /// A pointer to the contents in the error state.
14928         /// Reading from this pointer when `result_ok` is set is undefined.
14929         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14930 }
14931 #[repr(C)]
14932 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14933 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14935 pub struct CResult_ChannelReadyDecodeErrorZ {
14936         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14937         /// `err` or `result` depending on the state of `result_ok`.
14938         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14939         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14940         pub result_ok: bool,
14941 }
14942 #[no_mangle]
14943 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14944 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14945         CResult_ChannelReadyDecodeErrorZ {
14946                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14947                         result: Box::into_raw(Box::new(o)),
14948                 },
14949                 result_ok: true,
14950         }
14951 }
14952 #[no_mangle]
14953 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14954 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14955         CResult_ChannelReadyDecodeErrorZ {
14956                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14957                         err: Box::into_raw(Box::new(e)),
14958                 },
14959                 result_ok: false,
14960         }
14961 }
14962 /// Checks if the given object is currently in the success state
14963 #[no_mangle]
14964 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14965         o.result_ok
14966 }
14967 #[no_mangle]
14968 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14969 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14970 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14971         fn drop(&mut self) {
14972                 if self.result_ok {
14973                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14974                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14975                         }
14976                 } else {
14977                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14978                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14979                         }
14980                 }
14981         }
14982 }
14983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14984         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14985                 let contents = if o.result_ok {
14986                         let result = unsafe { o.contents.result };
14987                         unsafe { o.contents.result = core::ptr::null_mut() };
14988                         CResult_ChannelReadyDecodeErrorZPtr { result }
14989                 } else {
14990                         let err = unsafe { o.contents.err };
14991                         unsafe { o.contents.err = core::ptr::null_mut(); }
14992                         CResult_ChannelReadyDecodeErrorZPtr { err }
14993                 };
14994                 Self {
14995                         contents,
14996                         result_ok: o.result_ok,
14997                 }
14998         }
14999 }
15000 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15001         fn clone(&self) -> Self {
15002                 if self.result_ok {
15003                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15004                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15005                         } }
15006                 } else {
15007                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15008                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15009                         } }
15010                 }
15011         }
15012 }
15013 #[no_mangle]
15014 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15015 /// but with all dynamically-allocated buffers duplicated in new buffers.
15016 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15017 #[repr(C)]
15018 /// The contents of CResult_InitDecodeErrorZ
15019 pub union CResult_InitDecodeErrorZPtr {
15020         /// A pointer to the contents in the success state.
15021         /// Reading from this pointer when `result_ok` is not set is undefined.
15022         pub result: *mut crate::lightning::ln::msgs::Init,
15023         /// A pointer to the contents in the error state.
15024         /// Reading from this pointer when `result_ok` is set is undefined.
15025         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15026 }
15027 #[repr(C)]
15028 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15029 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15031 pub struct CResult_InitDecodeErrorZ {
15032         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15033         /// `err` or `result` depending on the state of `result_ok`.
15034         pub contents: CResult_InitDecodeErrorZPtr,
15035         /// Whether this CResult_InitDecodeErrorZ represents a success state.
15036         pub result_ok: bool,
15037 }
15038 #[no_mangle]
15039 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15040 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15041         CResult_InitDecodeErrorZ {
15042                 contents: CResult_InitDecodeErrorZPtr {
15043                         result: Box::into_raw(Box::new(o)),
15044                 },
15045                 result_ok: true,
15046         }
15047 }
15048 #[no_mangle]
15049 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15050 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15051         CResult_InitDecodeErrorZ {
15052                 contents: CResult_InitDecodeErrorZPtr {
15053                         err: Box::into_raw(Box::new(e)),
15054                 },
15055                 result_ok: false,
15056         }
15057 }
15058 /// Checks if the given object is currently in the success state
15059 #[no_mangle]
15060 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15061         o.result_ok
15062 }
15063 #[no_mangle]
15064 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15065 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15066 impl Drop for CResult_InitDecodeErrorZ {
15067         fn drop(&mut self) {
15068                 if self.result_ok {
15069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15071                         }
15072                 } else {
15073                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15074                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15075                         }
15076                 }
15077         }
15078 }
15079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15080         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15081                 let contents = if o.result_ok {
15082                         let result = unsafe { o.contents.result };
15083                         unsafe { o.contents.result = core::ptr::null_mut() };
15084                         CResult_InitDecodeErrorZPtr { result }
15085                 } else {
15086                         let err = unsafe { o.contents.err };
15087                         unsafe { o.contents.err = core::ptr::null_mut(); }
15088                         CResult_InitDecodeErrorZPtr { err }
15089                 };
15090                 Self {
15091                         contents,
15092                         result_ok: o.result_ok,
15093                 }
15094         }
15095 }
15096 impl Clone for CResult_InitDecodeErrorZ {
15097         fn clone(&self) -> Self {
15098                 if self.result_ok {
15099                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15100                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15101                         } }
15102                 } else {
15103                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15104                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15105                         } }
15106                 }
15107         }
15108 }
15109 #[no_mangle]
15110 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15111 /// but with all dynamically-allocated buffers duplicated in new buffers.
15112 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15113 #[repr(C)]
15114 /// The contents of CResult_OpenChannelDecodeErrorZ
15115 pub union CResult_OpenChannelDecodeErrorZPtr {
15116         /// A pointer to the contents in the success state.
15117         /// Reading from this pointer when `result_ok` is not set is undefined.
15118         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15119         /// A pointer to the contents in the error state.
15120         /// Reading from this pointer when `result_ok` is set is undefined.
15121         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15122 }
15123 #[repr(C)]
15124 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15125 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15127 pub struct CResult_OpenChannelDecodeErrorZ {
15128         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15129         /// `err` or `result` depending on the state of `result_ok`.
15130         pub contents: CResult_OpenChannelDecodeErrorZPtr,
15131         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15132         pub result_ok: bool,
15133 }
15134 #[no_mangle]
15135 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15136 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15137         CResult_OpenChannelDecodeErrorZ {
15138                 contents: CResult_OpenChannelDecodeErrorZPtr {
15139                         result: Box::into_raw(Box::new(o)),
15140                 },
15141                 result_ok: true,
15142         }
15143 }
15144 #[no_mangle]
15145 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15146 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15147         CResult_OpenChannelDecodeErrorZ {
15148                 contents: CResult_OpenChannelDecodeErrorZPtr {
15149                         err: Box::into_raw(Box::new(e)),
15150                 },
15151                 result_ok: false,
15152         }
15153 }
15154 /// Checks if the given object is currently in the success state
15155 #[no_mangle]
15156 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15157         o.result_ok
15158 }
15159 #[no_mangle]
15160 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15161 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15162 impl Drop for CResult_OpenChannelDecodeErrorZ {
15163         fn drop(&mut self) {
15164                 if self.result_ok {
15165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15167                         }
15168                 } else {
15169                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15170                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15171                         }
15172                 }
15173         }
15174 }
15175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15176         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15177                 let contents = if o.result_ok {
15178                         let result = unsafe { o.contents.result };
15179                         unsafe { o.contents.result = core::ptr::null_mut() };
15180                         CResult_OpenChannelDecodeErrorZPtr { result }
15181                 } else {
15182                         let err = unsafe { o.contents.err };
15183                         unsafe { o.contents.err = core::ptr::null_mut(); }
15184                         CResult_OpenChannelDecodeErrorZPtr { err }
15185                 };
15186                 Self {
15187                         contents,
15188                         result_ok: o.result_ok,
15189                 }
15190         }
15191 }
15192 impl Clone for CResult_OpenChannelDecodeErrorZ {
15193         fn clone(&self) -> Self {
15194                 if self.result_ok {
15195                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15196                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15197                         } }
15198                 } else {
15199                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15200                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15201                         } }
15202                 }
15203         }
15204 }
15205 #[no_mangle]
15206 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15207 /// but with all dynamically-allocated buffers duplicated in new buffers.
15208 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15209 #[repr(C)]
15210 /// The contents of CResult_OpenChannelV2DecodeErrorZ
15211 pub union CResult_OpenChannelV2DecodeErrorZPtr {
15212         /// A pointer to the contents in the success state.
15213         /// Reading from this pointer when `result_ok` is not set is undefined.
15214         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
15215         /// A pointer to the contents in the error state.
15216         /// Reading from this pointer when `result_ok` is set is undefined.
15217         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15218 }
15219 #[repr(C)]
15220 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
15221 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15223 pub struct CResult_OpenChannelV2DecodeErrorZ {
15224         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
15225         /// `err` or `result` depending on the state of `result_ok`.
15226         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
15227         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
15228         pub result_ok: bool,
15229 }
15230 #[no_mangle]
15231 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
15232 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
15233         CResult_OpenChannelV2DecodeErrorZ {
15234                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15235                         result: Box::into_raw(Box::new(o)),
15236                 },
15237                 result_ok: true,
15238         }
15239 }
15240 #[no_mangle]
15241 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
15242 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
15243         CResult_OpenChannelV2DecodeErrorZ {
15244                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15245                         err: Box::into_raw(Box::new(e)),
15246                 },
15247                 result_ok: false,
15248         }
15249 }
15250 /// Checks if the given object is currently in the success state
15251 #[no_mangle]
15252 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
15253         o.result_ok
15254 }
15255 #[no_mangle]
15256 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
15257 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
15258 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
15259         fn drop(&mut self) {
15260                 if self.result_ok {
15261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15263                         }
15264                 } else {
15265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15267                         }
15268                 }
15269         }
15270 }
15271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
15272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15273                 let contents = if o.result_ok {
15274                         let result = unsafe { o.contents.result };
15275                         unsafe { o.contents.result = core::ptr::null_mut() };
15276                         CResult_OpenChannelV2DecodeErrorZPtr { result }
15277                 } else {
15278                         let err = unsafe { o.contents.err };
15279                         unsafe { o.contents.err = core::ptr::null_mut(); }
15280                         CResult_OpenChannelV2DecodeErrorZPtr { err }
15281                 };
15282                 Self {
15283                         contents,
15284                         result_ok: o.result_ok,
15285                 }
15286         }
15287 }
15288 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
15289         fn clone(&self) -> Self {
15290                 if self.result_ok {
15291                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15292                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
15293                         } }
15294                 } else {
15295                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15297                         } }
15298                 }
15299         }
15300 }
15301 #[no_mangle]
15302 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
15303 /// but with all dynamically-allocated buffers duplicated in new buffers.
15304 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
15305 #[repr(C)]
15306 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15307 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15308         /// A pointer to the contents in the success state.
15309         /// Reading from this pointer when `result_ok` is not set is undefined.
15310         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15311         /// A pointer to the contents in the error state.
15312         /// Reading from this pointer when `result_ok` is set is undefined.
15313         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15314 }
15315 #[repr(C)]
15316 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15317 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15319 pub struct CResult_RevokeAndACKDecodeErrorZ {
15320         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15321         /// `err` or `result` depending on the state of `result_ok`.
15322         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15323         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15324         pub result_ok: bool,
15325 }
15326 #[no_mangle]
15327 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15328 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15329         CResult_RevokeAndACKDecodeErrorZ {
15330                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15331                         result: Box::into_raw(Box::new(o)),
15332                 },
15333                 result_ok: true,
15334         }
15335 }
15336 #[no_mangle]
15337 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15338 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15339         CResult_RevokeAndACKDecodeErrorZ {
15340                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15341                         err: Box::into_raw(Box::new(e)),
15342                 },
15343                 result_ok: false,
15344         }
15345 }
15346 /// Checks if the given object is currently in the success state
15347 #[no_mangle]
15348 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15349         o.result_ok
15350 }
15351 #[no_mangle]
15352 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15353 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15354 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15355         fn drop(&mut self) {
15356                 if self.result_ok {
15357                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15358                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15359                         }
15360                 } else {
15361                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15362                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15363                         }
15364                 }
15365         }
15366 }
15367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15368         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15369                 let contents = if o.result_ok {
15370                         let result = unsafe { o.contents.result };
15371                         unsafe { o.contents.result = core::ptr::null_mut() };
15372                         CResult_RevokeAndACKDecodeErrorZPtr { result }
15373                 } else {
15374                         let err = unsafe { o.contents.err };
15375                         unsafe { o.contents.err = core::ptr::null_mut(); }
15376                         CResult_RevokeAndACKDecodeErrorZPtr { err }
15377                 };
15378                 Self {
15379                         contents,
15380                         result_ok: o.result_ok,
15381                 }
15382         }
15383 }
15384 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15385         fn clone(&self) -> Self {
15386                 if self.result_ok {
15387                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15388                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15389                         } }
15390                 } else {
15391                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15392                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15393                         } }
15394                 }
15395         }
15396 }
15397 #[no_mangle]
15398 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15399 /// but with all dynamically-allocated buffers duplicated in new buffers.
15400 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15401 #[repr(C)]
15402 /// The contents of CResult_ShutdownDecodeErrorZ
15403 pub union CResult_ShutdownDecodeErrorZPtr {
15404         /// A pointer to the contents in the success state.
15405         /// Reading from this pointer when `result_ok` is not set is undefined.
15406         pub result: *mut crate::lightning::ln::msgs::Shutdown,
15407         /// A pointer to the contents in the error state.
15408         /// Reading from this pointer when `result_ok` is set is undefined.
15409         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15410 }
15411 #[repr(C)]
15412 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15413 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15415 pub struct CResult_ShutdownDecodeErrorZ {
15416         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15417         /// `err` or `result` depending on the state of `result_ok`.
15418         pub contents: CResult_ShutdownDecodeErrorZPtr,
15419         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15420         pub result_ok: bool,
15421 }
15422 #[no_mangle]
15423 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15424 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15425         CResult_ShutdownDecodeErrorZ {
15426                 contents: CResult_ShutdownDecodeErrorZPtr {
15427                         result: Box::into_raw(Box::new(o)),
15428                 },
15429                 result_ok: true,
15430         }
15431 }
15432 #[no_mangle]
15433 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15434 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15435         CResult_ShutdownDecodeErrorZ {
15436                 contents: CResult_ShutdownDecodeErrorZPtr {
15437                         err: Box::into_raw(Box::new(e)),
15438                 },
15439                 result_ok: false,
15440         }
15441 }
15442 /// Checks if the given object is currently in the success state
15443 #[no_mangle]
15444 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15445         o.result_ok
15446 }
15447 #[no_mangle]
15448 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15449 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15450 impl Drop for CResult_ShutdownDecodeErrorZ {
15451         fn drop(&mut self) {
15452                 if self.result_ok {
15453                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15454                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15455                         }
15456                 } else {
15457                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15458                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15459                         }
15460                 }
15461         }
15462 }
15463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15464         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15465                 let contents = if o.result_ok {
15466                         let result = unsafe { o.contents.result };
15467                         unsafe { o.contents.result = core::ptr::null_mut() };
15468                         CResult_ShutdownDecodeErrorZPtr { result }
15469                 } else {
15470                         let err = unsafe { o.contents.err };
15471                         unsafe { o.contents.err = core::ptr::null_mut(); }
15472                         CResult_ShutdownDecodeErrorZPtr { err }
15473                 };
15474                 Self {
15475                         contents,
15476                         result_ok: o.result_ok,
15477                 }
15478         }
15479 }
15480 impl Clone for CResult_ShutdownDecodeErrorZ {
15481         fn clone(&self) -> Self {
15482                 if self.result_ok {
15483                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15484                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15485                         } }
15486                 } else {
15487                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15488                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15489                         } }
15490                 }
15491         }
15492 }
15493 #[no_mangle]
15494 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15495 /// but with all dynamically-allocated buffers duplicated in new buffers.
15496 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15497 #[repr(C)]
15498 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15499 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15500         /// A pointer to the contents in the success state.
15501         /// Reading from this pointer when `result_ok` is not set is undefined.
15502         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15503         /// A pointer to the contents in the error state.
15504         /// Reading from this pointer when `result_ok` is set is undefined.
15505         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15506 }
15507 #[repr(C)]
15508 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15509 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15511 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15512         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15513         /// `err` or `result` depending on the state of `result_ok`.
15514         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15515         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15516         pub result_ok: bool,
15517 }
15518 #[no_mangle]
15519 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15520 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15521         CResult_UpdateFailHTLCDecodeErrorZ {
15522                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15523                         result: Box::into_raw(Box::new(o)),
15524                 },
15525                 result_ok: true,
15526         }
15527 }
15528 #[no_mangle]
15529 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15530 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15531         CResult_UpdateFailHTLCDecodeErrorZ {
15532                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15533                         err: Box::into_raw(Box::new(e)),
15534                 },
15535                 result_ok: false,
15536         }
15537 }
15538 /// Checks if the given object is currently in the success state
15539 #[no_mangle]
15540 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15541         o.result_ok
15542 }
15543 #[no_mangle]
15544 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15545 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15546 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15547         fn drop(&mut self) {
15548                 if self.result_ok {
15549                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15550                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15551                         }
15552                 } else {
15553                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15554                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15555                         }
15556                 }
15557         }
15558 }
15559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15560         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15561                 let contents = if o.result_ok {
15562                         let result = unsafe { o.contents.result };
15563                         unsafe { o.contents.result = core::ptr::null_mut() };
15564                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15565                 } else {
15566                         let err = unsafe { o.contents.err };
15567                         unsafe { o.contents.err = core::ptr::null_mut(); }
15568                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15569                 };
15570                 Self {
15571                         contents,
15572                         result_ok: o.result_ok,
15573                 }
15574         }
15575 }
15576 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15577         fn clone(&self) -> Self {
15578                 if self.result_ok {
15579                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15580                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15581                         } }
15582                 } else {
15583                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15584                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15585                         } }
15586                 }
15587         }
15588 }
15589 #[no_mangle]
15590 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15591 /// but with all dynamically-allocated buffers duplicated in new buffers.
15592 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15593 #[repr(C)]
15594 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15595 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15596         /// A pointer to the contents in the success state.
15597         /// Reading from this pointer when `result_ok` is not set is undefined.
15598         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15599         /// A pointer to the contents in the error state.
15600         /// Reading from this pointer when `result_ok` is set is undefined.
15601         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15602 }
15603 #[repr(C)]
15604 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15605 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15607 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15608         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15609         /// `err` or `result` depending on the state of `result_ok`.
15610         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15611         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15612         pub result_ok: bool,
15613 }
15614 #[no_mangle]
15615 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15616 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15617         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15618                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15619                         result: Box::into_raw(Box::new(o)),
15620                 },
15621                 result_ok: true,
15622         }
15623 }
15624 #[no_mangle]
15625 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15626 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15627         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15628                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15629                         err: Box::into_raw(Box::new(e)),
15630                 },
15631                 result_ok: false,
15632         }
15633 }
15634 /// Checks if the given object is currently in the success state
15635 #[no_mangle]
15636 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15637         o.result_ok
15638 }
15639 #[no_mangle]
15640 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15641 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15642 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15643         fn drop(&mut self) {
15644                 if self.result_ok {
15645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15647                         }
15648                 } else {
15649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15651                         }
15652                 }
15653         }
15654 }
15655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15656         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15657                 let contents = if o.result_ok {
15658                         let result = unsafe { o.contents.result };
15659                         unsafe { o.contents.result = core::ptr::null_mut() };
15660                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15661                 } else {
15662                         let err = unsafe { o.contents.err };
15663                         unsafe { o.contents.err = core::ptr::null_mut(); }
15664                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15665                 };
15666                 Self {
15667                         contents,
15668                         result_ok: o.result_ok,
15669                 }
15670         }
15671 }
15672 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15673         fn clone(&self) -> Self {
15674                 if self.result_ok {
15675                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15676                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15677                         } }
15678                 } else {
15679                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15680                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15681                         } }
15682                 }
15683         }
15684 }
15685 #[no_mangle]
15686 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15687 /// but with all dynamically-allocated buffers duplicated in new buffers.
15688 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15689 #[repr(C)]
15690 /// The contents of CResult_UpdateFeeDecodeErrorZ
15691 pub union CResult_UpdateFeeDecodeErrorZPtr {
15692         /// A pointer to the contents in the success state.
15693         /// Reading from this pointer when `result_ok` is not set is undefined.
15694         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15695         /// A pointer to the contents in the error state.
15696         /// Reading from this pointer when `result_ok` is set is undefined.
15697         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15698 }
15699 #[repr(C)]
15700 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15701 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15703 pub struct CResult_UpdateFeeDecodeErrorZ {
15704         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15705         /// `err` or `result` depending on the state of `result_ok`.
15706         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15707         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15708         pub result_ok: bool,
15709 }
15710 #[no_mangle]
15711 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15712 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
15713         CResult_UpdateFeeDecodeErrorZ {
15714                 contents: CResult_UpdateFeeDecodeErrorZPtr {
15715                         result: Box::into_raw(Box::new(o)),
15716                 },
15717                 result_ok: true,
15718         }
15719 }
15720 #[no_mangle]
15721 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15722 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
15723         CResult_UpdateFeeDecodeErrorZ {
15724                 contents: CResult_UpdateFeeDecodeErrorZPtr {
15725                         err: Box::into_raw(Box::new(e)),
15726                 },
15727                 result_ok: false,
15728         }
15729 }
15730 /// Checks if the given object is currently in the success state
15731 #[no_mangle]
15732 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
15733         o.result_ok
15734 }
15735 #[no_mangle]
15736 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15737 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
15738 impl Drop for CResult_UpdateFeeDecodeErrorZ {
15739         fn drop(&mut self) {
15740                 if self.result_ok {
15741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15743                         }
15744                 } else {
15745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15747                         }
15748                 }
15749         }
15750 }
15751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
15752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
15753                 let contents = if o.result_ok {
15754                         let result = unsafe { o.contents.result };
15755                         unsafe { o.contents.result = core::ptr::null_mut() };
15756                         CResult_UpdateFeeDecodeErrorZPtr { result }
15757                 } else {
15758                         let err = unsafe { o.contents.err };
15759                         unsafe { o.contents.err = core::ptr::null_mut(); }
15760                         CResult_UpdateFeeDecodeErrorZPtr { err }
15761                 };
15762                 Self {
15763                         contents,
15764                         result_ok: o.result_ok,
15765                 }
15766         }
15767 }
15768 impl Clone for CResult_UpdateFeeDecodeErrorZ {
15769         fn clone(&self) -> Self {
15770                 if self.result_ok {
15771                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
15772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
15773                         } }
15774                 } else {
15775                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
15776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15777                         } }
15778                 }
15779         }
15780 }
15781 #[no_mangle]
15782 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15783 /// but with all dynamically-allocated buffers duplicated in new buffers.
15784 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
15785 #[repr(C)]
15786 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
15787 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15788         /// A pointer to the contents in the success state.
15789         /// Reading from this pointer when `result_ok` is not set is undefined.
15790         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15791         /// A pointer to the contents in the error state.
15792         /// Reading from this pointer when `result_ok` is set is undefined.
15793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15794 }
15795 #[repr(C)]
15796 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
15797 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15799 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
15800         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
15801         /// `err` or `result` depending on the state of `result_ok`.
15802         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
15803         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
15804         pub result_ok: bool,
15805 }
15806 #[no_mangle]
15807 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15808 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15809         CResult_UpdateFulfillHTLCDecodeErrorZ {
15810                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15811                         result: Box::into_raw(Box::new(o)),
15812                 },
15813                 result_ok: true,
15814         }
15815 }
15816 #[no_mangle]
15817 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15818 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15819         CResult_UpdateFulfillHTLCDecodeErrorZ {
15820                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15821                         err: Box::into_raw(Box::new(e)),
15822                 },
15823                 result_ok: false,
15824         }
15825 }
15826 /// Checks if the given object is currently in the success state
15827 #[no_mangle]
15828 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
15829         o.result_ok
15830 }
15831 #[no_mangle]
15832 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15833 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
15834 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
15835         fn drop(&mut self) {
15836                 if self.result_ok {
15837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15839                         }
15840                 } else {
15841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15843                         }
15844                 }
15845         }
15846 }
15847 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
15848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15849                 let contents = if o.result_ok {
15850                         let result = unsafe { o.contents.result };
15851                         unsafe { o.contents.result = core::ptr::null_mut() };
15852                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
15853                 } else {
15854                         let err = unsafe { o.contents.err };
15855                         unsafe { o.contents.err = core::ptr::null_mut(); }
15856                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
15857                 };
15858                 Self {
15859                         contents,
15860                         result_ok: o.result_ok,
15861                 }
15862         }
15863 }
15864 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
15865         fn clone(&self) -> Self {
15866                 if self.result_ok {
15867                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15868                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
15869                         } }
15870                 } else {
15871                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15872                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15873                         } }
15874                 }
15875         }
15876 }
15877 #[no_mangle]
15878 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15879 /// but with all dynamically-allocated buffers duplicated in new buffers.
15880 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15881 #[repr(C)]
15882 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15883 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15884         /// A pointer to the contents in the success state.
15885         /// Reading from this pointer when `result_ok` is not set is undefined.
15886         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15887         /// A pointer to the contents in the error state.
15888         /// Reading from this pointer when `result_ok` is set is undefined.
15889         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15890 }
15891 #[repr(C)]
15892 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15893 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15895 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15896         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15897         /// `err` or `result` depending on the state of `result_ok`.
15898         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15899         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15900         pub result_ok: bool,
15901 }
15902 #[no_mangle]
15903 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15904 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15905         CResult_UpdateAddHTLCDecodeErrorZ {
15906                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15907                         result: Box::into_raw(Box::new(o)),
15908                 },
15909                 result_ok: true,
15910         }
15911 }
15912 #[no_mangle]
15913 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15914 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15915         CResult_UpdateAddHTLCDecodeErrorZ {
15916                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15917                         err: Box::into_raw(Box::new(e)),
15918                 },
15919                 result_ok: false,
15920         }
15921 }
15922 /// Checks if the given object is currently in the success state
15923 #[no_mangle]
15924 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15925         o.result_ok
15926 }
15927 #[no_mangle]
15928 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15929 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15930 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15931         fn drop(&mut self) {
15932                 if self.result_ok {
15933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15935                         }
15936                 } else {
15937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15939                         }
15940                 }
15941         }
15942 }
15943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15945                 let contents = if o.result_ok {
15946                         let result = unsafe { o.contents.result };
15947                         unsafe { o.contents.result = core::ptr::null_mut() };
15948                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15949                 } else {
15950                         let err = unsafe { o.contents.err };
15951                         unsafe { o.contents.err = core::ptr::null_mut(); }
15952                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15953                 };
15954                 Self {
15955                         contents,
15956                         result_ok: o.result_ok,
15957                 }
15958         }
15959 }
15960 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15961         fn clone(&self) -> Self {
15962                 if self.result_ok {
15963                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15964                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15965                         } }
15966                 } else {
15967                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15969                         } }
15970                 }
15971         }
15972 }
15973 #[no_mangle]
15974 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15975 /// but with all dynamically-allocated buffers duplicated in new buffers.
15976 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15977 #[repr(C)]
15978 /// The contents of CResult_OnionMessageDecodeErrorZ
15979 pub union CResult_OnionMessageDecodeErrorZPtr {
15980         /// A pointer to the contents in the success state.
15981         /// Reading from this pointer when `result_ok` is not set is undefined.
15982         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15983         /// A pointer to the contents in the error state.
15984         /// Reading from this pointer when `result_ok` is set is undefined.
15985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15986 }
15987 #[repr(C)]
15988 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15989 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15991 pub struct CResult_OnionMessageDecodeErrorZ {
15992         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15993         /// `err` or `result` depending on the state of `result_ok`.
15994         pub contents: CResult_OnionMessageDecodeErrorZPtr,
15995         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15996         pub result_ok: bool,
15997 }
15998 #[no_mangle]
15999 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16000 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16001         CResult_OnionMessageDecodeErrorZ {
16002                 contents: CResult_OnionMessageDecodeErrorZPtr {
16003                         result: Box::into_raw(Box::new(o)),
16004                 },
16005                 result_ok: true,
16006         }
16007 }
16008 #[no_mangle]
16009 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16010 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16011         CResult_OnionMessageDecodeErrorZ {
16012                 contents: CResult_OnionMessageDecodeErrorZPtr {
16013                         err: Box::into_raw(Box::new(e)),
16014                 },
16015                 result_ok: false,
16016         }
16017 }
16018 /// Checks if the given object is currently in the success state
16019 #[no_mangle]
16020 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16021         o.result_ok
16022 }
16023 #[no_mangle]
16024 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16025 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16026 impl Drop for CResult_OnionMessageDecodeErrorZ {
16027         fn drop(&mut self) {
16028                 if self.result_ok {
16029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16031                         }
16032                 } else {
16033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16035                         }
16036                 }
16037         }
16038 }
16039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16041                 let contents = if o.result_ok {
16042                         let result = unsafe { o.contents.result };
16043                         unsafe { o.contents.result = core::ptr::null_mut() };
16044                         CResult_OnionMessageDecodeErrorZPtr { result }
16045                 } else {
16046                         let err = unsafe { o.contents.err };
16047                         unsafe { o.contents.err = core::ptr::null_mut(); }
16048                         CResult_OnionMessageDecodeErrorZPtr { err }
16049                 };
16050                 Self {
16051                         contents,
16052                         result_ok: o.result_ok,
16053                 }
16054         }
16055 }
16056 impl Clone for CResult_OnionMessageDecodeErrorZ {
16057         fn clone(&self) -> Self {
16058                 if self.result_ok {
16059                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16060                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16061                         } }
16062                 } else {
16063                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16064                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16065                         } }
16066                 }
16067         }
16068 }
16069 #[no_mangle]
16070 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16071 /// but with all dynamically-allocated buffers duplicated in new buffers.
16072 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16073 #[repr(C)]
16074 /// The contents of CResult_PingDecodeErrorZ
16075 pub union CResult_PingDecodeErrorZPtr {
16076         /// A pointer to the contents in the success state.
16077         /// Reading from this pointer when `result_ok` is not set is undefined.
16078         pub result: *mut crate::lightning::ln::msgs::Ping,
16079         /// A pointer to the contents in the error state.
16080         /// Reading from this pointer when `result_ok` is set is undefined.
16081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16082 }
16083 #[repr(C)]
16084 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16085 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16087 pub struct CResult_PingDecodeErrorZ {
16088         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16089         /// `err` or `result` depending on the state of `result_ok`.
16090         pub contents: CResult_PingDecodeErrorZPtr,
16091         /// Whether this CResult_PingDecodeErrorZ represents a success state.
16092         pub result_ok: bool,
16093 }
16094 #[no_mangle]
16095 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16096 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16097         CResult_PingDecodeErrorZ {
16098                 contents: CResult_PingDecodeErrorZPtr {
16099                         result: Box::into_raw(Box::new(o)),
16100                 },
16101                 result_ok: true,
16102         }
16103 }
16104 #[no_mangle]
16105 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16106 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16107         CResult_PingDecodeErrorZ {
16108                 contents: CResult_PingDecodeErrorZPtr {
16109                         err: Box::into_raw(Box::new(e)),
16110                 },
16111                 result_ok: false,
16112         }
16113 }
16114 /// Checks if the given object is currently in the success state
16115 #[no_mangle]
16116 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16117         o.result_ok
16118 }
16119 #[no_mangle]
16120 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16121 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16122 impl Drop for CResult_PingDecodeErrorZ {
16123         fn drop(&mut self) {
16124                 if self.result_ok {
16125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16127                         }
16128                 } else {
16129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16131                         }
16132                 }
16133         }
16134 }
16135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16137                 let contents = if o.result_ok {
16138                         let result = unsafe { o.contents.result };
16139                         unsafe { o.contents.result = core::ptr::null_mut() };
16140                         CResult_PingDecodeErrorZPtr { result }
16141                 } else {
16142                         let err = unsafe { o.contents.err };
16143                         unsafe { o.contents.err = core::ptr::null_mut(); }
16144                         CResult_PingDecodeErrorZPtr { err }
16145                 };
16146                 Self {
16147                         contents,
16148                         result_ok: o.result_ok,
16149                 }
16150         }
16151 }
16152 impl Clone for CResult_PingDecodeErrorZ {
16153         fn clone(&self) -> Self {
16154                 if self.result_ok {
16155                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16156                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16157                         } }
16158                 } else {
16159                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16160                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16161                         } }
16162                 }
16163         }
16164 }
16165 #[no_mangle]
16166 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16167 /// but with all dynamically-allocated buffers duplicated in new buffers.
16168 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16169 #[repr(C)]
16170 /// The contents of CResult_PongDecodeErrorZ
16171 pub union CResult_PongDecodeErrorZPtr {
16172         /// A pointer to the contents in the success state.
16173         /// Reading from this pointer when `result_ok` is not set is undefined.
16174         pub result: *mut crate::lightning::ln::msgs::Pong,
16175         /// A pointer to the contents in the error state.
16176         /// Reading from this pointer when `result_ok` is set is undefined.
16177         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16178 }
16179 #[repr(C)]
16180 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16181 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16183 pub struct CResult_PongDecodeErrorZ {
16184         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16185         /// `err` or `result` depending on the state of `result_ok`.
16186         pub contents: CResult_PongDecodeErrorZPtr,
16187         /// Whether this CResult_PongDecodeErrorZ represents a success state.
16188         pub result_ok: bool,
16189 }
16190 #[no_mangle]
16191 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16192 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16193         CResult_PongDecodeErrorZ {
16194                 contents: CResult_PongDecodeErrorZPtr {
16195                         result: Box::into_raw(Box::new(o)),
16196                 },
16197                 result_ok: true,
16198         }
16199 }
16200 #[no_mangle]
16201 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16202 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16203         CResult_PongDecodeErrorZ {
16204                 contents: CResult_PongDecodeErrorZPtr {
16205                         err: Box::into_raw(Box::new(e)),
16206                 },
16207                 result_ok: false,
16208         }
16209 }
16210 /// Checks if the given object is currently in the success state
16211 #[no_mangle]
16212 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16213         o.result_ok
16214 }
16215 #[no_mangle]
16216 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16217 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16218 impl Drop for CResult_PongDecodeErrorZ {
16219         fn drop(&mut self) {
16220                 if self.result_ok {
16221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16223                         }
16224                 } else {
16225                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16226                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16227                         }
16228                 }
16229         }
16230 }
16231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16232         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16233                 let contents = if o.result_ok {
16234                         let result = unsafe { o.contents.result };
16235                         unsafe { o.contents.result = core::ptr::null_mut() };
16236                         CResult_PongDecodeErrorZPtr { result }
16237                 } else {
16238                         let err = unsafe { o.contents.err };
16239                         unsafe { o.contents.err = core::ptr::null_mut(); }
16240                         CResult_PongDecodeErrorZPtr { err }
16241                 };
16242                 Self {
16243                         contents,
16244                         result_ok: o.result_ok,
16245                 }
16246         }
16247 }
16248 impl Clone for CResult_PongDecodeErrorZ {
16249         fn clone(&self) -> Self {
16250                 if self.result_ok {
16251                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16252                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16253                         } }
16254                 } else {
16255                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16256                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16257                         } }
16258                 }
16259         }
16260 }
16261 #[no_mangle]
16262 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16263 /// but with all dynamically-allocated buffers duplicated in new buffers.
16264 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16265 #[repr(C)]
16266 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16267 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16268         /// A pointer to the contents in the success state.
16269         /// Reading from this pointer when `result_ok` is not set is undefined.
16270         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16271         /// A pointer to the contents in the error state.
16272         /// Reading from this pointer when `result_ok` is set is undefined.
16273         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16274 }
16275 #[repr(C)]
16276 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16277 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16279 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16280         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16281         /// `err` or `result` depending on the state of `result_ok`.
16282         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16283         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16284         pub result_ok: bool,
16285 }
16286 #[no_mangle]
16287 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16288 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16289         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16290                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16291                         result: Box::into_raw(Box::new(o)),
16292                 },
16293                 result_ok: true,
16294         }
16295 }
16296 #[no_mangle]
16297 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16298 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16299         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16300                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16301                         err: Box::into_raw(Box::new(e)),
16302                 },
16303                 result_ok: false,
16304         }
16305 }
16306 /// Checks if the given object is currently in the success state
16307 #[no_mangle]
16308 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16309         o.result_ok
16310 }
16311 #[no_mangle]
16312 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16313 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16314 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16315         fn drop(&mut self) {
16316                 if self.result_ok {
16317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16319                         }
16320                 } else {
16321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16323                         }
16324                 }
16325         }
16326 }
16327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16328         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16329                 let contents = if o.result_ok {
16330                         let result = unsafe { o.contents.result };
16331                         unsafe { o.contents.result = core::ptr::null_mut() };
16332                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16333                 } else {
16334                         let err = unsafe { o.contents.err };
16335                         unsafe { o.contents.err = core::ptr::null_mut(); }
16336                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16337                 };
16338                 Self {
16339                         contents,
16340                         result_ok: o.result_ok,
16341                 }
16342         }
16343 }
16344 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16345         fn clone(&self) -> Self {
16346                 if self.result_ok {
16347                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16348                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16349                         } }
16350                 } else {
16351                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16352                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16353                         } }
16354                 }
16355         }
16356 }
16357 #[no_mangle]
16358 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16359 /// but with all dynamically-allocated buffers duplicated in new buffers.
16360 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16361 #[repr(C)]
16362 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16363 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16364         /// A pointer to the contents in the success state.
16365         /// Reading from this pointer when `result_ok` is not set is undefined.
16366         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16367         /// A pointer to the contents in the error state.
16368         /// Reading from this pointer when `result_ok` is set is undefined.
16369         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16370 }
16371 #[repr(C)]
16372 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16373 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16375 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16376         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16377         /// `err` or `result` depending on the state of `result_ok`.
16378         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16379         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16380         pub result_ok: bool,
16381 }
16382 #[no_mangle]
16383 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16384 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16385         CResult_ChannelAnnouncementDecodeErrorZ {
16386                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16387                         result: Box::into_raw(Box::new(o)),
16388                 },
16389                 result_ok: true,
16390         }
16391 }
16392 #[no_mangle]
16393 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16394 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16395         CResult_ChannelAnnouncementDecodeErrorZ {
16396                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16397                         err: Box::into_raw(Box::new(e)),
16398                 },
16399                 result_ok: false,
16400         }
16401 }
16402 /// Checks if the given object is currently in the success state
16403 #[no_mangle]
16404 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16405         o.result_ok
16406 }
16407 #[no_mangle]
16408 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16409 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16410 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16411         fn drop(&mut self) {
16412                 if self.result_ok {
16413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16415                         }
16416                 } else {
16417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16419                         }
16420                 }
16421         }
16422 }
16423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16425                 let contents = if o.result_ok {
16426                         let result = unsafe { o.contents.result };
16427                         unsafe { o.contents.result = core::ptr::null_mut() };
16428                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16429                 } else {
16430                         let err = unsafe { o.contents.err };
16431                         unsafe { o.contents.err = core::ptr::null_mut(); }
16432                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16433                 };
16434                 Self {
16435                         contents,
16436                         result_ok: o.result_ok,
16437                 }
16438         }
16439 }
16440 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16441         fn clone(&self) -> Self {
16442                 if self.result_ok {
16443                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16444                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16445                         } }
16446                 } else {
16447                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16448                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16449                         } }
16450                 }
16451         }
16452 }
16453 #[no_mangle]
16454 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16455 /// but with all dynamically-allocated buffers duplicated in new buffers.
16456 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16457 #[repr(C)]
16458 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16459 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16460         /// A pointer to the contents in the success state.
16461         /// Reading from this pointer when `result_ok` is not set is undefined.
16462         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16463         /// A pointer to the contents in the error state.
16464         /// Reading from this pointer when `result_ok` is set is undefined.
16465         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16466 }
16467 #[repr(C)]
16468 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16469 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16471 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16472         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16473         /// `err` or `result` depending on the state of `result_ok`.
16474         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16475         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16476         pub result_ok: bool,
16477 }
16478 #[no_mangle]
16479 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16480 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16481         CResult_UnsignedChannelUpdateDecodeErrorZ {
16482                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16483                         result: Box::into_raw(Box::new(o)),
16484                 },
16485                 result_ok: true,
16486         }
16487 }
16488 #[no_mangle]
16489 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16490 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16491         CResult_UnsignedChannelUpdateDecodeErrorZ {
16492                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16493                         err: Box::into_raw(Box::new(e)),
16494                 },
16495                 result_ok: false,
16496         }
16497 }
16498 /// Checks if the given object is currently in the success state
16499 #[no_mangle]
16500 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16501         o.result_ok
16502 }
16503 #[no_mangle]
16504 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16505 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16506 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16507         fn drop(&mut self) {
16508                 if self.result_ok {
16509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16511                         }
16512                 } else {
16513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16515                         }
16516                 }
16517         }
16518 }
16519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16521                 let contents = if o.result_ok {
16522                         let result = unsafe { o.contents.result };
16523                         unsafe { o.contents.result = core::ptr::null_mut() };
16524                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16525                 } else {
16526                         let err = unsafe { o.contents.err };
16527                         unsafe { o.contents.err = core::ptr::null_mut(); }
16528                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16529                 };
16530                 Self {
16531                         contents,
16532                         result_ok: o.result_ok,
16533                 }
16534         }
16535 }
16536 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16537         fn clone(&self) -> Self {
16538                 if self.result_ok {
16539                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16540                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16541                         } }
16542                 } else {
16543                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16544                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16545                         } }
16546                 }
16547         }
16548 }
16549 #[no_mangle]
16550 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16551 /// but with all dynamically-allocated buffers duplicated in new buffers.
16552 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16553 #[repr(C)]
16554 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16555 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16556         /// A pointer to the contents in the success state.
16557         /// Reading from this pointer when `result_ok` is not set is undefined.
16558         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16559         /// A pointer to the contents in the error state.
16560         /// Reading from this pointer when `result_ok` is set is undefined.
16561         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16562 }
16563 #[repr(C)]
16564 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16565 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16567 pub struct CResult_ChannelUpdateDecodeErrorZ {
16568         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16569         /// `err` or `result` depending on the state of `result_ok`.
16570         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16571         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16572         pub result_ok: bool,
16573 }
16574 #[no_mangle]
16575 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16576 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16577         CResult_ChannelUpdateDecodeErrorZ {
16578                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16579                         result: Box::into_raw(Box::new(o)),
16580                 },
16581                 result_ok: true,
16582         }
16583 }
16584 #[no_mangle]
16585 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16586 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16587         CResult_ChannelUpdateDecodeErrorZ {
16588                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16589                         err: Box::into_raw(Box::new(e)),
16590                 },
16591                 result_ok: false,
16592         }
16593 }
16594 /// Checks if the given object is currently in the success state
16595 #[no_mangle]
16596 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16597         o.result_ok
16598 }
16599 #[no_mangle]
16600 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16601 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16602 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16603         fn drop(&mut self) {
16604                 if self.result_ok {
16605                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16606                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16607                         }
16608                 } else {
16609                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16610                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16611                         }
16612                 }
16613         }
16614 }
16615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16616         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16617                 let contents = if o.result_ok {
16618                         let result = unsafe { o.contents.result };
16619                         unsafe { o.contents.result = core::ptr::null_mut() };
16620                         CResult_ChannelUpdateDecodeErrorZPtr { result }
16621                 } else {
16622                         let err = unsafe { o.contents.err };
16623                         unsafe { o.contents.err = core::ptr::null_mut(); }
16624                         CResult_ChannelUpdateDecodeErrorZPtr { err }
16625                 };
16626                 Self {
16627                         contents,
16628                         result_ok: o.result_ok,
16629                 }
16630         }
16631 }
16632 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16633         fn clone(&self) -> Self {
16634                 if self.result_ok {
16635                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16636                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16637                         } }
16638                 } else {
16639                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16640                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16641                         } }
16642                 }
16643         }
16644 }
16645 #[no_mangle]
16646 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16647 /// but with all dynamically-allocated buffers duplicated in new buffers.
16648 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16649 #[repr(C)]
16650 /// The contents of CResult_ErrorMessageDecodeErrorZ
16651 pub union CResult_ErrorMessageDecodeErrorZPtr {
16652         /// A pointer to the contents in the success state.
16653         /// Reading from this pointer when `result_ok` is not set is undefined.
16654         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16655         /// A pointer to the contents in the error state.
16656         /// Reading from this pointer when `result_ok` is set is undefined.
16657         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16658 }
16659 #[repr(C)]
16660 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16661 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16663 pub struct CResult_ErrorMessageDecodeErrorZ {
16664         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16665         /// `err` or `result` depending on the state of `result_ok`.
16666         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16667         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16668         pub result_ok: bool,
16669 }
16670 #[no_mangle]
16671 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16672 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16673         CResult_ErrorMessageDecodeErrorZ {
16674                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16675                         result: Box::into_raw(Box::new(o)),
16676                 },
16677                 result_ok: true,
16678         }
16679 }
16680 #[no_mangle]
16681 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16682 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16683         CResult_ErrorMessageDecodeErrorZ {
16684                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16685                         err: Box::into_raw(Box::new(e)),
16686                 },
16687                 result_ok: false,
16688         }
16689 }
16690 /// Checks if the given object is currently in the success state
16691 #[no_mangle]
16692 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16693         o.result_ok
16694 }
16695 #[no_mangle]
16696 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16697 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16698 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16699         fn drop(&mut self) {
16700                 if self.result_ok {
16701                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16702                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16703                         }
16704                 } else {
16705                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16706                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16707                         }
16708                 }
16709         }
16710 }
16711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
16712         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16713                 let contents = if o.result_ok {
16714                         let result = unsafe { o.contents.result };
16715                         unsafe { o.contents.result = core::ptr::null_mut() };
16716                         CResult_ErrorMessageDecodeErrorZPtr { result }
16717                 } else {
16718                         let err = unsafe { o.contents.err };
16719                         unsafe { o.contents.err = core::ptr::null_mut(); }
16720                         CResult_ErrorMessageDecodeErrorZPtr { err }
16721                 };
16722                 Self {
16723                         contents,
16724                         result_ok: o.result_ok,
16725                 }
16726         }
16727 }
16728 impl Clone for CResult_ErrorMessageDecodeErrorZ {
16729         fn clone(&self) -> Self {
16730                 if self.result_ok {
16731                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
16732                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
16733                         } }
16734                 } else {
16735                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
16736                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16737                         } }
16738                 }
16739         }
16740 }
16741 #[no_mangle]
16742 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16743 /// but with all dynamically-allocated buffers duplicated in new buffers.
16744 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
16745 #[repr(C)]
16746 /// The contents of CResult_WarningMessageDecodeErrorZ
16747 pub union CResult_WarningMessageDecodeErrorZPtr {
16748         /// A pointer to the contents in the success state.
16749         /// Reading from this pointer when `result_ok` is not set is undefined.
16750         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
16751         /// A pointer to the contents in the error state.
16752         /// Reading from this pointer when `result_ok` is set is undefined.
16753         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16754 }
16755 #[repr(C)]
16756 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
16757 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16759 pub struct CResult_WarningMessageDecodeErrorZ {
16760         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
16761         /// `err` or `result` depending on the state of `result_ok`.
16762         pub contents: CResult_WarningMessageDecodeErrorZPtr,
16763         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
16764         pub result_ok: bool,
16765 }
16766 #[no_mangle]
16767 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16768 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
16769         CResult_WarningMessageDecodeErrorZ {
16770                 contents: CResult_WarningMessageDecodeErrorZPtr {
16771                         result: Box::into_raw(Box::new(o)),
16772                 },
16773                 result_ok: true,
16774         }
16775 }
16776 #[no_mangle]
16777 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16778 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
16779         CResult_WarningMessageDecodeErrorZ {
16780                 contents: CResult_WarningMessageDecodeErrorZPtr {
16781                         err: Box::into_raw(Box::new(e)),
16782                 },
16783                 result_ok: false,
16784         }
16785 }
16786 /// Checks if the given object is currently in the success state
16787 #[no_mangle]
16788 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
16789         o.result_ok
16790 }
16791 #[no_mangle]
16792 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16793 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
16794 impl Drop for CResult_WarningMessageDecodeErrorZ {
16795         fn drop(&mut self) {
16796                 if self.result_ok {
16797                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16798                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16799                         }
16800                 } else {
16801                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16802                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16803                         }
16804                 }
16805         }
16806 }
16807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
16808         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16809                 let contents = if o.result_ok {
16810                         let result = unsafe { o.contents.result };
16811                         unsafe { o.contents.result = core::ptr::null_mut() };
16812                         CResult_WarningMessageDecodeErrorZPtr { result }
16813                 } else {
16814                         let err = unsafe { o.contents.err };
16815                         unsafe { o.contents.err = core::ptr::null_mut(); }
16816                         CResult_WarningMessageDecodeErrorZPtr { err }
16817                 };
16818                 Self {
16819                         contents,
16820                         result_ok: o.result_ok,
16821                 }
16822         }
16823 }
16824 impl Clone for CResult_WarningMessageDecodeErrorZ {
16825         fn clone(&self) -> Self {
16826                 if self.result_ok {
16827                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
16828                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
16829                         } }
16830                 } else {
16831                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
16832                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16833                         } }
16834                 }
16835         }
16836 }
16837 #[no_mangle]
16838 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16839 /// but with all dynamically-allocated buffers duplicated in new buffers.
16840 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
16841 #[repr(C)]
16842 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
16843 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16844         /// A pointer to the contents in the success state.
16845         /// Reading from this pointer when `result_ok` is not set is undefined.
16846         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
16847         /// A pointer to the contents in the error state.
16848         /// Reading from this pointer when `result_ok` is set is undefined.
16849         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16850 }
16851 #[repr(C)]
16852 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16853 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16855 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16856         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
16857         /// `err` or `result` depending on the state of `result_ok`.
16858         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
16859         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
16860         pub result_ok: bool,
16861 }
16862 #[no_mangle]
16863 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16864 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16865         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16866                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16867                         result: Box::into_raw(Box::new(o)),
16868                 },
16869                 result_ok: true,
16870         }
16871 }
16872 #[no_mangle]
16873 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16874 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16875         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16876                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16877                         err: Box::into_raw(Box::new(e)),
16878                 },
16879                 result_ok: false,
16880         }
16881 }
16882 /// Checks if the given object is currently in the success state
16883 #[no_mangle]
16884 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16885         o.result_ok
16886 }
16887 #[no_mangle]
16888 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16889 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16890 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16891         fn drop(&mut self) {
16892                 if self.result_ok {
16893                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16894                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16895                         }
16896                 } else {
16897                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16898                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16899                         }
16900                 }
16901         }
16902 }
16903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16904         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16905                 let contents = if o.result_ok {
16906                         let result = unsafe { o.contents.result };
16907                         unsafe { o.contents.result = core::ptr::null_mut() };
16908                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16909                 } else {
16910                         let err = unsafe { o.contents.err };
16911                         unsafe { o.contents.err = core::ptr::null_mut(); }
16912                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16913                 };
16914                 Self {
16915                         contents,
16916                         result_ok: o.result_ok,
16917                 }
16918         }
16919 }
16920 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16921         fn clone(&self) -> Self {
16922                 if self.result_ok {
16923                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16924                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16925                         } }
16926                 } else {
16927                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16928                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16929                         } }
16930                 }
16931         }
16932 }
16933 #[no_mangle]
16934 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16935 /// but with all dynamically-allocated buffers duplicated in new buffers.
16936 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16937 #[repr(C)]
16938 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16939 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16940         /// A pointer to the contents in the success state.
16941         /// Reading from this pointer when `result_ok` is not set is undefined.
16942         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16943         /// A pointer to the contents in the error state.
16944         /// Reading from this pointer when `result_ok` is set is undefined.
16945         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16946 }
16947 #[repr(C)]
16948 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16949 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16951 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16952         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16953         /// `err` or `result` depending on the state of `result_ok`.
16954         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16955         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16956         pub result_ok: bool,
16957 }
16958 #[no_mangle]
16959 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16960 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16961         CResult_NodeAnnouncementDecodeErrorZ {
16962                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16963                         result: Box::into_raw(Box::new(o)),
16964                 },
16965                 result_ok: true,
16966         }
16967 }
16968 #[no_mangle]
16969 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16970 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16971         CResult_NodeAnnouncementDecodeErrorZ {
16972                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16973                         err: Box::into_raw(Box::new(e)),
16974                 },
16975                 result_ok: false,
16976         }
16977 }
16978 /// Checks if the given object is currently in the success state
16979 #[no_mangle]
16980 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16981         o.result_ok
16982 }
16983 #[no_mangle]
16984 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16985 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16986 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16987         fn drop(&mut self) {
16988                 if self.result_ok {
16989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16991                         }
16992                 } else {
16993                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16994                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16995                         }
16996                 }
16997         }
16998 }
16999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17000         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17001                 let contents = if o.result_ok {
17002                         let result = unsafe { o.contents.result };
17003                         unsafe { o.contents.result = core::ptr::null_mut() };
17004                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
17005                 } else {
17006                         let err = unsafe { o.contents.err };
17007                         unsafe { o.contents.err = core::ptr::null_mut(); }
17008                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
17009                 };
17010                 Self {
17011                         contents,
17012                         result_ok: o.result_ok,
17013                 }
17014         }
17015 }
17016 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17017         fn clone(&self) -> Self {
17018                 if self.result_ok {
17019                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17020                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17021                         } }
17022                 } else {
17023                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17024                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17025                         } }
17026                 }
17027         }
17028 }
17029 #[no_mangle]
17030 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17031 /// but with all dynamically-allocated buffers duplicated in new buffers.
17032 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17033 #[repr(C)]
17034 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17035 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17036         /// A pointer to the contents in the success state.
17037         /// Reading from this pointer when `result_ok` is not set is undefined.
17038         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17039         /// A pointer to the contents in the error state.
17040         /// Reading from this pointer when `result_ok` is set is undefined.
17041         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17042 }
17043 #[repr(C)]
17044 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17045 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17047 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17048         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17049         /// `err` or `result` depending on the state of `result_ok`.
17050         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17051         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17052         pub result_ok: bool,
17053 }
17054 #[no_mangle]
17055 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17056 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17057         CResult_QueryShortChannelIdsDecodeErrorZ {
17058                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17059                         result: Box::into_raw(Box::new(o)),
17060                 },
17061                 result_ok: true,
17062         }
17063 }
17064 #[no_mangle]
17065 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17066 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17067         CResult_QueryShortChannelIdsDecodeErrorZ {
17068                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17069                         err: Box::into_raw(Box::new(e)),
17070                 },
17071                 result_ok: false,
17072         }
17073 }
17074 /// Checks if the given object is currently in the success state
17075 #[no_mangle]
17076 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17077         o.result_ok
17078 }
17079 #[no_mangle]
17080 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17081 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17082 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17083         fn drop(&mut self) {
17084                 if self.result_ok {
17085                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17086                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17087                         }
17088                 } else {
17089                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17090                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17091                         }
17092                 }
17093         }
17094 }
17095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17096         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17097                 let contents = if o.result_ok {
17098                         let result = unsafe { o.contents.result };
17099                         unsafe { o.contents.result = core::ptr::null_mut() };
17100                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17101                 } else {
17102                         let err = unsafe { o.contents.err };
17103                         unsafe { o.contents.err = core::ptr::null_mut(); }
17104                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17105                 };
17106                 Self {
17107                         contents,
17108                         result_ok: o.result_ok,
17109                 }
17110         }
17111 }
17112 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17113         fn clone(&self) -> Self {
17114                 if self.result_ok {
17115                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17116                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17117                         } }
17118                 } else {
17119                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17120                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17121                         } }
17122                 }
17123         }
17124 }
17125 #[no_mangle]
17126 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17127 /// but with all dynamically-allocated buffers duplicated in new buffers.
17128 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17129 #[repr(C)]
17130 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17131 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17132         /// A pointer to the contents in the success state.
17133         /// Reading from this pointer when `result_ok` is not set is undefined.
17134         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17135         /// A pointer to the contents in the error state.
17136         /// Reading from this pointer when `result_ok` is set is undefined.
17137         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17138 }
17139 #[repr(C)]
17140 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17141 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17143 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17144         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17145         /// `err` or `result` depending on the state of `result_ok`.
17146         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17147         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17148         pub result_ok: bool,
17149 }
17150 #[no_mangle]
17151 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17152 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17153         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17154                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17155                         result: Box::into_raw(Box::new(o)),
17156                 },
17157                 result_ok: true,
17158         }
17159 }
17160 #[no_mangle]
17161 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17162 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17163         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17164                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17165                         err: Box::into_raw(Box::new(e)),
17166                 },
17167                 result_ok: false,
17168         }
17169 }
17170 /// Checks if the given object is currently in the success state
17171 #[no_mangle]
17172 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17173         o.result_ok
17174 }
17175 #[no_mangle]
17176 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17177 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17178 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17179         fn drop(&mut self) {
17180                 if self.result_ok {
17181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17183                         }
17184                 } else {
17185                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17186                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17187                         }
17188                 }
17189         }
17190 }
17191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17193                 let contents = if o.result_ok {
17194                         let result = unsafe { o.contents.result };
17195                         unsafe { o.contents.result = core::ptr::null_mut() };
17196                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17197                 } else {
17198                         let err = unsafe { o.contents.err };
17199                         unsafe { o.contents.err = core::ptr::null_mut(); }
17200                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17201                 };
17202                 Self {
17203                         contents,
17204                         result_ok: o.result_ok,
17205                 }
17206         }
17207 }
17208 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17209         fn clone(&self) -> Self {
17210                 if self.result_ok {
17211                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17212                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17213                         } }
17214                 } else {
17215                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17216                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17217                         } }
17218                 }
17219         }
17220 }
17221 #[no_mangle]
17222 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17223 /// but with all dynamically-allocated buffers duplicated in new buffers.
17224 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17225 #[repr(C)]
17226 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17227 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17228         /// A pointer to the contents in the success state.
17229         /// Reading from this pointer when `result_ok` is not set is undefined.
17230         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17231         /// A pointer to the contents in the error state.
17232         /// Reading from this pointer when `result_ok` is set is undefined.
17233         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17234 }
17235 #[repr(C)]
17236 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17237 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17239 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17240         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17241         /// `err` or `result` depending on the state of `result_ok`.
17242         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17243         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17244         pub result_ok: bool,
17245 }
17246 #[no_mangle]
17247 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17248 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17249         CResult_QueryChannelRangeDecodeErrorZ {
17250                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17251                         result: Box::into_raw(Box::new(o)),
17252                 },
17253                 result_ok: true,
17254         }
17255 }
17256 #[no_mangle]
17257 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17258 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17259         CResult_QueryChannelRangeDecodeErrorZ {
17260                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17261                         err: Box::into_raw(Box::new(e)),
17262                 },
17263                 result_ok: false,
17264         }
17265 }
17266 /// Checks if the given object is currently in the success state
17267 #[no_mangle]
17268 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17269         o.result_ok
17270 }
17271 #[no_mangle]
17272 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17273 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17274 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17275         fn drop(&mut self) {
17276                 if self.result_ok {
17277                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17278                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17279                         }
17280                 } else {
17281                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17282                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17283                         }
17284                 }
17285         }
17286 }
17287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17288         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17289                 let contents = if o.result_ok {
17290                         let result = unsafe { o.contents.result };
17291                         unsafe { o.contents.result = core::ptr::null_mut() };
17292                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
17293                 } else {
17294                         let err = unsafe { o.contents.err };
17295                         unsafe { o.contents.err = core::ptr::null_mut(); }
17296                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
17297                 };
17298                 Self {
17299                         contents,
17300                         result_ok: o.result_ok,
17301                 }
17302         }
17303 }
17304 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17305         fn clone(&self) -> Self {
17306                 if self.result_ok {
17307                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17308                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17309                         } }
17310                 } else {
17311                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17312                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17313                         } }
17314                 }
17315         }
17316 }
17317 #[no_mangle]
17318 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17319 /// but with all dynamically-allocated buffers duplicated in new buffers.
17320 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17321 #[repr(C)]
17322 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17323 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17324         /// A pointer to the contents in the success state.
17325         /// Reading from this pointer when `result_ok` is not set is undefined.
17326         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17327         /// A pointer to the contents in the error state.
17328         /// Reading from this pointer when `result_ok` is set is undefined.
17329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17330 }
17331 #[repr(C)]
17332 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17333 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17335 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17336         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17337         /// `err` or `result` depending on the state of `result_ok`.
17338         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17339         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17340         pub result_ok: bool,
17341 }
17342 #[no_mangle]
17343 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17344 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17345         CResult_ReplyChannelRangeDecodeErrorZ {
17346                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17347                         result: Box::into_raw(Box::new(o)),
17348                 },
17349                 result_ok: true,
17350         }
17351 }
17352 #[no_mangle]
17353 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17354 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17355         CResult_ReplyChannelRangeDecodeErrorZ {
17356                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17357                         err: Box::into_raw(Box::new(e)),
17358                 },
17359                 result_ok: false,
17360         }
17361 }
17362 /// Checks if the given object is currently in the success state
17363 #[no_mangle]
17364 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17365         o.result_ok
17366 }
17367 #[no_mangle]
17368 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17369 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17370 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17371         fn drop(&mut self) {
17372                 if self.result_ok {
17373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17375                         }
17376                 } else {
17377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17379                         }
17380                 }
17381         }
17382 }
17383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17385                 let contents = if o.result_ok {
17386                         let result = unsafe { o.contents.result };
17387                         unsafe { o.contents.result = core::ptr::null_mut() };
17388                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17389                 } else {
17390                         let err = unsafe { o.contents.err };
17391                         unsafe { o.contents.err = core::ptr::null_mut(); }
17392                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17393                 };
17394                 Self {
17395                         contents,
17396                         result_ok: o.result_ok,
17397                 }
17398         }
17399 }
17400 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17401         fn clone(&self) -> Self {
17402                 if self.result_ok {
17403                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17404                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17405                         } }
17406                 } else {
17407                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17409                         } }
17410                 }
17411         }
17412 }
17413 #[no_mangle]
17414 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17415 /// but with all dynamically-allocated buffers duplicated in new buffers.
17416 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17417 #[repr(C)]
17418 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17419 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17420         /// A pointer to the contents in the success state.
17421         /// Reading from this pointer when `result_ok` is not set is undefined.
17422         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17423         /// A pointer to the contents in the error state.
17424         /// Reading from this pointer when `result_ok` is set is undefined.
17425         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17426 }
17427 #[repr(C)]
17428 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17429 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17431 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17432         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17433         /// `err` or `result` depending on the state of `result_ok`.
17434         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17435         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17436         pub result_ok: bool,
17437 }
17438 #[no_mangle]
17439 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17440 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17441         CResult_GossipTimestampFilterDecodeErrorZ {
17442                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17443                         result: Box::into_raw(Box::new(o)),
17444                 },
17445                 result_ok: true,
17446         }
17447 }
17448 #[no_mangle]
17449 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17450 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17451         CResult_GossipTimestampFilterDecodeErrorZ {
17452                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17453                         err: Box::into_raw(Box::new(e)),
17454                 },
17455                 result_ok: false,
17456         }
17457 }
17458 /// Checks if the given object is currently in the success state
17459 #[no_mangle]
17460 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17461         o.result_ok
17462 }
17463 #[no_mangle]
17464 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17465 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17466 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17467         fn drop(&mut self) {
17468                 if self.result_ok {
17469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17471                         }
17472                 } else {
17473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17475                         }
17476                 }
17477         }
17478 }
17479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17481                 let contents = if o.result_ok {
17482                         let result = unsafe { o.contents.result };
17483                         unsafe { o.contents.result = core::ptr::null_mut() };
17484                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17485                 } else {
17486                         let err = unsafe { o.contents.err };
17487                         unsafe { o.contents.err = core::ptr::null_mut(); }
17488                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17489                 };
17490                 Self {
17491                         contents,
17492                         result_ok: o.result_ok,
17493                 }
17494         }
17495 }
17496 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17497         fn clone(&self) -> Self {
17498                 if self.result_ok {
17499                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17501                         } }
17502                 } else {
17503                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17505                         } }
17506                 }
17507         }
17508 }
17509 #[no_mangle]
17510 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17511 /// but with all dynamically-allocated buffers duplicated in new buffers.
17512 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17513 #[repr(C)]
17514 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17515 /// This corresponds to std::vector in C++
17516 pub struct CVec_PhantomRouteHintsZ {
17517         /// The elements in the array.
17518         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17519         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17520         /// The number of elements pointed to by `data`.
17521         pub datalen: usize
17522 }
17523 impl CVec_PhantomRouteHintsZ {
17524         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17525                 if self.datalen == 0 { return Vec::new(); }
17526                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17527                 self.data = core::ptr::null_mut();
17528                 self.datalen = 0;
17529                 ret
17530         }
17531         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17532                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17533         }
17534 }
17535 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17536         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17537                 let datalen = v.len();
17538                 let data = Box::into_raw(v.into_boxed_slice());
17539                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17540         }
17541 }
17542 #[no_mangle]
17543 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17544 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17545 impl Drop for CVec_PhantomRouteHintsZ {
17546         fn drop(&mut self) {
17547                 if self.datalen == 0 { return; }
17548                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17549         }
17550 }
17551 impl Clone for CVec_PhantomRouteHintsZ {
17552         fn clone(&self) -> Self {
17553                 let mut res = Vec::new();
17554                 if self.datalen == 0 { return Self::from(res); }
17555                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17556                 Self::from(res)
17557         }
17558 }
17559 #[repr(C)]
17560 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
17561 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17562         /// A pointer to the contents in the success state.
17563         /// Reading from this pointer when `result_ok` is not set is undefined.
17564         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
17565         /// A pointer to the contents in the error state.
17566         /// Reading from this pointer when `result_ok` is set is undefined.
17567         pub err: *mut crate::lightning_invoice::SignOrCreationError,
17568 }
17569 #[repr(C)]
17570 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17571 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17572 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17573 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
17574         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
17575         /// `err` or `result` depending on the state of `result_ok`.
17576         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
17577         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
17578         pub result_ok: bool,
17579 }
17580 #[no_mangle]
17581 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
17582 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17583         CResult_Bolt11InvoiceSignOrCreationErrorZ {
17584                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17585                         result: Box::into_raw(Box::new(o)),
17586                 },
17587                 result_ok: true,
17588         }
17589 }
17590 #[no_mangle]
17591 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
17592 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17593         CResult_Bolt11InvoiceSignOrCreationErrorZ {
17594                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17595                         err: Box::into_raw(Box::new(e)),
17596                 },
17597                 result_ok: false,
17598         }
17599 }
17600 /// Checks if the given object is currently in the success state
17601 #[no_mangle]
17602 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
17603         o.result_ok
17604 }
17605 #[no_mangle]
17606 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
17607 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
17608 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17609         fn drop(&mut self) {
17610                 if self.result_ok {
17611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17613                         }
17614                 } else {
17615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17617                         }
17618                 }
17619         }
17620 }
17621 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17622         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17623                 let contents = if o.result_ok {
17624                         let result = unsafe { o.contents.result };
17625                         unsafe { o.contents.result = core::ptr::null_mut() };
17626                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
17627                 } else {
17628                         let err = unsafe { o.contents.err };
17629                         unsafe { o.contents.err = core::ptr::null_mut(); }
17630                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
17631                 };
17632                 Self {
17633                         contents,
17634                         result_ok: o.result_ok,
17635                 }
17636         }
17637 }
17638 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17639         fn clone(&self) -> Self {
17640                 if self.result_ok {
17641                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17642                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
17643                         } }
17644                 } else {
17645                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17646                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17647                         } }
17648                 }
17649         }
17650 }
17651 #[no_mangle]
17652 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
17653 /// but with all dynamically-allocated buffers duplicated in new buffers.
17654 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17655 #[repr(C)]
17656 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17657 /// This corresponds to std::vector in C++
17658 pub struct CVec_FutureZ {
17659         /// The elements in the array.
17660         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17661         pub data: *mut crate::lightning::util::wakers::Future,
17662         /// The number of elements pointed to by `data`.
17663         pub datalen: usize
17664 }
17665 impl CVec_FutureZ {
17666         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17667                 if self.datalen == 0 { return Vec::new(); }
17668                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17669                 self.data = core::ptr::null_mut();
17670                 self.datalen = 0;
17671                 ret
17672         }
17673         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17674                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17675         }
17676 }
17677 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17678         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17679                 let datalen = v.len();
17680                 let data = Box::into_raw(v.into_boxed_slice());
17681                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17682         }
17683 }
17684 #[no_mangle]
17685 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17686 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17687 impl Drop for CVec_FutureZ {
17688         fn drop(&mut self) {
17689                 if self.datalen == 0 { return; }
17690                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17691         }
17692 }
17693 impl Clone for CVec_FutureZ {
17694         fn clone(&self) -> Self {
17695                 let mut res = Vec::new();
17696                 if self.datalen == 0 { return Self::from(res); }
17697                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17698                 Self::from(res)
17699         }
17700 }
17701 #[repr(C)]
17702 /// The contents of CResult_OffersMessageDecodeErrorZ
17703 pub union CResult_OffersMessageDecodeErrorZPtr {
17704         /// A pointer to the contents in the success state.
17705         /// Reading from this pointer when `result_ok` is not set is undefined.
17706         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
17707         /// A pointer to the contents in the error state.
17708         /// Reading from this pointer when `result_ok` is set is undefined.
17709         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17710 }
17711 #[repr(C)]
17712 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
17713 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17715 pub struct CResult_OffersMessageDecodeErrorZ {
17716         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
17717         /// `err` or `result` depending on the state of `result_ok`.
17718         pub contents: CResult_OffersMessageDecodeErrorZPtr,
17719         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
17720         pub result_ok: bool,
17721 }
17722 #[no_mangle]
17723 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
17724 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
17725         CResult_OffersMessageDecodeErrorZ {
17726                 contents: CResult_OffersMessageDecodeErrorZPtr {
17727                         result: Box::into_raw(Box::new(o)),
17728                 },
17729                 result_ok: true,
17730         }
17731 }
17732 #[no_mangle]
17733 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
17734 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
17735         CResult_OffersMessageDecodeErrorZ {
17736                 contents: CResult_OffersMessageDecodeErrorZPtr {
17737                         err: Box::into_raw(Box::new(e)),
17738                 },
17739                 result_ok: false,
17740         }
17741 }
17742 /// Checks if the given object is currently in the success state
17743 #[no_mangle]
17744 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
17745         o.result_ok
17746 }
17747 #[no_mangle]
17748 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
17749 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
17750 impl Drop for CResult_OffersMessageDecodeErrorZ {
17751         fn drop(&mut self) {
17752                 if self.result_ok {
17753                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17754                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17755                         }
17756                 } else {
17757                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17758                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17759                         }
17760                 }
17761         }
17762 }
17763 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
17764         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17765                 let contents = if o.result_ok {
17766                         let result = unsafe { o.contents.result };
17767                         unsafe { o.contents.result = core::ptr::null_mut() };
17768                         CResult_OffersMessageDecodeErrorZPtr { result }
17769                 } else {
17770                         let err = unsafe { o.contents.err };
17771                         unsafe { o.contents.err = core::ptr::null_mut(); }
17772                         CResult_OffersMessageDecodeErrorZPtr { err }
17773                 };
17774                 Self {
17775                         contents,
17776                         result_ok: o.result_ok,
17777                 }
17778         }
17779 }
17780 impl Clone for CResult_OffersMessageDecodeErrorZ {
17781         fn clone(&self) -> Self {
17782                 if self.result_ok {
17783                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
17784                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
17785                         } }
17786                 } else {
17787                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
17788                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17789                         } }
17790                 }
17791         }
17792 }
17793 #[no_mangle]
17794 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
17795 /// but with all dynamically-allocated buffers duplicated in new buffers.
17796 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
17797 #[repr(C)]
17798 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
17799 pub enum COption_HTLCClaimZ {
17800         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
17801         Some(crate::lightning::ln::chan_utils::HTLCClaim),
17802         /// When we're in this state, this COption_HTLCClaimZ contains nothing
17803         None
17804 }
17805 impl COption_HTLCClaimZ {
17806         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17807                 if let Self::None = self { false } else { true }
17808         }
17809         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
17810                 !self.is_some()
17811         }
17812         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
17813                 if let Self::Some(v) = self { v } else { unreachable!() }
17814         }
17815 }
17816 #[no_mangle]
17817 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
17818 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
17819         COption_HTLCClaimZ::Some(o)
17820 }
17821 #[no_mangle]
17822 /// Constructs a new COption_HTLCClaimZ containing nothing
17823 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
17824         COption_HTLCClaimZ::None
17825 }
17826 #[no_mangle]
17827 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
17828 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
17829 #[repr(C)]
17830 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
17831 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17832         /// A pointer to the contents in the success state.
17833         /// Reading from this pointer when `result_ok` is not set is undefined.
17834         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
17835         /// A pointer to the contents in the error state.
17836         /// Reading from this pointer when `result_ok` is set is undefined.
17837         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17838 }
17839 #[repr(C)]
17840 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
17841 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
17842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17843 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17844         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
17845         /// `err` or `result` depending on the state of `result_ok`.
17846         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
17847         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
17848         pub result_ok: bool,
17849 }
17850 #[no_mangle]
17851 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
17852 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17853         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17854                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17855                         result: Box::into_raw(Box::new(o)),
17856                 },
17857                 result_ok: true,
17858         }
17859 }
17860 #[no_mangle]
17861 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
17862 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17863         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17864                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17865                         err: Box::into_raw(Box::new(e)),
17866                 },
17867                 result_ok: false,
17868         }
17869 }
17870 /// Checks if the given object is currently in the success state
17871 #[no_mangle]
17872 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
17873         o.result_ok
17874 }
17875 #[no_mangle]
17876 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
17877 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
17878 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17879         fn drop(&mut self) {
17880                 if self.result_ok {
17881                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17882                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17883                         }
17884                 } else {
17885                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17886                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17887                         }
17888                 }
17889         }
17890 }
17891 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17892         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
17893                 let contents = if o.result_ok {
17894                         let result = unsafe { o.contents.result };
17895                         unsafe { o.contents.result = core::ptr::null_mut() };
17896                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
17897                 } else {
17898                         let err = unsafe { o.contents.err };
17899                         unsafe { o.contents.err = core::ptr::null_mut(); }
17900                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
17901                 };
17902                 Self {
17903                         contents,
17904                         result_ok: o.result_ok,
17905                 }
17906         }
17907 }
17908 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17909         fn clone(&self) -> Self {
17910                 if self.result_ok {
17911                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17912                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
17913                         } }
17914                 } else {
17915                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17916                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17917                         } }
17918                 }
17919         }
17920 }
17921 #[no_mangle]
17922 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
17923 /// but with all dynamically-allocated buffers duplicated in new buffers.
17924 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
17925 #[repr(C)]
17926 /// The contents of CResult_TxCreationKeysDecodeErrorZ
17927 pub union CResult_TxCreationKeysDecodeErrorZPtr {
17928         /// A pointer to the contents in the success state.
17929         /// Reading from this pointer when `result_ok` is not set is undefined.
17930         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
17931         /// A pointer to the contents in the error state.
17932         /// Reading from this pointer when `result_ok` is set is undefined.
17933         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17934 }
17935 #[repr(C)]
17936 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
17937 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
17938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17939 pub struct CResult_TxCreationKeysDecodeErrorZ {
17940         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
17941         /// `err` or `result` depending on the state of `result_ok`.
17942         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
17943         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
17944         pub result_ok: bool,
17945 }
17946 #[no_mangle]
17947 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
17948 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
17949         CResult_TxCreationKeysDecodeErrorZ {
17950                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
17951                         result: Box::into_raw(Box::new(o)),
17952                 },
17953                 result_ok: true,
17954         }
17955 }
17956 #[no_mangle]
17957 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
17958 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
17959         CResult_TxCreationKeysDecodeErrorZ {
17960                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
17961                         err: Box::into_raw(Box::new(e)),
17962                 },
17963                 result_ok: false,
17964         }
17965 }
17966 /// Checks if the given object is currently in the success state
17967 #[no_mangle]
17968 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
17969         o.result_ok
17970 }
17971 #[no_mangle]
17972 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
17973 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
17974 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
17975         fn drop(&mut self) {
17976                 if self.result_ok {
17977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17979                         }
17980                 } else {
17981                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17982                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17983                         }
17984                 }
17985         }
17986 }
17987 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
17988         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
17989                 let contents = if o.result_ok {
17990                         let result = unsafe { o.contents.result };
17991                         unsafe { o.contents.result = core::ptr::null_mut() };
17992                         CResult_TxCreationKeysDecodeErrorZPtr { result }
17993                 } else {
17994                         let err = unsafe { o.contents.err };
17995                         unsafe { o.contents.err = core::ptr::null_mut(); }
17996                         CResult_TxCreationKeysDecodeErrorZPtr { err }
17997                 };
17998                 Self {
17999                         contents,
18000                         result_ok: o.result_ok,
18001                 }
18002         }
18003 }
18004 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
18005         fn clone(&self) -> Self {
18006                 if self.result_ok {
18007                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18008                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
18009                         } }
18010                 } else {
18011                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18012                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18013                         } }
18014                 }
18015         }
18016 }
18017 #[no_mangle]
18018 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
18019 /// but with all dynamically-allocated buffers duplicated in new buffers.
18020 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
18021 #[repr(C)]
18022 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
18023 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
18024         /// A pointer to the contents in the success state.
18025         /// Reading from this pointer when `result_ok` is not set is undefined.
18026         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
18027         /// A pointer to the contents in the error state.
18028         /// Reading from this pointer when `result_ok` is set is undefined.
18029         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18030 }
18031 #[repr(C)]
18032 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
18033 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18035 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
18036         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
18037         /// `err` or `result` depending on the state of `result_ok`.
18038         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
18039         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
18040         pub result_ok: bool,
18041 }
18042 #[no_mangle]
18043 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
18044 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
18045         CResult_ChannelPublicKeysDecodeErrorZ {
18046                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18047                         result: Box::into_raw(Box::new(o)),
18048                 },
18049                 result_ok: true,
18050         }
18051 }
18052 #[no_mangle]
18053 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
18054 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
18055         CResult_ChannelPublicKeysDecodeErrorZ {
18056                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18057                         err: Box::into_raw(Box::new(e)),
18058                 },
18059                 result_ok: false,
18060         }
18061 }
18062 /// Checks if the given object is currently in the success state
18063 #[no_mangle]
18064 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
18065         o.result_ok
18066 }
18067 #[no_mangle]
18068 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
18069 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
18070 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
18071         fn drop(&mut self) {
18072                 if self.result_ok {
18073                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18074                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18075                         }
18076                 } else {
18077                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18078                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18079                         }
18080                 }
18081         }
18082 }
18083 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
18084         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18085                 let contents = if o.result_ok {
18086                         let result = unsafe { o.contents.result };
18087                         unsafe { o.contents.result = core::ptr::null_mut() };
18088                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
18089                 } else {
18090                         let err = unsafe { o.contents.err };
18091                         unsafe { o.contents.err = core::ptr::null_mut(); }
18092                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
18093                 };
18094                 Self {
18095                         contents,
18096                         result_ok: o.result_ok,
18097                 }
18098         }
18099 }
18100 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
18101         fn clone(&self) -> Self {
18102                 if self.result_ok {
18103                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18104                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
18105                         } }
18106                 } else {
18107                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18108                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18109                         } }
18110                 }
18111         }
18112 }
18113 #[no_mangle]
18114 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
18115 /// but with all dynamically-allocated buffers duplicated in new buffers.
18116 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
18117 #[repr(C)]
18118 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
18119 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18120         /// A pointer to the contents in the success state.
18121         /// Reading from this pointer when `result_ok` is not set is undefined.
18122         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
18123         /// A pointer to the contents in the error state.
18124         /// Reading from this pointer when `result_ok` is set is undefined.
18125         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18126 }
18127 #[repr(C)]
18128 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
18129 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
18130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18131 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
18132         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
18133         /// `err` or `result` depending on the state of `result_ok`.
18134         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
18135         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
18136         pub result_ok: bool,
18137 }
18138 #[no_mangle]
18139 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
18140 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18141         CResult_HTLCOutputInCommitmentDecodeErrorZ {
18142                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18143                         result: Box::into_raw(Box::new(o)),
18144                 },
18145                 result_ok: true,
18146         }
18147 }
18148 #[no_mangle]
18149 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
18150 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18151         CResult_HTLCOutputInCommitmentDecodeErrorZ {
18152                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18153                         err: Box::into_raw(Box::new(e)),
18154                 },
18155                 result_ok: false,
18156         }
18157 }
18158 /// Checks if the given object is currently in the success state
18159 #[no_mangle]
18160 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
18161         o.result_ok
18162 }
18163 #[no_mangle]
18164 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
18165 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
18166 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18167         fn drop(&mut self) {
18168                 if self.result_ok {
18169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18171                         }
18172                 } else {
18173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18175                         }
18176                 }
18177         }
18178 }
18179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18180         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
18181                 let contents = if o.result_ok {
18182                         let result = unsafe { o.contents.result };
18183                         unsafe { o.contents.result = core::ptr::null_mut() };
18184                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
18185                 } else {
18186                         let err = unsafe { o.contents.err };
18187                         unsafe { o.contents.err = core::ptr::null_mut(); }
18188                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
18189                 };
18190                 Self {
18191                         contents,
18192                         result_ok: o.result_ok,
18193                 }
18194         }
18195 }
18196 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18197         fn clone(&self) -> Self {
18198                 if self.result_ok {
18199                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18200                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
18201                         } }
18202                 } else {
18203                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18205                         } }
18206                 }
18207         }
18208 }
18209 #[no_mangle]
18210 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
18211 /// but with all dynamically-allocated buffers duplicated in new buffers.
18212 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
18213 #[repr(C)]
18214 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
18215 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18216         /// A pointer to the contents in the success state.
18217         /// Reading from this pointer when `result_ok` is not set is undefined.
18218         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
18219         /// A pointer to the contents in the error state.
18220         /// Reading from this pointer when `result_ok` is set is undefined.
18221         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18222 }
18223 #[repr(C)]
18224 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18225 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18227 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18228         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
18229         /// `err` or `result` depending on the state of `result_ok`.
18230         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
18231         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
18232         pub result_ok: bool,
18233 }
18234 #[no_mangle]
18235 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
18236 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18237         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18238                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18239                         result: Box::into_raw(Box::new(o)),
18240                 },
18241                 result_ok: true,
18242         }
18243 }
18244 #[no_mangle]
18245 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
18246 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18247         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18248                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18249                         err: Box::into_raw(Box::new(e)),
18250                 },
18251                 result_ok: false,
18252         }
18253 }
18254 /// Checks if the given object is currently in the success state
18255 #[no_mangle]
18256 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
18257         o.result_ok
18258 }
18259 #[no_mangle]
18260 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
18261 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
18262 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18263         fn drop(&mut self) {
18264                 if self.result_ok {
18265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18267                         }
18268                 } else {
18269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18271                         }
18272                 }
18273         }
18274 }
18275 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18276         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18277                 let contents = if o.result_ok {
18278                         let result = unsafe { o.contents.result };
18279                         unsafe { o.contents.result = core::ptr::null_mut() };
18280                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
18281                 } else {
18282                         let err = unsafe { o.contents.err };
18283                         unsafe { o.contents.err = core::ptr::null_mut(); }
18284                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
18285                 };
18286                 Self {
18287                         contents,
18288                         result_ok: o.result_ok,
18289                 }
18290         }
18291 }
18292 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18293         fn clone(&self) -> Self {
18294                 if self.result_ok {
18295                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18296                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18297                         } }
18298                 } else {
18299                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18300                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18301                         } }
18302                 }
18303         }
18304 }
18305 #[no_mangle]
18306 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18307 /// but with all dynamically-allocated buffers duplicated in new buffers.
18308 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18309 #[repr(C)]
18310 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
18311 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
18312         /// A pointer to the contents in the success state.
18313         /// Reading from this pointer when `result_ok` is not set is undefined.
18314         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
18315         /// A pointer to the contents in the error state.
18316         /// Reading from this pointer when `result_ok` is set is undefined.
18317         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18318 }
18319 #[repr(C)]
18320 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18321 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18323 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
18324         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
18325         /// `err` or `result` depending on the state of `result_ok`.
18326         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
18327         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
18328         pub result_ok: bool,
18329 }
18330 #[no_mangle]
18331 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
18332 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18333         CResult_ChannelTransactionParametersDecodeErrorZ {
18334                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18335                         result: Box::into_raw(Box::new(o)),
18336                 },
18337                 result_ok: true,
18338         }
18339 }
18340 #[no_mangle]
18341 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
18342 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18343         CResult_ChannelTransactionParametersDecodeErrorZ {
18344                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18345                         err: Box::into_raw(Box::new(e)),
18346                 },
18347                 result_ok: false,
18348         }
18349 }
18350 /// Checks if the given object is currently in the success state
18351 #[no_mangle]
18352 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
18353         o.result_ok
18354 }
18355 #[no_mangle]
18356 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
18357 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
18358 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
18359         fn drop(&mut self) {
18360                 if self.result_ok {
18361                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18362                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18363                         }
18364                 } else {
18365                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18366                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18367                         }
18368                 }
18369         }
18370 }
18371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
18372         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18373                 let contents = if o.result_ok {
18374                         let result = unsafe { o.contents.result };
18375                         unsafe { o.contents.result = core::ptr::null_mut() };
18376                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
18377                 } else {
18378                         let err = unsafe { o.contents.err };
18379                         unsafe { o.contents.err = core::ptr::null_mut(); }
18380                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
18381                 };
18382                 Self {
18383                         contents,
18384                         result_ok: o.result_ok,
18385                 }
18386         }
18387 }
18388 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
18389         fn clone(&self) -> Self {
18390                 if self.result_ok {
18391                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18392                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18393                         } }
18394                 } else {
18395                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18396                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18397                         } }
18398                 }
18399         }
18400 }
18401 #[no_mangle]
18402 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18403 /// but with all dynamically-allocated buffers duplicated in new buffers.
18404 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18405 #[repr(C)]
18406 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
18407 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18408         /// A pointer to the contents in the success state.
18409         /// Reading from this pointer when `result_ok` is not set is undefined.
18410         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
18411         /// A pointer to the contents in the error state.
18412         /// Reading from this pointer when `result_ok` is set is undefined.
18413         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18414 }
18415 #[repr(C)]
18416 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18417 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18419 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
18420         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
18421         /// `err` or `result` depending on the state of `result_ok`.
18422         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
18423         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
18424         pub result_ok: bool,
18425 }
18426 #[no_mangle]
18427 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
18428 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18429         CResult_HolderCommitmentTransactionDecodeErrorZ {
18430                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18431                         result: Box::into_raw(Box::new(o)),
18432                 },
18433                 result_ok: true,
18434         }
18435 }
18436 #[no_mangle]
18437 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
18438 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18439         CResult_HolderCommitmentTransactionDecodeErrorZ {
18440                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18441                         err: Box::into_raw(Box::new(e)),
18442                 },
18443                 result_ok: false,
18444         }
18445 }
18446 /// Checks if the given object is currently in the success state
18447 #[no_mangle]
18448 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
18449         o.result_ok
18450 }
18451 #[no_mangle]
18452 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
18453 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
18454 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
18455         fn drop(&mut self) {
18456                 if self.result_ok {
18457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18459                         }
18460                 } else {
18461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18463                         }
18464                 }
18465         }
18466 }
18467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
18468         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18469                 let contents = if o.result_ok {
18470                         let result = unsafe { o.contents.result };
18471                         unsafe { o.contents.result = core::ptr::null_mut() };
18472                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
18473                 } else {
18474                         let err = unsafe { o.contents.err };
18475                         unsafe { o.contents.err = core::ptr::null_mut(); }
18476                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
18477                 };
18478                 Self {
18479                         contents,
18480                         result_ok: o.result_ok,
18481                 }
18482         }
18483 }
18484 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
18485         fn clone(&self) -> Self {
18486                 if self.result_ok {
18487                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18488                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18489                         } }
18490                 } else {
18491                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18492                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18493                         } }
18494                 }
18495         }
18496 }
18497 #[no_mangle]
18498 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18499 /// but with all dynamically-allocated buffers duplicated in new buffers.
18500 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18501 #[repr(C)]
18502 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
18503 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18504         /// A pointer to the contents in the success state.
18505         /// Reading from this pointer when `result_ok` is not set is undefined.
18506         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
18507         /// A pointer to the contents in the error state.
18508         /// Reading from this pointer when `result_ok` is set is undefined.
18509         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18510 }
18511 #[repr(C)]
18512 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18513 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18515 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
18516         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
18517         /// `err` or `result` depending on the state of `result_ok`.
18518         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
18519         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
18520         pub result_ok: bool,
18521 }
18522 #[no_mangle]
18523 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
18524 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18525         CResult_BuiltCommitmentTransactionDecodeErrorZ {
18526                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18527                         result: Box::into_raw(Box::new(o)),
18528                 },
18529                 result_ok: true,
18530         }
18531 }
18532 #[no_mangle]
18533 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
18534 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18535         CResult_BuiltCommitmentTransactionDecodeErrorZ {
18536                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18537                         err: Box::into_raw(Box::new(e)),
18538                 },
18539                 result_ok: false,
18540         }
18541 }
18542 /// Checks if the given object is currently in the success state
18543 #[no_mangle]
18544 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
18545         o.result_ok
18546 }
18547 #[no_mangle]
18548 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
18549 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
18550 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18551         fn drop(&mut self) {
18552                 if self.result_ok {
18553                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18554                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18555                         }
18556                 } else {
18557                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18558                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18559                         }
18560                 }
18561         }
18562 }
18563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18564         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18565                 let contents = if o.result_ok {
18566                         let result = unsafe { o.contents.result };
18567                         unsafe { o.contents.result = core::ptr::null_mut() };
18568                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
18569                 } else {
18570                         let err = unsafe { o.contents.err };
18571                         unsafe { o.contents.err = core::ptr::null_mut(); }
18572                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
18573                 };
18574                 Self {
18575                         contents,
18576                         result_ok: o.result_ok,
18577                 }
18578         }
18579 }
18580 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18581         fn clone(&self) -> Self {
18582                 if self.result_ok {
18583                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18584                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18585                         } }
18586                 } else {
18587                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18588                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18589                         } }
18590                 }
18591         }
18592 }
18593 #[no_mangle]
18594 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18595 /// but with all dynamically-allocated buffers duplicated in new buffers.
18596 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18597 #[repr(C)]
18598 /// The contents of CResult_TrustedClosingTransactionNoneZ
18599 pub union CResult_TrustedClosingTransactionNoneZPtr {
18600         /// A pointer to the contents in the success state.
18601         /// Reading from this pointer when `result_ok` is not set is undefined.
18602         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
18603         /// Note that this value is always NULL, as there are no contents in the Err variant
18604         pub err: *mut core::ffi::c_void,
18605 }
18606 #[repr(C)]
18607 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
18608 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
18609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18610 pub struct CResult_TrustedClosingTransactionNoneZ {
18611         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
18612         /// `err` or `result` depending on the state of `result_ok`.
18613         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
18614         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
18615         pub result_ok: bool,
18616 }
18617 #[no_mangle]
18618 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
18619 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
18620         CResult_TrustedClosingTransactionNoneZ {
18621                 contents: CResult_TrustedClosingTransactionNoneZPtr {
18622                         result: Box::into_raw(Box::new(o)),
18623                 },
18624                 result_ok: true,
18625         }
18626 }
18627 #[no_mangle]
18628 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
18629 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
18630         CResult_TrustedClosingTransactionNoneZ {
18631                 contents: CResult_TrustedClosingTransactionNoneZPtr {
18632                         err: core::ptr::null_mut(),
18633                 },
18634                 result_ok: false,
18635         }
18636 }
18637 /// Checks if the given object is currently in the success state
18638 #[no_mangle]
18639 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
18640         o.result_ok
18641 }
18642 #[no_mangle]
18643 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
18644 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
18645 impl Drop for CResult_TrustedClosingTransactionNoneZ {
18646         fn drop(&mut self) {
18647                 if self.result_ok {
18648                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18649                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18650                         }
18651                 } else {
18652                 }
18653         }
18654 }
18655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
18656         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
18657                 let contents = if o.result_ok {
18658                         let result = unsafe { o.contents.result };
18659                         unsafe { o.contents.result = core::ptr::null_mut() };
18660                         CResult_TrustedClosingTransactionNoneZPtr { result }
18661                 } else {
18662                         let _ = unsafe { Box::from_raw(o.contents.err) };
18663                         o.contents.err = core::ptr::null_mut();
18664                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
18665                 };
18666                 Self {
18667                         contents,
18668                         result_ok: o.result_ok,
18669                 }
18670         }
18671 }
18672 #[repr(C)]
18673 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
18674 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
18675         /// A pointer to the contents in the success state.
18676         /// Reading from this pointer when `result_ok` is not set is undefined.
18677         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
18678         /// A pointer to the contents in the error state.
18679         /// Reading from this pointer when `result_ok` is set is undefined.
18680         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18681 }
18682 #[repr(C)]
18683 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18684 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18685 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18686 pub struct CResult_CommitmentTransactionDecodeErrorZ {
18687         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
18688         /// `err` or `result` depending on the state of `result_ok`.
18689         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
18690         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
18691         pub result_ok: bool,
18692 }
18693 #[no_mangle]
18694 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
18695 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
18696         CResult_CommitmentTransactionDecodeErrorZ {
18697                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18698                         result: Box::into_raw(Box::new(o)),
18699                 },
18700                 result_ok: true,
18701         }
18702 }
18703 #[no_mangle]
18704 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
18705 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
18706         CResult_CommitmentTransactionDecodeErrorZ {
18707                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18708                         err: Box::into_raw(Box::new(e)),
18709                 },
18710                 result_ok: false,
18711         }
18712 }
18713 /// Checks if the given object is currently in the success state
18714 #[no_mangle]
18715 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
18716         o.result_ok
18717 }
18718 #[no_mangle]
18719 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
18720 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
18721 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
18722         fn drop(&mut self) {
18723                 if self.result_ok {
18724                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18725                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18726                         }
18727                 } else {
18728                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18729                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18730                         }
18731                 }
18732         }
18733 }
18734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
18735         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18736                 let contents = if o.result_ok {
18737                         let result = unsafe { o.contents.result };
18738                         unsafe { o.contents.result = core::ptr::null_mut() };
18739                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
18740                 } else {
18741                         let err = unsafe { o.contents.err };
18742                         unsafe { o.contents.err = core::ptr::null_mut(); }
18743                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
18744                 };
18745                 Self {
18746                         contents,
18747                         result_ok: o.result_ok,
18748                 }
18749         }
18750 }
18751 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
18752         fn clone(&self) -> Self {
18753                 if self.result_ok {
18754                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18755                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18756                         } }
18757                 } else {
18758                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18759                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18760                         } }
18761                 }
18762         }
18763 }
18764 #[no_mangle]
18765 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
18766 /// but with all dynamically-allocated buffers duplicated in new buffers.
18767 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18768 #[repr(C)]
18769 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
18770 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
18771         /// A pointer to the contents in the success state.
18772         /// Reading from this pointer when `result_ok` is not set is undefined.
18773         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
18774         /// Note that this value is always NULL, as there are no contents in the Err variant
18775         pub err: *mut core::ffi::c_void,
18776 }
18777 #[repr(C)]
18778 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
18779 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
18780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18781 pub struct CResult_TrustedCommitmentTransactionNoneZ {
18782         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
18783         /// `err` or `result` depending on the state of `result_ok`.
18784         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
18785         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
18786         pub result_ok: bool,
18787 }
18788 #[no_mangle]
18789 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
18790 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
18791         CResult_TrustedCommitmentTransactionNoneZ {
18792                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
18793                         result: Box::into_raw(Box::new(o)),
18794                 },
18795                 result_ok: true,
18796         }
18797 }
18798 #[no_mangle]
18799 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
18800 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
18801         CResult_TrustedCommitmentTransactionNoneZ {
18802                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
18803                         err: core::ptr::null_mut(),
18804                 },
18805                 result_ok: false,
18806         }
18807 }
18808 /// Checks if the given object is currently in the success state
18809 #[no_mangle]
18810 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
18811         o.result_ok
18812 }
18813 #[no_mangle]
18814 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
18815 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
18816 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
18817         fn drop(&mut self) {
18818                 if self.result_ok {
18819                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18820                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18821                         }
18822                 } else {
18823                 }
18824         }
18825 }
18826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
18827         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
18828                 let contents = if o.result_ok {
18829                         let result = unsafe { o.contents.result };
18830                         unsafe { o.contents.result = core::ptr::null_mut() };
18831                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
18832                 } else {
18833                         let _ = unsafe { Box::from_raw(o.contents.err) };
18834                         o.contents.err = core::ptr::null_mut();
18835                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
18836                 };
18837                 Self {
18838                         contents,
18839                         result_ok: o.result_ok,
18840                 }
18841         }
18842 }
18843 #[repr(C)]
18844 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
18845 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
18846         /// A pointer to the contents in the success state.
18847         /// Reading from this pointer when `result_ok` is not set is undefined.
18848         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
18849         /// Note that this value is always NULL, as there are no contents in the Err variant
18850         pub err: *mut core::ffi::c_void,
18851 }
18852 #[repr(C)]
18853 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
18854 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
18855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18856 pub struct CResult_CVec_ECDSASignatureZNoneZ {
18857         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
18858         /// `err` or `result` depending on the state of `result_ok`.
18859         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
18860         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
18861         pub result_ok: bool,
18862 }
18863 #[no_mangle]
18864 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
18865 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
18866         CResult_CVec_ECDSASignatureZNoneZ {
18867                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18868                         result: Box::into_raw(Box::new(o)),
18869                 },
18870                 result_ok: true,
18871         }
18872 }
18873 #[no_mangle]
18874 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
18875 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
18876         CResult_CVec_ECDSASignatureZNoneZ {
18877                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18878                         err: core::ptr::null_mut(),
18879                 },
18880                 result_ok: false,
18881         }
18882 }
18883 /// Checks if the given object is currently in the success state
18884 #[no_mangle]
18885 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
18886         o.result_ok
18887 }
18888 #[no_mangle]
18889 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
18890 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
18891 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
18892         fn drop(&mut self) {
18893                 if self.result_ok {
18894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18896                         }
18897                 } else {
18898                 }
18899         }
18900 }
18901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
18902         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
18903                 let contents = if o.result_ok {
18904                         let result = unsafe { o.contents.result };
18905                         unsafe { o.contents.result = core::ptr::null_mut() };
18906                         CResult_CVec_ECDSASignatureZNoneZPtr { result }
18907                 } else {
18908                         let _ = unsafe { Box::from_raw(o.contents.err) };
18909                         o.contents.err = core::ptr::null_mut();
18910                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
18911                 };
18912                 Self {
18913                         contents,
18914                         result_ok: o.result_ok,
18915                 }
18916         }
18917 }
18918 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
18919         fn clone(&self) -> Self {
18920                 if self.result_ok {
18921                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18922                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
18923                         } }
18924                 } else {
18925                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18926                                 err: core::ptr::null_mut()
18927                         } }
18928                 }
18929         }
18930 }
18931 #[no_mangle]
18932 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
18933 /// but with all dynamically-allocated buffers duplicated in new buffers.
18934 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
18935 #[repr(C)]
18936 #[derive(Clone)]
18937 /// An enum which can either contain a usize or not
18938 pub enum COption_usizeZ {
18939         /// When we're in this state, this COption_usizeZ contains a usize
18940         Some(usize),
18941         /// When we're in this state, this COption_usizeZ contains nothing
18942         None
18943 }
18944 impl COption_usizeZ {
18945         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18946                 if let Self::None = self { false } else { true }
18947         }
18948         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18949                 !self.is_some()
18950         }
18951         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
18952                 if let Self::Some(v) = self { v } else { unreachable!() }
18953         }
18954 }
18955 #[no_mangle]
18956 /// Constructs a new COption_usizeZ containing a usize
18957 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
18958         COption_usizeZ::Some(o)
18959 }
18960 #[no_mangle]
18961 /// Constructs a new COption_usizeZ containing nothing
18962 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
18963         COption_usizeZ::None
18964 }
18965 #[no_mangle]
18966 /// Frees any resources associated with the usize, if we are in the Some state
18967 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
18968 #[no_mangle]
18969 /// Creates a new COption_usizeZ which has the same data as `orig`
18970 /// but with all dynamically-allocated buffers duplicated in new buffers.
18971 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
18972 #[repr(C)]
18973 /// The contents of CResult_ShutdownScriptDecodeErrorZ
18974 pub union CResult_ShutdownScriptDecodeErrorZPtr {
18975         /// A pointer to the contents in the success state.
18976         /// Reading from this pointer when `result_ok` is not set is undefined.
18977         pub result: *mut crate::lightning::ln::script::ShutdownScript,
18978         /// A pointer to the contents in the error state.
18979         /// Reading from this pointer when `result_ok` is set is undefined.
18980         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18981 }
18982 #[repr(C)]
18983 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
18984 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
18985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18986 pub struct CResult_ShutdownScriptDecodeErrorZ {
18987         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
18988         /// `err` or `result` depending on the state of `result_ok`.
18989         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
18990         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
18991         pub result_ok: bool,
18992 }
18993 #[no_mangle]
18994 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
18995 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
18996         CResult_ShutdownScriptDecodeErrorZ {
18997                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
18998                         result: Box::into_raw(Box::new(o)),
18999                 },
19000                 result_ok: true,
19001         }
19002 }
19003 #[no_mangle]
19004 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
19005 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
19006         CResult_ShutdownScriptDecodeErrorZ {
19007                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19008                         err: Box::into_raw(Box::new(e)),
19009                 },
19010                 result_ok: false,
19011         }
19012 }
19013 /// Checks if the given object is currently in the success state
19014 #[no_mangle]
19015 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
19016         o.result_ok
19017 }
19018 #[no_mangle]
19019 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
19020 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
19021 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
19022         fn drop(&mut self) {
19023                 if self.result_ok {
19024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19026                         }
19027                 } else {
19028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19030                         }
19031                 }
19032         }
19033 }
19034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
19035         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
19036                 let contents = if o.result_ok {
19037                         let result = unsafe { o.contents.result };
19038                         unsafe { o.contents.result = core::ptr::null_mut() };
19039                         CResult_ShutdownScriptDecodeErrorZPtr { result }
19040                 } else {
19041                         let err = unsafe { o.contents.err };
19042                         unsafe { o.contents.err = core::ptr::null_mut(); }
19043                         CResult_ShutdownScriptDecodeErrorZPtr { err }
19044                 };
19045                 Self {
19046                         contents,
19047                         result_ok: o.result_ok,
19048                 }
19049         }
19050 }
19051 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
19052         fn clone(&self) -> Self {
19053                 if self.result_ok {
19054                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19055                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19056                         } }
19057                 } else {
19058                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19059                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19060                         } }
19061                 }
19062         }
19063 }
19064 #[no_mangle]
19065 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
19066 /// but with all dynamically-allocated buffers duplicated in new buffers.
19067 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
19068 #[repr(C)]
19069 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
19070 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19071         /// A pointer to the contents in the success state.
19072         /// Reading from this pointer when `result_ok` is not set is undefined.
19073         pub result: *mut crate::lightning::ln::script::ShutdownScript,
19074         /// A pointer to the contents in the error state.
19075         /// Reading from this pointer when `result_ok` is set is undefined.
19076         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
19077 }
19078 #[repr(C)]
19079 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
19080 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
19081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19082 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
19083         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
19084         /// `err` or `result` depending on the state of `result_ok`.
19085         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
19086         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
19087         pub result_ok: bool,
19088 }
19089 #[no_mangle]
19090 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
19091 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19092         CResult_ShutdownScriptInvalidShutdownScriptZ {
19093                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19094                         result: Box::into_raw(Box::new(o)),
19095                 },
19096                 result_ok: true,
19097         }
19098 }
19099 #[no_mangle]
19100 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
19101 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19102         CResult_ShutdownScriptInvalidShutdownScriptZ {
19103                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19104                         err: Box::into_raw(Box::new(e)),
19105                 },
19106                 result_ok: false,
19107         }
19108 }
19109 /// Checks if the given object is currently in the success state
19110 #[no_mangle]
19111 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
19112         o.result_ok
19113 }
19114 #[no_mangle]
19115 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
19116 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
19117 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
19118         fn drop(&mut self) {
19119                 if self.result_ok {
19120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19122                         }
19123                 } else {
19124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19126                         }
19127                 }
19128         }
19129 }
19130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
19131         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
19132                 let contents = if o.result_ok {
19133                         let result = unsafe { o.contents.result };
19134                         unsafe { o.contents.result = core::ptr::null_mut() };
19135                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
19136                 } else {
19137                         let err = unsafe { o.contents.err };
19138                         unsafe { o.contents.err = core::ptr::null_mut(); }
19139                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
19140                 };
19141                 Self {
19142                         contents,
19143                         result_ok: o.result_ok,
19144                 }
19145         }
19146 }
19147 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
19148         fn clone(&self) -> Self {
19149                 if self.result_ok {
19150                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19151                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19152                         } }
19153                 } else {
19154                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
19156                         } }
19157                 }
19158         }
19159 }
19160 #[no_mangle]
19161 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
19162 /// but with all dynamically-allocated buffers duplicated in new buffers.
19163 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
19164 #[repr(C)]
19165 /// The contents of CResult_PaymentPurposeDecodeErrorZ
19166 pub union CResult_PaymentPurposeDecodeErrorZPtr {
19167         /// A pointer to the contents in the success state.
19168         /// Reading from this pointer when `result_ok` is not set is undefined.
19169         pub result: *mut crate::lightning::events::PaymentPurpose,
19170         /// A pointer to the contents in the error state.
19171         /// Reading from this pointer when `result_ok` is set is undefined.
19172         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19173 }
19174 #[repr(C)]
19175 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
19176 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
19177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19178 pub struct CResult_PaymentPurposeDecodeErrorZ {
19179         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
19180         /// `err` or `result` depending on the state of `result_ok`.
19181         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
19182         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
19183         pub result_ok: bool,
19184 }
19185 #[no_mangle]
19186 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
19187 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
19188         CResult_PaymentPurposeDecodeErrorZ {
19189                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19190                         result: Box::into_raw(Box::new(o)),
19191                 },
19192                 result_ok: true,
19193         }
19194 }
19195 #[no_mangle]
19196 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
19197 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
19198         CResult_PaymentPurposeDecodeErrorZ {
19199                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19200                         err: Box::into_raw(Box::new(e)),
19201                 },
19202                 result_ok: false,
19203         }
19204 }
19205 /// Checks if the given object is currently in the success state
19206 #[no_mangle]
19207 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
19208         o.result_ok
19209 }
19210 #[no_mangle]
19211 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
19212 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
19213 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
19214         fn drop(&mut self) {
19215                 if self.result_ok {
19216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19218                         }
19219                 } else {
19220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19222                         }
19223                 }
19224         }
19225 }
19226 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
19227         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
19228                 let contents = if o.result_ok {
19229                         let result = unsafe { o.contents.result };
19230                         unsafe { o.contents.result = core::ptr::null_mut() };
19231                         CResult_PaymentPurposeDecodeErrorZPtr { result }
19232                 } else {
19233                         let err = unsafe { o.contents.err };
19234                         unsafe { o.contents.err = core::ptr::null_mut(); }
19235                         CResult_PaymentPurposeDecodeErrorZPtr { err }
19236                 };
19237                 Self {
19238                         contents,
19239                         result_ok: o.result_ok,
19240                 }
19241         }
19242 }
19243 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
19244         fn clone(&self) -> Self {
19245                 if self.result_ok {
19246                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19247                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
19248                         } }
19249                 } else {
19250                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19251                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19252                         } }
19253                 }
19254         }
19255 }
19256 #[no_mangle]
19257 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
19258 /// but with all dynamically-allocated buffers duplicated in new buffers.
19259 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
19260 #[repr(C)]
19261 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
19262 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
19263         /// A pointer to the contents in the success state.
19264         /// Reading from this pointer when `result_ok` is not set is undefined.
19265         pub result: *mut crate::lightning::events::ClaimedHTLC,
19266         /// A pointer to the contents in the error state.
19267         /// Reading from this pointer when `result_ok` is set is undefined.
19268         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19269 }
19270 #[repr(C)]
19271 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
19272 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19274 pub struct CResult_ClaimedHTLCDecodeErrorZ {
19275         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
19276         /// `err` or `result` depending on the state of `result_ok`.
19277         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
19278         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
19279         pub result_ok: bool,
19280 }
19281 #[no_mangle]
19282 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
19283 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
19284         CResult_ClaimedHTLCDecodeErrorZ {
19285                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19286                         result: Box::into_raw(Box::new(o)),
19287                 },
19288                 result_ok: true,
19289         }
19290 }
19291 #[no_mangle]
19292 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
19293 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
19294         CResult_ClaimedHTLCDecodeErrorZ {
19295                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19296                         err: Box::into_raw(Box::new(e)),
19297                 },
19298                 result_ok: false,
19299         }
19300 }
19301 /// Checks if the given object is currently in the success state
19302 #[no_mangle]
19303 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
19304         o.result_ok
19305 }
19306 #[no_mangle]
19307 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
19308 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
19309 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
19310         fn drop(&mut self) {
19311                 if self.result_ok {
19312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19314                         }
19315                 } else {
19316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19318                         }
19319                 }
19320         }
19321 }
19322 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
19323         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19324                 let contents = if o.result_ok {
19325                         let result = unsafe { o.contents.result };
19326                         unsafe { o.contents.result = core::ptr::null_mut() };
19327                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
19328                 } else {
19329                         let err = unsafe { o.contents.err };
19330                         unsafe { o.contents.err = core::ptr::null_mut(); }
19331                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
19332                 };
19333                 Self {
19334                         contents,
19335                         result_ok: o.result_ok,
19336                 }
19337         }
19338 }
19339 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
19340         fn clone(&self) -> Self {
19341                 if self.result_ok {
19342                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19343                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
19344                         } }
19345                 } else {
19346                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19347                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19348                         } }
19349                 }
19350         }
19351 }
19352 #[no_mangle]
19353 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
19354 /// but with all dynamically-allocated buffers duplicated in new buffers.
19355 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
19356 #[repr(C)]
19357 #[derive(Clone)]
19358 /// An enum which can either contain a crate::lightning::events::PathFailure or not
19359 pub enum COption_PathFailureZ {
19360         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
19361         Some(crate::lightning::events::PathFailure),
19362         /// When we're in this state, this COption_PathFailureZ contains nothing
19363         None
19364 }
19365 impl COption_PathFailureZ {
19366         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19367                 if let Self::None = self { false } else { true }
19368         }
19369         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19370                 !self.is_some()
19371         }
19372         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
19373                 if let Self::Some(v) = self { v } else { unreachable!() }
19374         }
19375 }
19376 #[no_mangle]
19377 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
19378 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
19379         COption_PathFailureZ::Some(o)
19380 }
19381 #[no_mangle]
19382 /// Constructs a new COption_PathFailureZ containing nothing
19383 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
19384         COption_PathFailureZ::None
19385 }
19386 #[no_mangle]
19387 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
19388 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
19389 #[no_mangle]
19390 /// Creates a new COption_PathFailureZ which has the same data as `orig`
19391 /// but with all dynamically-allocated buffers duplicated in new buffers.
19392 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
19393 #[repr(C)]
19394 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
19395 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
19396         /// A pointer to the contents in the success state.
19397         /// Reading from this pointer when `result_ok` is not set is undefined.
19398         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
19399         /// A pointer to the contents in the error state.
19400         /// Reading from this pointer when `result_ok` is set is undefined.
19401         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19402 }
19403 #[repr(C)]
19404 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
19405 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19406 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19407 pub struct CResult_COption_PathFailureZDecodeErrorZ {
19408         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
19409         /// `err` or `result` depending on the state of `result_ok`.
19410         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
19411         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
19412         pub result_ok: bool,
19413 }
19414 #[no_mangle]
19415 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
19416 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
19417         CResult_COption_PathFailureZDecodeErrorZ {
19418                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19419                         result: Box::into_raw(Box::new(o)),
19420                 },
19421                 result_ok: true,
19422         }
19423 }
19424 #[no_mangle]
19425 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
19426 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
19427         CResult_COption_PathFailureZDecodeErrorZ {
19428                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19429                         err: Box::into_raw(Box::new(e)),
19430                 },
19431                 result_ok: false,
19432         }
19433 }
19434 /// Checks if the given object is currently in the success state
19435 #[no_mangle]
19436 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
19437         o.result_ok
19438 }
19439 #[no_mangle]
19440 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
19441 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
19442 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
19443         fn drop(&mut self) {
19444                 if self.result_ok {
19445                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19446                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19447                         }
19448                 } else {
19449                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19450                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19451                         }
19452                 }
19453         }
19454 }
19455 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
19456         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19457                 let contents = if o.result_ok {
19458                         let result = unsafe { o.contents.result };
19459                         unsafe { o.contents.result = core::ptr::null_mut() };
19460                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
19461                 } else {
19462                         let err = unsafe { o.contents.err };
19463                         unsafe { o.contents.err = core::ptr::null_mut(); }
19464                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
19465                 };
19466                 Self {
19467                         contents,
19468                         result_ok: o.result_ok,
19469                 }
19470         }
19471 }
19472 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
19473         fn clone(&self) -> Self {
19474                 if self.result_ok {
19475                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19476                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
19477                         } }
19478                 } else {
19479                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19480                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19481                         } }
19482                 }
19483         }
19484 }
19485 #[no_mangle]
19486 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
19487 /// but with all dynamically-allocated buffers duplicated in new buffers.
19488 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
19489 #[repr(C)]
19490 #[derive(Clone)]
19491 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
19492 pub enum COption_ClosureReasonZ {
19493         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
19494         Some(crate::lightning::events::ClosureReason),
19495         /// When we're in this state, this COption_ClosureReasonZ contains nothing
19496         None
19497 }
19498 impl COption_ClosureReasonZ {
19499         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19500                 if let Self::None = self { false } else { true }
19501         }
19502         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19503                 !self.is_some()
19504         }
19505         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
19506                 if let Self::Some(v) = self { v } else { unreachable!() }
19507         }
19508 }
19509 #[no_mangle]
19510 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
19511 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
19512         COption_ClosureReasonZ::Some(o)
19513 }
19514 #[no_mangle]
19515 /// Constructs a new COption_ClosureReasonZ containing nothing
19516 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
19517         COption_ClosureReasonZ::None
19518 }
19519 #[no_mangle]
19520 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
19521 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
19522 #[no_mangle]
19523 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
19524 /// but with all dynamically-allocated buffers duplicated in new buffers.
19525 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
19526 #[repr(C)]
19527 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
19528 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
19529         /// A pointer to the contents in the success state.
19530         /// Reading from this pointer when `result_ok` is not set is undefined.
19531         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
19532         /// A pointer to the contents in the error state.
19533         /// Reading from this pointer when `result_ok` is set is undefined.
19534         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19535 }
19536 #[repr(C)]
19537 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
19538 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19540 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
19541         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
19542         /// `err` or `result` depending on the state of `result_ok`.
19543         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
19544         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
19545         pub result_ok: bool,
19546 }
19547 #[no_mangle]
19548 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
19549 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19550         CResult_COption_ClosureReasonZDecodeErrorZ {
19551                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19552                         result: Box::into_raw(Box::new(o)),
19553                 },
19554                 result_ok: true,
19555         }
19556 }
19557 #[no_mangle]
19558 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
19559 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19560         CResult_COption_ClosureReasonZDecodeErrorZ {
19561                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19562                         err: Box::into_raw(Box::new(e)),
19563                 },
19564                 result_ok: false,
19565         }
19566 }
19567 /// Checks if the given object is currently in the success state
19568 #[no_mangle]
19569 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
19570         o.result_ok
19571 }
19572 #[no_mangle]
19573 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
19574 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
19575 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
19576         fn drop(&mut self) {
19577                 if self.result_ok {
19578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19580                         }
19581                 } else {
19582                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19583                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19584                         }
19585                 }
19586         }
19587 }
19588 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
19589         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19590                 let contents = if o.result_ok {
19591                         let result = unsafe { o.contents.result };
19592                         unsafe { o.contents.result = core::ptr::null_mut() };
19593                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
19594                 } else {
19595                         let err = unsafe { o.contents.err };
19596                         unsafe { o.contents.err = core::ptr::null_mut(); }
19597                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
19598                 };
19599                 Self {
19600                         contents,
19601                         result_ok: o.result_ok,
19602                 }
19603         }
19604 }
19605 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
19606         fn clone(&self) -> Self {
19607                 if self.result_ok {
19608                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19609                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
19610                         } }
19611                 } else {
19612                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19613                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19614                         } }
19615                 }
19616         }
19617 }
19618 #[no_mangle]
19619 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
19620 /// but with all dynamically-allocated buffers duplicated in new buffers.
19621 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
19622 #[repr(C)]
19623 #[derive(Clone)]
19624 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
19625 pub enum COption_HTLCDestinationZ {
19626         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
19627         Some(crate::lightning::events::HTLCDestination),
19628         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
19629         None
19630 }
19631 impl COption_HTLCDestinationZ {
19632         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19633                 if let Self::None = self { false } else { true }
19634         }
19635         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19636                 !self.is_some()
19637         }
19638         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
19639                 if let Self::Some(v) = self { v } else { unreachable!() }
19640         }
19641 }
19642 #[no_mangle]
19643 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
19644 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
19645         COption_HTLCDestinationZ::Some(o)
19646 }
19647 #[no_mangle]
19648 /// Constructs a new COption_HTLCDestinationZ containing nothing
19649 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
19650         COption_HTLCDestinationZ::None
19651 }
19652 #[no_mangle]
19653 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
19654 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
19655 #[no_mangle]
19656 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
19657 /// but with all dynamically-allocated buffers duplicated in new buffers.
19658 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
19659 #[repr(C)]
19660 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
19661 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19662         /// A pointer to the contents in the success state.
19663         /// Reading from this pointer when `result_ok` is not set is undefined.
19664         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
19665         /// A pointer to the contents in the error state.
19666         /// Reading from this pointer when `result_ok` is set is undefined.
19667         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19668 }
19669 #[repr(C)]
19670 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
19671 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19673 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
19674         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
19675         /// `err` or `result` depending on the state of `result_ok`.
19676         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
19677         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
19678         pub result_ok: bool,
19679 }
19680 #[no_mangle]
19681 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
19682 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19683         CResult_COption_HTLCDestinationZDecodeErrorZ {
19684                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19685                         result: Box::into_raw(Box::new(o)),
19686                 },
19687                 result_ok: true,
19688         }
19689 }
19690 #[no_mangle]
19691 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
19692 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19693         CResult_COption_HTLCDestinationZDecodeErrorZ {
19694                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19695                         err: Box::into_raw(Box::new(e)),
19696                 },
19697                 result_ok: false,
19698         }
19699 }
19700 /// Checks if the given object is currently in the success state
19701 #[no_mangle]
19702 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
19703         o.result_ok
19704 }
19705 #[no_mangle]
19706 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
19707 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
19708 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
19709         fn drop(&mut self) {
19710                 if self.result_ok {
19711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19713                         }
19714                 } else {
19715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19717                         }
19718                 }
19719         }
19720 }
19721 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
19722         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19723                 let contents = if o.result_ok {
19724                         let result = unsafe { o.contents.result };
19725                         unsafe { o.contents.result = core::ptr::null_mut() };
19726                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
19727                 } else {
19728                         let err = unsafe { o.contents.err };
19729                         unsafe { o.contents.err = core::ptr::null_mut(); }
19730                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
19731                 };
19732                 Self {
19733                         contents,
19734                         result_ok: o.result_ok,
19735                 }
19736         }
19737 }
19738 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
19739         fn clone(&self) -> Self {
19740                 if self.result_ok {
19741                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19742                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
19743                         } }
19744                 } else {
19745                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19746                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19747                         } }
19748                 }
19749         }
19750 }
19751 #[no_mangle]
19752 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
19753 /// but with all dynamically-allocated buffers duplicated in new buffers.
19754 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
19755 #[repr(C)]
19756 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
19757 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
19758         /// A pointer to the contents in the success state.
19759         /// Reading from this pointer when `result_ok` is not set is undefined.
19760         pub result: *mut crate::lightning::events::PaymentFailureReason,
19761         /// A pointer to the contents in the error state.
19762         /// Reading from this pointer when `result_ok` is set is undefined.
19763         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19764 }
19765 #[repr(C)]
19766 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
19767 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
19768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19769 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
19770         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
19771         /// `err` or `result` depending on the state of `result_ok`.
19772         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
19773         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
19774         pub result_ok: bool,
19775 }
19776 #[no_mangle]
19777 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
19778 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
19779         CResult_PaymentFailureReasonDecodeErrorZ {
19780                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19781                         result: Box::into_raw(Box::new(o)),
19782                 },
19783                 result_ok: true,
19784         }
19785 }
19786 #[no_mangle]
19787 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
19788 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
19789         CResult_PaymentFailureReasonDecodeErrorZ {
19790                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19791                         err: Box::into_raw(Box::new(e)),
19792                 },
19793                 result_ok: false,
19794         }
19795 }
19796 /// Checks if the given object is currently in the success state
19797 #[no_mangle]
19798 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
19799         o.result_ok
19800 }
19801 #[no_mangle]
19802 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
19803 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
19804 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
19805         fn drop(&mut self) {
19806                 if self.result_ok {
19807                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19808                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19809                         }
19810                 } else {
19811                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19812                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19813                         }
19814                 }
19815         }
19816 }
19817 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
19818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
19819                 let contents = if o.result_ok {
19820                         let result = unsafe { o.contents.result };
19821                         unsafe { o.contents.result = core::ptr::null_mut() };
19822                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
19823                 } else {
19824                         let err = unsafe { o.contents.err };
19825                         unsafe { o.contents.err = core::ptr::null_mut(); }
19826                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
19827                 };
19828                 Self {
19829                         contents,
19830                         result_ok: o.result_ok,
19831                 }
19832         }
19833 }
19834 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
19835         fn clone(&self) -> Self {
19836                 if self.result_ok {
19837                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19838                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
19839                         } }
19840                 } else {
19841                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19842                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19843                         } }
19844                 }
19845         }
19846 }
19847 #[no_mangle]
19848 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
19849 /// but with all dynamically-allocated buffers duplicated in new buffers.
19850 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
19851 #[repr(C)]
19852 #[derive(Clone)]
19853 /// An enum which can either contain a crate::c_types::U128 or not
19854 pub enum COption_U128Z {
19855         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
19856         Some(crate::c_types::U128),
19857         /// When we're in this state, this COption_U128Z contains nothing
19858         None
19859 }
19860 impl COption_U128Z {
19861         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19862                 if let Self::None = self { false } else { true }
19863         }
19864         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19865                 !self.is_some()
19866         }
19867         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
19868                 if let Self::Some(v) = self { v } else { unreachable!() }
19869         }
19870 }
19871 #[no_mangle]
19872 /// Constructs a new COption_U128Z containing a crate::c_types::U128
19873 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
19874         COption_U128Z::Some(o)
19875 }
19876 #[no_mangle]
19877 /// Constructs a new COption_U128Z containing nothing
19878 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
19879         COption_U128Z::None
19880 }
19881 #[no_mangle]
19882 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
19883 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
19884 #[no_mangle]
19885 /// Creates a new COption_U128Z which has the same data as `orig`
19886 /// but with all dynamically-allocated buffers duplicated in new buffers.
19887 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
19888 #[repr(C)]
19889 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
19890 /// This corresponds to std::vector in C++
19891 pub struct CVec_ClaimedHTLCZ {
19892         /// The elements in the array.
19893         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19894         pub data: *mut crate::lightning::events::ClaimedHTLC,
19895         /// The number of elements pointed to by `data`.
19896         pub datalen: usize
19897 }
19898 impl CVec_ClaimedHTLCZ {
19899         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
19900                 if self.datalen == 0 { return Vec::new(); }
19901                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19902                 self.data = core::ptr::null_mut();
19903                 self.datalen = 0;
19904                 ret
19905         }
19906         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
19907                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19908         }
19909 }
19910 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
19911         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
19912                 let datalen = v.len();
19913                 let data = Box::into_raw(v.into_boxed_slice());
19914                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19915         }
19916 }
19917 #[no_mangle]
19918 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19919 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
19920 impl Drop for CVec_ClaimedHTLCZ {
19921         fn drop(&mut self) {
19922                 if self.datalen == 0 { return; }
19923                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19924         }
19925 }
19926 impl Clone for CVec_ClaimedHTLCZ {
19927         fn clone(&self) -> Self {
19928                 let mut res = Vec::new();
19929                 if self.datalen == 0 { return Self::from(res); }
19930                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19931                 Self::from(res)
19932         }
19933 }
19934 #[repr(C)]
19935 #[derive(Clone)]
19936 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
19937 pub enum COption_PaymentFailureReasonZ {
19938         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
19939         Some(crate::lightning::events::PaymentFailureReason),
19940         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
19941         None
19942 }
19943 impl COption_PaymentFailureReasonZ {
19944         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19945                 if let Self::None = self { false } else { true }
19946         }
19947         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19948                 !self.is_some()
19949         }
19950         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
19951                 if let Self::Some(v) = self { v } else { unreachable!() }
19952         }
19953 }
19954 #[no_mangle]
19955 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
19956 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
19957         COption_PaymentFailureReasonZ::Some(o)
19958 }
19959 #[no_mangle]
19960 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
19961 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
19962         COption_PaymentFailureReasonZ::None
19963 }
19964 #[no_mangle]
19965 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
19966 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
19967 #[no_mangle]
19968 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
19969 /// but with all dynamically-allocated buffers duplicated in new buffers.
19970 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
19971 #[repr(C)]
19972 #[derive(Clone)]
19973 /// An enum which can either contain a crate::lightning::events::Event or not
19974 pub enum COption_EventZ {
19975         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
19976         Some(crate::lightning::events::Event),
19977         /// When we're in this state, this COption_EventZ contains nothing
19978         None
19979 }
19980 impl COption_EventZ {
19981         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19982                 if let Self::None = self { false } else { true }
19983         }
19984         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19985                 !self.is_some()
19986         }
19987         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
19988                 if let Self::Some(v) = self { v } else { unreachable!() }
19989         }
19990 }
19991 #[no_mangle]
19992 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
19993 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
19994         COption_EventZ::Some(o)
19995 }
19996 #[no_mangle]
19997 /// Constructs a new COption_EventZ containing nothing
19998 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
19999         COption_EventZ::None
20000 }
20001 #[no_mangle]
20002 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
20003 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
20004 #[no_mangle]
20005 /// Creates a new COption_EventZ which has the same data as `orig`
20006 /// but with all dynamically-allocated buffers duplicated in new buffers.
20007 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
20008 #[repr(C)]
20009 /// The contents of CResult_COption_EventZDecodeErrorZ
20010 pub union CResult_COption_EventZDecodeErrorZPtr {
20011         /// A pointer to the contents in the success state.
20012         /// Reading from this pointer when `result_ok` is not set is undefined.
20013         pub result: *mut crate::c_types::derived::COption_EventZ,
20014         /// A pointer to the contents in the error state.
20015         /// Reading from this pointer when `result_ok` is set is undefined.
20016         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20017 }
20018 #[repr(C)]
20019 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
20020 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20021 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20022 pub struct CResult_COption_EventZDecodeErrorZ {
20023         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
20024         /// `err` or `result` depending on the state of `result_ok`.
20025         pub contents: CResult_COption_EventZDecodeErrorZPtr,
20026         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
20027         pub result_ok: bool,
20028 }
20029 #[no_mangle]
20030 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
20031 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
20032         CResult_COption_EventZDecodeErrorZ {
20033                 contents: CResult_COption_EventZDecodeErrorZPtr {
20034                         result: Box::into_raw(Box::new(o)),
20035                 },
20036                 result_ok: true,
20037         }
20038 }
20039 #[no_mangle]
20040 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
20041 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
20042         CResult_COption_EventZDecodeErrorZ {
20043                 contents: CResult_COption_EventZDecodeErrorZPtr {
20044                         err: Box::into_raw(Box::new(e)),
20045                 },
20046                 result_ok: false,
20047         }
20048 }
20049 /// Checks if the given object is currently in the success state
20050 #[no_mangle]
20051 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
20052         o.result_ok
20053 }
20054 #[no_mangle]
20055 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
20056 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
20057 impl Drop for CResult_COption_EventZDecodeErrorZ {
20058         fn drop(&mut self) {
20059                 if self.result_ok {
20060                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20061                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20062                         }
20063                 } else {
20064                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20065                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20066                         }
20067                 }
20068         }
20069 }
20070 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
20071         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20072                 let contents = if o.result_ok {
20073                         let result = unsafe { o.contents.result };
20074                         unsafe { o.contents.result = core::ptr::null_mut() };
20075                         CResult_COption_EventZDecodeErrorZPtr { result }
20076                 } else {
20077                         let err = unsafe { o.contents.err };
20078                         unsafe { o.contents.err = core::ptr::null_mut(); }
20079                         CResult_COption_EventZDecodeErrorZPtr { err }
20080                 };
20081                 Self {
20082                         contents,
20083                         result_ok: o.result_ok,
20084                 }
20085         }
20086 }
20087 impl Clone for CResult_COption_EventZDecodeErrorZ {
20088         fn clone(&self) -> Self {
20089                 if self.result_ok {
20090                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
20091                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
20092                         } }
20093                 } else {
20094                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
20095                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20096                         } }
20097                 }
20098         }
20099 }
20100 #[no_mangle]
20101 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
20102 /// but with all dynamically-allocated buffers duplicated in new buffers.
20103 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
20104 #[repr(C)]
20105 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
20106 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
20107         /// A pointer to the contents in the success state.
20108         /// Reading from this pointer when `result_ok` is not set is undefined.
20109         pub result: *mut crate::lightning_invoice::SiPrefix,
20110         /// A pointer to the contents in the error state.
20111         /// Reading from this pointer when `result_ok` is set is undefined.
20112         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20113 }
20114 #[repr(C)]
20115 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
20116 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20117 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20118 pub struct CResult_SiPrefixBolt11ParseErrorZ {
20119         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
20120         /// `err` or `result` depending on the state of `result_ok`.
20121         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
20122         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
20123         pub result_ok: bool,
20124 }
20125 #[no_mangle]
20126 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
20127 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
20128         CResult_SiPrefixBolt11ParseErrorZ {
20129                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20130                         result: Box::into_raw(Box::new(o)),
20131                 },
20132                 result_ok: true,
20133         }
20134 }
20135 #[no_mangle]
20136 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
20137 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
20138         CResult_SiPrefixBolt11ParseErrorZ {
20139                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20140                         err: Box::into_raw(Box::new(e)),
20141                 },
20142                 result_ok: false,
20143         }
20144 }
20145 /// Checks if the given object is currently in the success state
20146 #[no_mangle]
20147 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
20148         o.result_ok
20149 }
20150 #[no_mangle]
20151 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
20152 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
20153 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
20154         fn drop(&mut self) {
20155                 if self.result_ok {
20156                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20157                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20158                         }
20159                 } else {
20160                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20161                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20162                         }
20163                 }
20164         }
20165 }
20166 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
20167         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20168                 let contents = if o.result_ok {
20169                         let result = unsafe { o.contents.result };
20170                         unsafe { o.contents.result = core::ptr::null_mut() };
20171                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
20172                 } else {
20173                         let err = unsafe { o.contents.err };
20174                         unsafe { o.contents.err = core::ptr::null_mut(); }
20175                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
20176                 };
20177                 Self {
20178                         contents,
20179                         result_ok: o.result_ok,
20180                 }
20181         }
20182 }
20183 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
20184         fn clone(&self) -> Self {
20185                 if self.result_ok {
20186                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20187                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
20188                         } }
20189                 } else {
20190                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20191                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20192                         } }
20193                 }
20194         }
20195 }
20196 #[no_mangle]
20197 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
20198 /// but with all dynamically-allocated buffers duplicated in new buffers.
20199 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
20200 #[repr(C)]
20201 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
20202 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20203         /// A pointer to the contents in the success state.
20204         /// Reading from this pointer when `result_ok` is not set is undefined.
20205         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20206         /// A pointer to the contents in the error state.
20207         /// Reading from this pointer when `result_ok` is set is undefined.
20208         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
20209 }
20210 #[repr(C)]
20211 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
20212 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
20213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20214 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20215         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
20216         /// `err` or `result` depending on the state of `result_ok`.
20217         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
20218         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
20219         pub result_ok: bool,
20220 }
20221 #[no_mangle]
20222 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
20223 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20224         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20225                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20226                         result: Box::into_raw(Box::new(o)),
20227                 },
20228                 result_ok: true,
20229         }
20230 }
20231 #[no_mangle]
20232 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
20233 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20234         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20235                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20236                         err: Box::into_raw(Box::new(e)),
20237                 },
20238                 result_ok: false,
20239         }
20240 }
20241 /// Checks if the given object is currently in the success state
20242 #[no_mangle]
20243 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
20244         o.result_ok
20245 }
20246 #[no_mangle]
20247 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
20248 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
20249 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20250         fn drop(&mut self) {
20251                 if self.result_ok {
20252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20254                         }
20255                 } else {
20256                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20257                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20258                         }
20259                 }
20260         }
20261 }
20262 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20263         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
20264                 let contents = if o.result_ok {
20265                         let result = unsafe { o.contents.result };
20266                         unsafe { o.contents.result = core::ptr::null_mut() };
20267                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
20268                 } else {
20269                         let err = unsafe { o.contents.err };
20270                         unsafe { o.contents.err = core::ptr::null_mut(); }
20271                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
20272                 };
20273                 Self {
20274                         contents,
20275                         result_ok: o.result_ok,
20276                 }
20277         }
20278 }
20279 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20280         fn clone(&self) -> Self {
20281                 if self.result_ok {
20282                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20283                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20284                         } }
20285                 } else {
20286                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20287                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
20288                         } }
20289                 }
20290         }
20291 }
20292 #[no_mangle]
20293 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
20294 /// but with all dynamically-allocated buffers duplicated in new buffers.
20295 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
20296 #[repr(C)]
20297 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
20298 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20299         /// A pointer to the contents in the success state.
20300         /// Reading from this pointer when `result_ok` is not set is undefined.
20301         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
20302         /// A pointer to the contents in the error state.
20303         /// Reading from this pointer when `result_ok` is set is undefined.
20304         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20305 }
20306 #[repr(C)]
20307 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
20308 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20309 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20310 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20311         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
20312         /// `err` or `result` depending on the state of `result_ok`.
20313         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
20314         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
20315         pub result_ok: bool,
20316 }
20317 #[no_mangle]
20318 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
20319 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20320         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20321                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20322                         result: Box::into_raw(Box::new(o)),
20323                 },
20324                 result_ok: true,
20325         }
20326 }
20327 #[no_mangle]
20328 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
20329 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20330         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20331                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20332                         err: Box::into_raw(Box::new(e)),
20333                 },
20334                 result_ok: false,
20335         }
20336 }
20337 /// Checks if the given object is currently in the success state
20338 #[no_mangle]
20339 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
20340         o.result_ok
20341 }
20342 #[no_mangle]
20343 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
20344 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
20345 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20346         fn drop(&mut self) {
20347                 if self.result_ok {
20348                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20349                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20350                         }
20351                 } else {
20352                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20353                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20354                         }
20355                 }
20356         }
20357 }
20358 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20359         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20360                 let contents = if o.result_ok {
20361                         let result = unsafe { o.contents.result };
20362                         unsafe { o.contents.result = core::ptr::null_mut() };
20363                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
20364                 } else {
20365                         let err = unsafe { o.contents.err };
20366                         unsafe { o.contents.err = core::ptr::null_mut(); }
20367                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
20368                 };
20369                 Self {
20370                         contents,
20371                         result_ok: o.result_ok,
20372                 }
20373         }
20374 }
20375 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20376         fn clone(&self) -> Self {
20377                 if self.result_ok {
20378                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20379                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
20380                         } }
20381                 } else {
20382                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20383                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20384                         } }
20385                 }
20386         }
20387 }
20388 #[no_mangle]
20389 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
20390 /// but with all dynamically-allocated buffers duplicated in new buffers.
20391 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
20392 #[repr(C)]
20393 /// A tuple of 3 elements. See the individual fields for the types contained.
20394 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20395         /// The element at position 0
20396         pub a: crate::lightning_invoice::RawBolt11Invoice,
20397         /// The element at position 1
20398         pub b: crate::c_types::ThirtyTwoBytes,
20399         /// The element at position 2
20400         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
20401 }
20402 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20403         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
20404                 Self {
20405                         a: tup.0,
20406                         b: tup.1,
20407                         c: tup.2,
20408                 }
20409         }
20410 }
20411 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20412         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
20413                 (self.a, self.b, self.c)
20414         }
20415 }
20416 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20417         fn clone(&self) -> Self {
20418                 Self {
20419                         a: Clone::clone(&self.a),
20420                         b: Clone::clone(&self.b),
20421                         c: Clone::clone(&self.c),
20422                 }
20423         }
20424 }
20425 #[no_mangle]
20426 /// Creates a new tuple which has the same data as `orig`
20427 /// but with all dynamically-allocated buffers duplicated in new buffers.
20428 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
20429 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
20430 #[no_mangle]
20431 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 {
20432         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
20433 }
20434
20435 #[no_mangle]
20436 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
20437 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
20438 #[repr(C)]
20439 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
20440 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
20441         /// A pointer to the contents in the success state.
20442         /// Reading from this pointer when `result_ok` is not set is undefined.
20443         pub result: *mut crate::lightning_invoice::PayeePubKey,
20444         /// A pointer to the contents in the error state.
20445         /// Reading from this pointer when `result_ok` is set is undefined.
20446         pub err: *mut crate::c_types::Secp256k1Error,
20447 }
20448 #[repr(C)]
20449 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
20450 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
20451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20452 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
20453         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
20454         /// `err` or `result` depending on the state of `result_ok`.
20455         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
20456         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
20457         pub result_ok: bool,
20458 }
20459 #[no_mangle]
20460 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
20461 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
20462         CResult_PayeePubKeySecp256k1ErrorZ {
20463                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20464                         result: Box::into_raw(Box::new(o)),
20465                 },
20466                 result_ok: true,
20467         }
20468 }
20469 #[no_mangle]
20470 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
20471 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
20472         CResult_PayeePubKeySecp256k1ErrorZ {
20473                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20474                         err: Box::into_raw(Box::new(e)),
20475                 },
20476                 result_ok: false,
20477         }
20478 }
20479 /// Checks if the given object is currently in the success state
20480 #[no_mangle]
20481 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
20482         o.result_ok
20483 }
20484 #[no_mangle]
20485 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
20486 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
20487 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
20488         fn drop(&mut self) {
20489                 if self.result_ok {
20490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20492                         }
20493                 } else {
20494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20496                         }
20497                 }
20498         }
20499 }
20500 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
20501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
20502                 let contents = if o.result_ok {
20503                         let result = unsafe { o.contents.result };
20504                         unsafe { o.contents.result = core::ptr::null_mut() };
20505                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
20506                 } else {
20507                         let err = unsafe { o.contents.err };
20508                         unsafe { o.contents.err = core::ptr::null_mut(); }
20509                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
20510                 };
20511                 Self {
20512                         contents,
20513                         result_ok: o.result_ok,
20514                 }
20515         }
20516 }
20517 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
20518         fn clone(&self) -> Self {
20519                 if self.result_ok {
20520                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20521                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
20522                         } }
20523                 } else {
20524                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20525                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20526                         } }
20527                 }
20528         }
20529 }
20530 #[no_mangle]
20531 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
20532 /// but with all dynamically-allocated buffers duplicated in new buffers.
20533 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
20534 #[repr(C)]
20535 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
20536 /// This corresponds to std::vector in C++
20537 pub struct CVec_PrivateRouteZ {
20538         /// The elements in the array.
20539         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20540         pub data: *mut crate::lightning_invoice::PrivateRoute,
20541         /// The number of elements pointed to by `data`.
20542         pub datalen: usize
20543 }
20544 impl CVec_PrivateRouteZ {
20545         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
20546                 if self.datalen == 0 { return Vec::new(); }
20547                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20548                 self.data = core::ptr::null_mut();
20549                 self.datalen = 0;
20550                 ret
20551         }
20552         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
20553                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20554         }
20555 }
20556 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
20557         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
20558                 let datalen = v.len();
20559                 let data = Box::into_raw(v.into_boxed_slice());
20560                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20561         }
20562 }
20563 #[no_mangle]
20564 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20565 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
20566 impl Drop for CVec_PrivateRouteZ {
20567         fn drop(&mut self) {
20568                 if self.datalen == 0 { return; }
20569                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20570         }
20571 }
20572 impl Clone for CVec_PrivateRouteZ {
20573         fn clone(&self) -> Self {
20574                 let mut res = Vec::new();
20575                 if self.datalen == 0 { return Self::from(res); }
20576                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20577                 Self::from(res)
20578         }
20579 }
20580 #[repr(C)]
20581 /// The contents of CResult_PositiveTimestampCreationErrorZ
20582 pub union CResult_PositiveTimestampCreationErrorZPtr {
20583         /// A pointer to the contents in the success state.
20584         /// Reading from this pointer when `result_ok` is not set is undefined.
20585         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
20586         /// A pointer to the contents in the error state.
20587         /// Reading from this pointer when `result_ok` is set is undefined.
20588         pub err: *mut crate::lightning_invoice::CreationError,
20589 }
20590 #[repr(C)]
20591 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
20592 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
20593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20594 pub struct CResult_PositiveTimestampCreationErrorZ {
20595         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
20596         /// `err` or `result` depending on the state of `result_ok`.
20597         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
20598         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
20599         pub result_ok: bool,
20600 }
20601 #[no_mangle]
20602 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
20603 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
20604         CResult_PositiveTimestampCreationErrorZ {
20605                 contents: CResult_PositiveTimestampCreationErrorZPtr {
20606                         result: Box::into_raw(Box::new(o)),
20607                 },
20608                 result_ok: true,
20609         }
20610 }
20611 #[no_mangle]
20612 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
20613 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
20614         CResult_PositiveTimestampCreationErrorZ {
20615                 contents: CResult_PositiveTimestampCreationErrorZPtr {
20616                         err: Box::into_raw(Box::new(e)),
20617                 },
20618                 result_ok: false,
20619         }
20620 }
20621 /// Checks if the given object is currently in the success state
20622 #[no_mangle]
20623 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
20624         o.result_ok
20625 }
20626 #[no_mangle]
20627 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
20628 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
20629 impl Drop for CResult_PositiveTimestampCreationErrorZ {
20630         fn drop(&mut self) {
20631                 if self.result_ok {
20632                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20633                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20634                         }
20635                 } else {
20636                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20637                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20638                         }
20639                 }
20640         }
20641 }
20642 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
20643         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
20644                 let contents = if o.result_ok {
20645                         let result = unsafe { o.contents.result };
20646                         unsafe { o.contents.result = core::ptr::null_mut() };
20647                         CResult_PositiveTimestampCreationErrorZPtr { result }
20648                 } else {
20649                         let err = unsafe { o.contents.err };
20650                         unsafe { o.contents.err = core::ptr::null_mut(); }
20651                         CResult_PositiveTimestampCreationErrorZPtr { err }
20652                 };
20653                 Self {
20654                         contents,
20655                         result_ok: o.result_ok,
20656                 }
20657         }
20658 }
20659 impl Clone for CResult_PositiveTimestampCreationErrorZ {
20660         fn clone(&self) -> Self {
20661                 if self.result_ok {
20662                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
20663                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
20664                         } }
20665                 } else {
20666                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
20667                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20668                         } }
20669                 }
20670         }
20671 }
20672 #[no_mangle]
20673 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
20674 /// but with all dynamically-allocated buffers duplicated in new buffers.
20675 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
20676 #[repr(C)]
20677 /// The contents of CResult_NoneBolt11SemanticErrorZ
20678 pub union CResult_NoneBolt11SemanticErrorZPtr {
20679         /// Note that this value is always NULL, as there are no contents in the OK variant
20680         pub result: *mut core::ffi::c_void,
20681         /// A pointer to the contents in the error state.
20682         /// Reading from this pointer when `result_ok` is set is undefined.
20683         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20684 }
20685 #[repr(C)]
20686 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
20687 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
20688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20689 pub struct CResult_NoneBolt11SemanticErrorZ {
20690         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
20691         /// `err` or `result` depending on the state of `result_ok`.
20692         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
20693         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
20694         pub result_ok: bool,
20695 }
20696 #[no_mangle]
20697 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
20698 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
20699         CResult_NoneBolt11SemanticErrorZ {
20700                 contents: CResult_NoneBolt11SemanticErrorZPtr {
20701                         result: core::ptr::null_mut(),
20702                 },
20703                 result_ok: true,
20704         }
20705 }
20706 #[no_mangle]
20707 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
20708 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
20709         CResult_NoneBolt11SemanticErrorZ {
20710                 contents: CResult_NoneBolt11SemanticErrorZPtr {
20711                         err: Box::into_raw(Box::new(e)),
20712                 },
20713                 result_ok: false,
20714         }
20715 }
20716 /// Checks if the given object is currently in the success state
20717 #[no_mangle]
20718 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
20719         o.result_ok
20720 }
20721 #[no_mangle]
20722 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
20723 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
20724 impl Drop for CResult_NoneBolt11SemanticErrorZ {
20725         fn drop(&mut self) {
20726                 if self.result_ok {
20727                 } else {
20728                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20729                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20730                         }
20731                 }
20732         }
20733 }
20734 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
20735         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
20736                 let contents = if o.result_ok {
20737                         let _ = unsafe { Box::from_raw(o.contents.result) };
20738                         o.contents.result = core::ptr::null_mut();
20739                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
20740                 } else {
20741                         let err = unsafe { o.contents.err };
20742                         unsafe { o.contents.err = core::ptr::null_mut(); }
20743                         CResult_NoneBolt11SemanticErrorZPtr { err }
20744                 };
20745                 Self {
20746                         contents,
20747                         result_ok: o.result_ok,
20748                 }
20749         }
20750 }
20751 impl Clone for CResult_NoneBolt11SemanticErrorZ {
20752         fn clone(&self) -> Self {
20753                 if self.result_ok {
20754                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
20755                                 result: core::ptr::null_mut()
20756                         } }
20757                 } else {
20758                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
20759                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
20760                         } }
20761                 }
20762         }
20763 }
20764 #[no_mangle]
20765 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
20766 /// but with all dynamically-allocated buffers duplicated in new buffers.
20767 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
20768 #[repr(C)]
20769 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
20770 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20771         /// A pointer to the contents in the success state.
20772         /// Reading from this pointer when `result_ok` is not set is undefined.
20773         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20774         /// A pointer to the contents in the error state.
20775         /// Reading from this pointer when `result_ok` is set is undefined.
20776         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20777 }
20778 #[repr(C)]
20779 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
20780 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
20781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20782 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20783         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
20784         /// `err` or `result` depending on the state of `result_ok`.
20785         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
20786         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
20787         pub result_ok: bool,
20788 }
20789 #[no_mangle]
20790 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
20791 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20792         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20793                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20794                         result: Box::into_raw(Box::new(o)),
20795                 },
20796                 result_ok: true,
20797         }
20798 }
20799 #[no_mangle]
20800 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
20801 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20802         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20803                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20804                         err: Box::into_raw(Box::new(e)),
20805                 },
20806                 result_ok: false,
20807         }
20808 }
20809 /// Checks if the given object is currently in the success state
20810 #[no_mangle]
20811 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
20812         o.result_ok
20813 }
20814 #[no_mangle]
20815 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
20816 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
20817 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20818         fn drop(&mut self) {
20819                 if self.result_ok {
20820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20822                         }
20823                 } else {
20824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20826                         }
20827                 }
20828         }
20829 }
20830 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20831         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
20832                 let contents = if o.result_ok {
20833                         let result = unsafe { o.contents.result };
20834                         unsafe { o.contents.result = core::ptr::null_mut() };
20835                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
20836                 } else {
20837                         let err = unsafe { o.contents.err };
20838                         unsafe { o.contents.err = core::ptr::null_mut(); }
20839                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
20840                 };
20841                 Self {
20842                         contents,
20843                         result_ok: o.result_ok,
20844                 }
20845         }
20846 }
20847 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20848         fn clone(&self) -> Self {
20849                 if self.result_ok {
20850                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20851                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20852                         } }
20853                 } else {
20854                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20855                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
20856                         } }
20857                 }
20858         }
20859 }
20860 #[no_mangle]
20861 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
20862 /// but with all dynamically-allocated buffers duplicated in new buffers.
20863 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
20864 #[repr(C)]
20865 /// The contents of CResult_DescriptionCreationErrorZ
20866 pub union CResult_DescriptionCreationErrorZPtr {
20867         /// A pointer to the contents in the success state.
20868         /// Reading from this pointer when `result_ok` is not set is undefined.
20869         pub result: *mut crate::lightning_invoice::Description,
20870         /// A pointer to the contents in the error state.
20871         /// Reading from this pointer when `result_ok` is set is undefined.
20872         pub err: *mut crate::lightning_invoice::CreationError,
20873 }
20874 #[repr(C)]
20875 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
20876 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
20877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20878 pub struct CResult_DescriptionCreationErrorZ {
20879         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
20880         /// `err` or `result` depending on the state of `result_ok`.
20881         pub contents: CResult_DescriptionCreationErrorZPtr,
20882         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
20883         pub result_ok: bool,
20884 }
20885 #[no_mangle]
20886 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
20887 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
20888         CResult_DescriptionCreationErrorZ {
20889                 contents: CResult_DescriptionCreationErrorZPtr {
20890                         result: Box::into_raw(Box::new(o)),
20891                 },
20892                 result_ok: true,
20893         }
20894 }
20895 #[no_mangle]
20896 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
20897 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
20898         CResult_DescriptionCreationErrorZ {
20899                 contents: CResult_DescriptionCreationErrorZPtr {
20900                         err: Box::into_raw(Box::new(e)),
20901                 },
20902                 result_ok: false,
20903         }
20904 }
20905 /// Checks if the given object is currently in the success state
20906 #[no_mangle]
20907 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
20908         o.result_ok
20909 }
20910 #[no_mangle]
20911 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
20912 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
20913 impl Drop for CResult_DescriptionCreationErrorZ {
20914         fn drop(&mut self) {
20915                 if self.result_ok {
20916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20918                         }
20919                 } else {
20920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20922                         }
20923                 }
20924         }
20925 }
20926 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
20927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
20928                 let contents = if o.result_ok {
20929                         let result = unsafe { o.contents.result };
20930                         unsafe { o.contents.result = core::ptr::null_mut() };
20931                         CResult_DescriptionCreationErrorZPtr { result }
20932                 } else {
20933                         let err = unsafe { o.contents.err };
20934                         unsafe { o.contents.err = core::ptr::null_mut(); }
20935                         CResult_DescriptionCreationErrorZPtr { err }
20936                 };
20937                 Self {
20938                         contents,
20939                         result_ok: o.result_ok,
20940                 }
20941         }
20942 }
20943 impl Clone for CResult_DescriptionCreationErrorZ {
20944         fn clone(&self) -> Self {
20945                 if self.result_ok {
20946                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
20947                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
20948                         } }
20949                 } else {
20950                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
20951                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20952                         } }
20953                 }
20954         }
20955 }
20956 #[no_mangle]
20957 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
20958 /// but with all dynamically-allocated buffers duplicated in new buffers.
20959 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
20960 #[repr(C)]
20961 /// The contents of CResult_PrivateRouteCreationErrorZ
20962 pub union CResult_PrivateRouteCreationErrorZPtr {
20963         /// A pointer to the contents in the success state.
20964         /// Reading from this pointer when `result_ok` is not set is undefined.
20965         pub result: *mut crate::lightning_invoice::PrivateRoute,
20966         /// A pointer to the contents in the error state.
20967         /// Reading from this pointer when `result_ok` is set is undefined.
20968         pub err: *mut crate::lightning_invoice::CreationError,
20969 }
20970 #[repr(C)]
20971 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
20972 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
20973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20974 pub struct CResult_PrivateRouteCreationErrorZ {
20975         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
20976         /// `err` or `result` depending on the state of `result_ok`.
20977         pub contents: CResult_PrivateRouteCreationErrorZPtr,
20978         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
20979         pub result_ok: bool,
20980 }
20981 #[no_mangle]
20982 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
20983 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
20984         CResult_PrivateRouteCreationErrorZ {
20985                 contents: CResult_PrivateRouteCreationErrorZPtr {
20986                         result: Box::into_raw(Box::new(o)),
20987                 },
20988                 result_ok: true,
20989         }
20990 }
20991 #[no_mangle]
20992 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
20993 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
20994         CResult_PrivateRouteCreationErrorZ {
20995                 contents: CResult_PrivateRouteCreationErrorZPtr {
20996                         err: Box::into_raw(Box::new(e)),
20997                 },
20998                 result_ok: false,
20999         }
21000 }
21001 /// Checks if the given object is currently in the success state
21002 #[no_mangle]
21003 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
21004         o.result_ok
21005 }
21006 #[no_mangle]
21007 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
21008 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
21009 impl Drop for CResult_PrivateRouteCreationErrorZ {
21010         fn drop(&mut self) {
21011                 if self.result_ok {
21012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21014                         }
21015                 } else {
21016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21018                         }
21019                 }
21020         }
21021 }
21022 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
21023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
21024                 let contents = if o.result_ok {
21025                         let result = unsafe { o.contents.result };
21026                         unsafe { o.contents.result = core::ptr::null_mut() };
21027                         CResult_PrivateRouteCreationErrorZPtr { result }
21028                 } else {
21029                         let err = unsafe { o.contents.err };
21030                         unsafe { o.contents.err = core::ptr::null_mut(); }
21031                         CResult_PrivateRouteCreationErrorZPtr { err }
21032                 };
21033                 Self {
21034                         contents,
21035                         result_ok: o.result_ok,
21036                 }
21037         }
21038 }
21039 impl Clone for CResult_PrivateRouteCreationErrorZ {
21040         fn clone(&self) -> Self {
21041                 if self.result_ok {
21042                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
21043                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
21044                         } }
21045                 } else {
21046                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
21047                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21048                         } }
21049                 }
21050         }
21051 }
21052 #[no_mangle]
21053 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
21054 /// but with all dynamically-allocated buffers duplicated in new buffers.
21055 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
21056 #[repr(C)]
21057 /// The contents of CResult_OutPointDecodeErrorZ
21058 pub union CResult_OutPointDecodeErrorZPtr {
21059         /// A pointer to the contents in the success state.
21060         /// Reading from this pointer when `result_ok` is not set is undefined.
21061         pub result: *mut crate::lightning::chain::transaction::OutPoint,
21062         /// A pointer to the contents in the error state.
21063         /// Reading from this pointer when `result_ok` is set is undefined.
21064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21065 }
21066 #[repr(C)]
21067 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
21068 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21070 pub struct CResult_OutPointDecodeErrorZ {
21071         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
21072         /// `err` or `result` depending on the state of `result_ok`.
21073         pub contents: CResult_OutPointDecodeErrorZPtr,
21074         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
21075         pub result_ok: bool,
21076 }
21077 #[no_mangle]
21078 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
21079 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
21080         CResult_OutPointDecodeErrorZ {
21081                 contents: CResult_OutPointDecodeErrorZPtr {
21082                         result: Box::into_raw(Box::new(o)),
21083                 },
21084                 result_ok: true,
21085         }
21086 }
21087 #[no_mangle]
21088 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
21089 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
21090         CResult_OutPointDecodeErrorZ {
21091                 contents: CResult_OutPointDecodeErrorZPtr {
21092                         err: Box::into_raw(Box::new(e)),
21093                 },
21094                 result_ok: false,
21095         }
21096 }
21097 /// Checks if the given object is currently in the success state
21098 #[no_mangle]
21099 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
21100         o.result_ok
21101 }
21102 #[no_mangle]
21103 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
21104 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
21105 impl Drop for CResult_OutPointDecodeErrorZ {
21106         fn drop(&mut self) {
21107                 if self.result_ok {
21108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21110                         }
21111                 } else {
21112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21114                         }
21115                 }
21116         }
21117 }
21118 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
21119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
21120                 let contents = if o.result_ok {
21121                         let result = unsafe { o.contents.result };
21122                         unsafe { o.contents.result = core::ptr::null_mut() };
21123                         CResult_OutPointDecodeErrorZPtr { result }
21124                 } else {
21125                         let err = unsafe { o.contents.err };
21126                         unsafe { o.contents.err = core::ptr::null_mut(); }
21127                         CResult_OutPointDecodeErrorZPtr { err }
21128                 };
21129                 Self {
21130                         contents,
21131                         result_ok: o.result_ok,
21132                 }
21133         }
21134 }
21135 impl Clone for CResult_OutPointDecodeErrorZ {
21136         fn clone(&self) -> Self {
21137                 if self.result_ok {
21138                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
21139                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
21140                         } }
21141                 } else {
21142                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
21143                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21144                         } }
21145                 }
21146         }
21147 }
21148 #[no_mangle]
21149 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
21150 /// but with all dynamically-allocated buffers duplicated in new buffers.
21151 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
21152 #[repr(C)]
21153 /// The contents of CResult_BigSizeDecodeErrorZ
21154 pub union CResult_BigSizeDecodeErrorZPtr {
21155         /// A pointer to the contents in the success state.
21156         /// Reading from this pointer when `result_ok` is not set is undefined.
21157         pub result: *mut crate::lightning::util::ser::BigSize,
21158         /// A pointer to the contents in the error state.
21159         /// Reading from this pointer when `result_ok` is set is undefined.
21160         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21161 }
21162 #[repr(C)]
21163 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
21164 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
21165 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21166 pub struct CResult_BigSizeDecodeErrorZ {
21167         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
21168         /// `err` or `result` depending on the state of `result_ok`.
21169         pub contents: CResult_BigSizeDecodeErrorZPtr,
21170         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
21171         pub result_ok: bool,
21172 }
21173 #[no_mangle]
21174 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
21175 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
21176         CResult_BigSizeDecodeErrorZ {
21177                 contents: CResult_BigSizeDecodeErrorZPtr {
21178                         result: Box::into_raw(Box::new(o)),
21179                 },
21180                 result_ok: true,
21181         }
21182 }
21183 #[no_mangle]
21184 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
21185 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
21186         CResult_BigSizeDecodeErrorZ {
21187                 contents: CResult_BigSizeDecodeErrorZPtr {
21188                         err: Box::into_raw(Box::new(e)),
21189                 },
21190                 result_ok: false,
21191         }
21192 }
21193 /// Checks if the given object is currently in the success state
21194 #[no_mangle]
21195 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
21196         o.result_ok
21197 }
21198 #[no_mangle]
21199 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
21200 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
21201 impl Drop for CResult_BigSizeDecodeErrorZ {
21202         fn drop(&mut self) {
21203                 if self.result_ok {
21204                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21205                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21206                         }
21207                 } else {
21208                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21209                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21210                         }
21211                 }
21212         }
21213 }
21214 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
21215         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
21216                 let contents = if o.result_ok {
21217                         let result = unsafe { o.contents.result };
21218                         unsafe { o.contents.result = core::ptr::null_mut() };
21219                         CResult_BigSizeDecodeErrorZPtr { result }
21220                 } else {
21221                         let err = unsafe { o.contents.err };
21222                         unsafe { o.contents.err = core::ptr::null_mut(); }
21223                         CResult_BigSizeDecodeErrorZPtr { err }
21224                 };
21225                 Self {
21226                         contents,
21227                         result_ok: o.result_ok,
21228                 }
21229         }
21230 }
21231 impl Clone for CResult_BigSizeDecodeErrorZ {
21232         fn clone(&self) -> Self {
21233                 if self.result_ok {
21234                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
21235                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
21236                         } }
21237                 } else {
21238                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
21239                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21240                         } }
21241                 }
21242         }
21243 }
21244 #[no_mangle]
21245 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
21246 /// but with all dynamically-allocated buffers duplicated in new buffers.
21247 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
21248 #[repr(C)]
21249 /// The contents of CResult_HostnameDecodeErrorZ
21250 pub union CResult_HostnameDecodeErrorZPtr {
21251         /// A pointer to the contents in the success state.
21252         /// Reading from this pointer when `result_ok` is not set is undefined.
21253         pub result: *mut crate::lightning::util::ser::Hostname,
21254         /// A pointer to the contents in the error state.
21255         /// Reading from this pointer when `result_ok` is set is undefined.
21256         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21257 }
21258 #[repr(C)]
21259 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
21260 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
21261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21262 pub struct CResult_HostnameDecodeErrorZ {
21263         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
21264         /// `err` or `result` depending on the state of `result_ok`.
21265         pub contents: CResult_HostnameDecodeErrorZPtr,
21266         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
21267         pub result_ok: bool,
21268 }
21269 #[no_mangle]
21270 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
21271 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
21272         CResult_HostnameDecodeErrorZ {
21273                 contents: CResult_HostnameDecodeErrorZPtr {
21274                         result: Box::into_raw(Box::new(o)),
21275                 },
21276                 result_ok: true,
21277         }
21278 }
21279 #[no_mangle]
21280 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
21281 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
21282         CResult_HostnameDecodeErrorZ {
21283                 contents: CResult_HostnameDecodeErrorZPtr {
21284                         err: Box::into_raw(Box::new(e)),
21285                 },
21286                 result_ok: false,
21287         }
21288 }
21289 /// Checks if the given object is currently in the success state
21290 #[no_mangle]
21291 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
21292         o.result_ok
21293 }
21294 #[no_mangle]
21295 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
21296 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
21297 impl Drop for CResult_HostnameDecodeErrorZ {
21298         fn drop(&mut self) {
21299                 if self.result_ok {
21300                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21301                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21302                         }
21303                 } else {
21304                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21305                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21306                         }
21307                 }
21308         }
21309 }
21310 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
21311         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
21312                 let contents = if o.result_ok {
21313                         let result = unsafe { o.contents.result };
21314                         unsafe { o.contents.result = core::ptr::null_mut() };
21315                         CResult_HostnameDecodeErrorZPtr { result }
21316                 } else {
21317                         let err = unsafe { o.contents.err };
21318                         unsafe { o.contents.err = core::ptr::null_mut(); }
21319                         CResult_HostnameDecodeErrorZPtr { err }
21320                 };
21321                 Self {
21322                         contents,
21323                         result_ok: o.result_ok,
21324                 }
21325         }
21326 }
21327 impl Clone for CResult_HostnameDecodeErrorZ {
21328         fn clone(&self) -> Self {
21329                 if self.result_ok {
21330                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
21331                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
21332                         } }
21333                 } else {
21334                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
21335                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21336                         } }
21337                 }
21338         }
21339 }
21340 #[no_mangle]
21341 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
21342 /// but with all dynamically-allocated buffers duplicated in new buffers.
21343 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
21344 #[repr(C)]
21345 /// The contents of CResult_TransactionU16LenLimitedNoneZ
21346 pub union CResult_TransactionU16LenLimitedNoneZPtr {
21347         /// A pointer to the contents in the success state.
21348         /// Reading from this pointer when `result_ok` is not set is undefined.
21349         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21350         /// Note that this value is always NULL, as there are no contents in the Err variant
21351         pub err: *mut core::ffi::c_void,
21352 }
21353 #[repr(C)]
21354 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
21355 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
21356 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21357 pub struct CResult_TransactionU16LenLimitedNoneZ {
21358         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
21359         /// `err` or `result` depending on the state of `result_ok`.
21360         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
21361         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
21362         pub result_ok: bool,
21363 }
21364 #[no_mangle]
21365 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
21366 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
21367         CResult_TransactionU16LenLimitedNoneZ {
21368                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21369                         result: Box::into_raw(Box::new(o)),
21370                 },
21371                 result_ok: true,
21372         }
21373 }
21374 #[no_mangle]
21375 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
21376 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
21377         CResult_TransactionU16LenLimitedNoneZ {
21378                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21379                         err: core::ptr::null_mut(),
21380                 },
21381                 result_ok: false,
21382         }
21383 }
21384 /// Checks if the given object is currently in the success state
21385 #[no_mangle]
21386 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
21387         o.result_ok
21388 }
21389 #[no_mangle]
21390 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
21391 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
21392 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
21393         fn drop(&mut self) {
21394                 if self.result_ok {
21395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21397                         }
21398                 } else {
21399                 }
21400         }
21401 }
21402 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
21403         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
21404                 let contents = if o.result_ok {
21405                         let result = unsafe { o.contents.result };
21406                         unsafe { o.contents.result = core::ptr::null_mut() };
21407                         CResult_TransactionU16LenLimitedNoneZPtr { result }
21408                 } else {
21409                         let _ = unsafe { Box::from_raw(o.contents.err) };
21410                         o.contents.err = core::ptr::null_mut();
21411                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
21412                 };
21413                 Self {
21414                         contents,
21415                         result_ok: o.result_ok,
21416                 }
21417         }
21418 }
21419 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
21420         fn clone(&self) -> Self {
21421                 if self.result_ok {
21422                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21423                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21424                         } }
21425                 } else {
21426                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21427                                 err: core::ptr::null_mut()
21428                         } }
21429                 }
21430         }
21431 }
21432 #[no_mangle]
21433 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
21434 /// but with all dynamically-allocated buffers duplicated in new buffers.
21435 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
21436 #[repr(C)]
21437 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
21438 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21439         /// A pointer to the contents in the success state.
21440         /// Reading from this pointer when `result_ok` is not set is undefined.
21441         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21442         /// A pointer to the contents in the error state.
21443         /// Reading from this pointer when `result_ok` is set is undefined.
21444         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21445 }
21446 #[repr(C)]
21447 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
21448 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
21449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21450 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
21451         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
21452         /// `err` or `result` depending on the state of `result_ok`.
21453         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
21454         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
21455         pub result_ok: bool,
21456 }
21457 #[no_mangle]
21458 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
21459 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21460         CResult_TransactionU16LenLimitedDecodeErrorZ {
21461                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21462                         result: Box::into_raw(Box::new(o)),
21463                 },
21464                 result_ok: true,
21465         }
21466 }
21467 #[no_mangle]
21468 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
21469 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21470         CResult_TransactionU16LenLimitedDecodeErrorZ {
21471                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21472                         err: Box::into_raw(Box::new(e)),
21473                 },
21474                 result_ok: false,
21475         }
21476 }
21477 /// Checks if the given object is currently in the success state
21478 #[no_mangle]
21479 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
21480         o.result_ok
21481 }
21482 #[no_mangle]
21483 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
21484 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
21485 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
21486         fn drop(&mut self) {
21487                 if self.result_ok {
21488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21490                         }
21491                 } else {
21492                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21493                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21494                         }
21495                 }
21496         }
21497 }
21498 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
21499         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
21500                 let contents = if o.result_ok {
21501                         let result = unsafe { o.contents.result };
21502                         unsafe { o.contents.result = core::ptr::null_mut() };
21503                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
21504                 } else {
21505                         let err = unsafe { o.contents.err };
21506                         unsafe { o.contents.err = core::ptr::null_mut(); }
21507                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
21508                 };
21509                 Self {
21510                         contents,
21511                         result_ok: o.result_ok,
21512                 }
21513         }
21514 }
21515 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
21516         fn clone(&self) -> Self {
21517                 if self.result_ok {
21518                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21519                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21520                         } }
21521                 } else {
21522                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21523                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21524                         } }
21525                 }
21526         }
21527 }
21528 #[no_mangle]
21529 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
21530 /// but with all dynamically-allocated buffers duplicated in new buffers.
21531 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
21532 #[repr(C)]
21533 /// The contents of CResult_UntrustedStringDecodeErrorZ
21534 pub union CResult_UntrustedStringDecodeErrorZPtr {
21535         /// A pointer to the contents in the success state.
21536         /// Reading from this pointer when `result_ok` is not set is undefined.
21537         pub result: *mut crate::lightning::util::string::UntrustedString,
21538         /// A pointer to the contents in the error state.
21539         /// Reading from this pointer when `result_ok` is set is undefined.
21540         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21541 }
21542 #[repr(C)]
21543 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
21544 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
21545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21546 pub struct CResult_UntrustedStringDecodeErrorZ {
21547         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
21548         /// `err` or `result` depending on the state of `result_ok`.
21549         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
21550         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
21551         pub result_ok: bool,
21552 }
21553 #[no_mangle]
21554 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
21555 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
21556         CResult_UntrustedStringDecodeErrorZ {
21557                 contents: CResult_UntrustedStringDecodeErrorZPtr {
21558                         result: Box::into_raw(Box::new(o)),
21559                 },
21560                 result_ok: true,
21561         }
21562 }
21563 #[no_mangle]
21564 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
21565 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
21566         CResult_UntrustedStringDecodeErrorZ {
21567                 contents: CResult_UntrustedStringDecodeErrorZPtr {
21568                         err: Box::into_raw(Box::new(e)),
21569                 },
21570                 result_ok: false,
21571         }
21572 }
21573 /// Checks if the given object is currently in the success state
21574 #[no_mangle]
21575 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
21576         o.result_ok
21577 }
21578 #[no_mangle]
21579 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
21580 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
21581 impl Drop for CResult_UntrustedStringDecodeErrorZ {
21582         fn drop(&mut self) {
21583                 if self.result_ok {
21584                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21585                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21586                         }
21587                 } else {
21588                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21589                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21590                         }
21591                 }
21592         }
21593 }
21594 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
21595         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
21596                 let contents = if o.result_ok {
21597                         let result = unsafe { o.contents.result };
21598                         unsafe { o.contents.result = core::ptr::null_mut() };
21599                         CResult_UntrustedStringDecodeErrorZPtr { result }
21600                 } else {
21601                         let err = unsafe { o.contents.err };
21602                         unsafe { o.contents.err = core::ptr::null_mut(); }
21603                         CResult_UntrustedStringDecodeErrorZPtr { err }
21604                 };
21605                 Self {
21606                         contents,
21607                         result_ok: o.result_ok,
21608                 }
21609         }
21610 }
21611 impl Clone for CResult_UntrustedStringDecodeErrorZ {
21612         fn clone(&self) -> Self {
21613                 if self.result_ok {
21614                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
21615                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
21616                         } }
21617                 } else {
21618                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
21619                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21620                         } }
21621                 }
21622         }
21623 }
21624 #[no_mangle]
21625 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
21626 /// but with all dynamically-allocated buffers duplicated in new buffers.
21627 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
21628 #[repr(C)]
21629 /// The contents of CResult_ReceiveTlvsDecodeErrorZ
21630 pub union CResult_ReceiveTlvsDecodeErrorZPtr {
21631         /// A pointer to the contents in the success state.
21632         /// Reading from this pointer when `result_ok` is not set is undefined.
21633         pub result: *mut crate::lightning::blinded_path::payment::ReceiveTlvs,
21634         /// A pointer to the contents in the error state.
21635         /// Reading from this pointer when `result_ok` is set is undefined.
21636         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21637 }
21638 #[repr(C)]
21639 /// A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation,
21640 /// containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure.
21641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21642 pub struct CResult_ReceiveTlvsDecodeErrorZ {
21643         /// The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either
21644         /// `err` or `result` depending on the state of `result_ok`.
21645         pub contents: CResult_ReceiveTlvsDecodeErrorZPtr,
21646         /// Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state.
21647         pub result_ok: bool,
21648 }
21649 #[no_mangle]
21650 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state.
21651 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::ReceiveTlvs) -> CResult_ReceiveTlvsDecodeErrorZ {
21652         CResult_ReceiveTlvsDecodeErrorZ {
21653                 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21654                         result: Box::into_raw(Box::new(o)),
21655                 },
21656                 result_ok: true,
21657         }
21658 }
21659 #[no_mangle]
21660 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state.
21661 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReceiveTlvsDecodeErrorZ {
21662         CResult_ReceiveTlvsDecodeErrorZ {
21663                 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21664                         err: Box::into_raw(Box::new(e)),
21665                 },
21666                 result_ok: false,
21667         }
21668 }
21669 /// Checks if the given object is currently in the success state
21670 #[no_mangle]
21671 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_is_ok(o: &CResult_ReceiveTlvsDecodeErrorZ) -> bool {
21672         o.result_ok
21673 }
21674 #[no_mangle]
21675 /// Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ.
21676 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_free(_res: CResult_ReceiveTlvsDecodeErrorZ) { }
21677 impl Drop for CResult_ReceiveTlvsDecodeErrorZ {
21678         fn drop(&mut self) {
21679                 if self.result_ok {
21680                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21681                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21682                         }
21683                 } else {
21684                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21685                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21686                         }
21687                 }
21688         }
21689 }
21690 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>> for CResult_ReceiveTlvsDecodeErrorZ {
21691         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>) -> Self {
21692                 let contents = if o.result_ok {
21693                         let result = unsafe { o.contents.result };
21694                         unsafe { o.contents.result = core::ptr::null_mut() };
21695                         CResult_ReceiveTlvsDecodeErrorZPtr { result }
21696                 } else {
21697                         let err = unsafe { o.contents.err };
21698                         unsafe { o.contents.err = core::ptr::null_mut(); }
21699                         CResult_ReceiveTlvsDecodeErrorZPtr { err }
21700                 };
21701                 Self {
21702                         contents,
21703                         result_ok: o.result_ok,
21704                 }
21705         }
21706 }
21707 impl Clone for CResult_ReceiveTlvsDecodeErrorZ {
21708         fn clone(&self) -> Self {
21709                 if self.result_ok {
21710                         Self { result_ok: true, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21711                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::ReceiveTlvs>::clone(unsafe { &*self.contents.result })))
21712                         } }
21713                 } else {
21714                         Self { result_ok: false, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21715                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21716                         } }
21717                 }
21718         }
21719 }
21720 #[no_mangle]
21721 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig`
21722 /// but with all dynamically-allocated buffers duplicated in new buffers.
21723 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_clone(orig: &CResult_ReceiveTlvsDecodeErrorZ) -> CResult_ReceiveTlvsDecodeErrorZ { Clone::clone(&orig) }
21724 #[repr(C)]
21725 /// The contents of CResult_PaymentRelayDecodeErrorZ
21726 pub union CResult_PaymentRelayDecodeErrorZPtr {
21727         /// A pointer to the contents in the success state.
21728         /// Reading from this pointer when `result_ok` is not set is undefined.
21729         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
21730         /// A pointer to the contents in the error state.
21731         /// Reading from this pointer when `result_ok` is set is undefined.
21732         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21733 }
21734 #[repr(C)]
21735 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
21736 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
21737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21738 pub struct CResult_PaymentRelayDecodeErrorZ {
21739         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
21740         /// `err` or `result` depending on the state of `result_ok`.
21741         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
21742         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
21743         pub result_ok: bool,
21744 }
21745 #[no_mangle]
21746 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
21747 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
21748         CResult_PaymentRelayDecodeErrorZ {
21749                 contents: CResult_PaymentRelayDecodeErrorZPtr {
21750                         result: Box::into_raw(Box::new(o)),
21751                 },
21752                 result_ok: true,
21753         }
21754 }
21755 #[no_mangle]
21756 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
21757 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
21758         CResult_PaymentRelayDecodeErrorZ {
21759                 contents: CResult_PaymentRelayDecodeErrorZPtr {
21760                         err: Box::into_raw(Box::new(e)),
21761                 },
21762                 result_ok: false,
21763         }
21764 }
21765 /// Checks if the given object is currently in the success state
21766 #[no_mangle]
21767 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
21768         o.result_ok
21769 }
21770 #[no_mangle]
21771 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
21772 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
21773 impl Drop for CResult_PaymentRelayDecodeErrorZ {
21774         fn drop(&mut self) {
21775                 if self.result_ok {
21776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21778                         }
21779                 } else {
21780                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21781                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21782                         }
21783                 }
21784         }
21785 }
21786 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
21787         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
21788                 let contents = if o.result_ok {
21789                         let result = unsafe { o.contents.result };
21790                         unsafe { o.contents.result = core::ptr::null_mut() };
21791                         CResult_PaymentRelayDecodeErrorZPtr { result }
21792                 } else {
21793                         let err = unsafe { o.contents.err };
21794                         unsafe { o.contents.err = core::ptr::null_mut(); }
21795                         CResult_PaymentRelayDecodeErrorZPtr { err }
21796                 };
21797                 Self {
21798                         contents,
21799                         result_ok: o.result_ok,
21800                 }
21801         }
21802 }
21803 impl Clone for CResult_PaymentRelayDecodeErrorZ {
21804         fn clone(&self) -> Self {
21805                 if self.result_ok {
21806                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
21807                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
21808                         } }
21809                 } else {
21810                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
21811                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21812                         } }
21813                 }
21814         }
21815 }
21816 #[no_mangle]
21817 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
21818 /// but with all dynamically-allocated buffers duplicated in new buffers.
21819 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
21820 #[repr(C)]
21821 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
21822 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
21823         /// A pointer to the contents in the success state.
21824         /// Reading from this pointer when `result_ok` is not set is undefined.
21825         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
21826         /// A pointer to the contents in the error state.
21827         /// Reading from this pointer when `result_ok` is set is undefined.
21828         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21829 }
21830 #[repr(C)]
21831 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
21832 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
21833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21834 pub struct CResult_PaymentConstraintsDecodeErrorZ {
21835         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
21836         /// `err` or `result` depending on the state of `result_ok`.
21837         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
21838         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
21839         pub result_ok: bool,
21840 }
21841 #[no_mangle]
21842 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
21843 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
21844         CResult_PaymentConstraintsDecodeErrorZ {
21845                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21846                         result: Box::into_raw(Box::new(o)),
21847                 },
21848                 result_ok: true,
21849         }
21850 }
21851 #[no_mangle]
21852 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
21853 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
21854         CResult_PaymentConstraintsDecodeErrorZ {
21855                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21856                         err: Box::into_raw(Box::new(e)),
21857                 },
21858                 result_ok: false,
21859         }
21860 }
21861 /// Checks if the given object is currently in the success state
21862 #[no_mangle]
21863 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
21864         o.result_ok
21865 }
21866 #[no_mangle]
21867 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
21868 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
21869 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
21870         fn drop(&mut self) {
21871                 if self.result_ok {
21872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21874                         }
21875                 } else {
21876                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21877                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21878                         }
21879                 }
21880         }
21881 }
21882 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
21883         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
21884                 let contents = if o.result_ok {
21885                         let result = unsafe { o.contents.result };
21886                         unsafe { o.contents.result = core::ptr::null_mut() };
21887                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
21888                 } else {
21889                         let err = unsafe { o.contents.err };
21890                         unsafe { o.contents.err = core::ptr::null_mut(); }
21891                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
21892                 };
21893                 Self {
21894                         contents,
21895                         result_ok: o.result_ok,
21896                 }
21897         }
21898 }
21899 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
21900         fn clone(&self) -> Self {
21901                 if self.result_ok {
21902                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21903                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
21904                         } }
21905                 } else {
21906                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21907                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21908                         } }
21909                 }
21910         }
21911 }
21912 #[no_mangle]
21913 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
21914 /// but with all dynamically-allocated buffers duplicated in new buffers.
21915 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
21916 #[repr(C)]
21917 /// The contents of CResult_ThirtyTwoBytesPaymentErrorZ
21918 pub union CResult_ThirtyTwoBytesPaymentErrorZPtr {
21919         /// A pointer to the contents in the success state.
21920         /// Reading from this pointer when `result_ok` is not set is undefined.
21921         pub result: *mut crate::c_types::ThirtyTwoBytes,
21922         /// A pointer to the contents in the error state.
21923         /// Reading from this pointer when `result_ok` is set is undefined.
21924         pub err: *mut crate::lightning_invoice::payment::PaymentError,
21925 }
21926 #[repr(C)]
21927 /// A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation,
21928 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
21929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21930 pub struct CResult_ThirtyTwoBytesPaymentErrorZ {
21931         /// The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either
21932         /// `err` or `result` depending on the state of `result_ok`.
21933         pub contents: CResult_ThirtyTwoBytesPaymentErrorZPtr,
21934         /// Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state.
21935         pub result_ok: bool,
21936 }
21937 #[no_mangle]
21938 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state.
21939 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentErrorZ {
21940         CResult_ThirtyTwoBytesPaymentErrorZ {
21941                 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21942                         result: Box::into_raw(Box::new(o)),
21943                 },
21944                 result_ok: true,
21945         }
21946 }
21947 #[no_mangle]
21948 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state.
21949 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_ThirtyTwoBytesPaymentErrorZ {
21950         CResult_ThirtyTwoBytesPaymentErrorZ {
21951                 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21952                         err: Box::into_raw(Box::new(e)),
21953                 },
21954                 result_ok: false,
21955         }
21956 }
21957 /// Checks if the given object is currently in the success state
21958 #[no_mangle]
21959 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentErrorZ) -> bool {
21960         o.result_ok
21961 }
21962 #[no_mangle]
21963 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ.
21964 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_free(_res: CResult_ThirtyTwoBytesPaymentErrorZ) { }
21965 impl Drop for CResult_ThirtyTwoBytesPaymentErrorZ {
21966         fn drop(&mut self) {
21967                 if self.result_ok {
21968                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21969                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21970                         }
21971                 } else {
21972                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21973                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21974                         }
21975                 }
21976         }
21977 }
21978 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_ThirtyTwoBytesPaymentErrorZ {
21979         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
21980                 let contents = if o.result_ok {
21981                         let result = unsafe { o.contents.result };
21982                         unsafe { o.contents.result = core::ptr::null_mut() };
21983                         CResult_ThirtyTwoBytesPaymentErrorZPtr { result }
21984                 } else {
21985                         let err = unsafe { o.contents.err };
21986                         unsafe { o.contents.err = core::ptr::null_mut(); }
21987                         CResult_ThirtyTwoBytesPaymentErrorZPtr { err }
21988                 };
21989                 Self {
21990                         contents,
21991                         result_ok: o.result_ok,
21992                 }
21993         }
21994 }
21995 impl Clone for CResult_ThirtyTwoBytesPaymentErrorZ {
21996         fn clone(&self) -> Self {
21997                 if self.result_ok {
21998                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21999                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
22000                         } }
22001                 } else {
22002                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22003                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22004                         } }
22005                 }
22006         }
22007 }
22008 #[no_mangle]
22009 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig`
22010 /// but with all dynamically-allocated buffers duplicated in new buffers.
22011 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig: &CResult_ThirtyTwoBytesPaymentErrorZ) -> CResult_ThirtyTwoBytesPaymentErrorZ { Clone::clone(&orig) }
22012 #[repr(C)]
22013 /// The contents of CResult_NonePaymentErrorZ
22014 pub union CResult_NonePaymentErrorZPtr {
22015         /// Note that this value is always NULL, as there are no contents in the OK variant
22016         pub result: *mut core::ffi::c_void,
22017         /// A pointer to the contents in the error state.
22018         /// Reading from this pointer when `result_ok` is set is undefined.
22019         pub err: *mut crate::lightning_invoice::payment::PaymentError,
22020 }
22021 #[repr(C)]
22022 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
22023 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
22024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22025 pub struct CResult_NonePaymentErrorZ {
22026         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
22027         /// `err` or `result` depending on the state of `result_ok`.
22028         pub contents: CResult_NonePaymentErrorZPtr,
22029         /// Whether this CResult_NonePaymentErrorZ represents a success state.
22030         pub result_ok: bool,
22031 }
22032 #[no_mangle]
22033 /// Creates a new CResult_NonePaymentErrorZ in the success state.
22034 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
22035         CResult_NonePaymentErrorZ {
22036                 contents: CResult_NonePaymentErrorZPtr {
22037                         result: core::ptr::null_mut(),
22038                 },
22039                 result_ok: true,
22040         }
22041 }
22042 #[no_mangle]
22043 /// Creates a new CResult_NonePaymentErrorZ in the error state.
22044 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
22045         CResult_NonePaymentErrorZ {
22046                 contents: CResult_NonePaymentErrorZPtr {
22047                         err: Box::into_raw(Box::new(e)),
22048                 },
22049                 result_ok: false,
22050         }
22051 }
22052 /// Checks if the given object is currently in the success state
22053 #[no_mangle]
22054 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
22055         o.result_ok
22056 }
22057 #[no_mangle]
22058 /// Frees any resources used by the CResult_NonePaymentErrorZ.
22059 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
22060 impl Drop for CResult_NonePaymentErrorZ {
22061         fn drop(&mut self) {
22062                 if self.result_ok {
22063                 } else {
22064                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22065                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22066                         }
22067                 }
22068         }
22069 }
22070 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
22071         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
22072                 let contents = if o.result_ok {
22073                         let _ = unsafe { Box::from_raw(o.contents.result) };
22074                         o.contents.result = core::ptr::null_mut();
22075                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
22076                 } else {
22077                         let err = unsafe { o.contents.err };
22078                         unsafe { o.contents.err = core::ptr::null_mut(); }
22079                         CResult_NonePaymentErrorZPtr { err }
22080                 };
22081                 Self {
22082                         contents,
22083                         result_ok: o.result_ok,
22084                 }
22085         }
22086 }
22087 impl Clone for CResult_NonePaymentErrorZ {
22088         fn clone(&self) -> Self {
22089                 if self.result_ok {
22090                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
22091                                 result: core::ptr::null_mut()
22092                         } }
22093                 } else {
22094                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
22095                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22096                         } }
22097                 }
22098         }
22099 }
22100 #[no_mangle]
22101 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
22102 /// but with all dynamically-allocated buffers duplicated in new buffers.
22103 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
22104 #[repr(C)]
22105 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ
22106 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22107         /// A pointer to the contents in the success state.
22108         /// Reading from this pointer when `result_ok` is not set is undefined.
22109         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
22110         /// A pointer to the contents in the error state.
22111         /// Reading from this pointer when `result_ok` is set is undefined.
22112         pub err: *mut crate::lightning_invoice::payment::ProbingError,
22113 }
22114 #[repr(C)]
22115 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation,
22116 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure.
22117 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22118 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22119         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either
22120         /// `err` or `result` depending on the state of `result_ok`.
22121         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr,
22122         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state.
22123         pub result_ok: bool,
22124 }
22125 #[no_mangle]
22126 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state.
22127 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22128         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22129                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22130                         result: Box::into_raw(Box::new(o)),
22131                 },
22132                 result_ok: true,
22133         }
22134 }
22135 #[no_mangle]
22136 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state.
22137 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e: crate::lightning_invoice::payment::ProbingError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22138         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22139                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22140                         err: Box::into_raw(Box::new(e)),
22141                 },
22142                 result_ok: false,
22143         }
22144 }
22145 /// Checks if the given object is currently in the success state
22146 #[no_mangle]
22147 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> bool {
22148         o.result_ok
22149 }
22150 #[no_mangle]
22151 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.
22152 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) { }
22153 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22154         fn drop(&mut self) {
22155                 if self.result_ok {
22156                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22157                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22158                         }
22159                 } else {
22160                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22161                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22162                         }
22163                 }
22164         }
22165 }
22166 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22167         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>) -> Self {
22168                 let contents = if o.result_ok {
22169                         let result = unsafe { o.contents.result };
22170                         unsafe { o.contents.result = core::ptr::null_mut() };
22171                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { result }
22172                 } else {
22173                         let err = unsafe { o.contents.err };
22174                         unsafe { o.contents.err = core::ptr::null_mut(); }
22175                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { err }
22176                 };
22177                 Self {
22178                         contents,
22179                         result_ok: o.result_ok,
22180                 }
22181         }
22182 }
22183 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22184         fn clone(&self) -> Self {
22185                 if self.result_ok {
22186                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22187                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
22188                         } }
22189                 } else {
22190                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22191                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::ProbingError>::clone(unsafe { &*self.contents.err })))
22192                         } }
22193                 }
22194         }
22195 }
22196 #[no_mangle]
22197 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig`
22198 /// but with all dynamically-allocated buffers duplicated in new buffers.
22199 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { Clone::clone(&orig) }
22200 #[repr(C)]
22201 /// The contents of CResult_StrSecp256k1ErrorZ
22202 pub union CResult_StrSecp256k1ErrorZPtr {
22203         /// A pointer to the contents in the success state.
22204         /// Reading from this pointer when `result_ok` is not set is undefined.
22205         pub result: *mut crate::c_types::Str,
22206         /// A pointer to the contents in the error state.
22207         /// Reading from this pointer when `result_ok` is set is undefined.
22208         pub err: *mut crate::c_types::Secp256k1Error,
22209 }
22210 #[repr(C)]
22211 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
22212 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
22213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22214 pub struct CResult_StrSecp256k1ErrorZ {
22215         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
22216         /// `err` or `result` depending on the state of `result_ok`.
22217         pub contents: CResult_StrSecp256k1ErrorZPtr,
22218         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
22219         pub result_ok: bool,
22220 }
22221 #[no_mangle]
22222 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
22223 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
22224         CResult_StrSecp256k1ErrorZ {
22225                 contents: CResult_StrSecp256k1ErrorZPtr {
22226                         result: Box::into_raw(Box::new(o)),
22227                 },
22228                 result_ok: true,
22229         }
22230 }
22231 #[no_mangle]
22232 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
22233 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
22234         CResult_StrSecp256k1ErrorZ {
22235                 contents: CResult_StrSecp256k1ErrorZPtr {
22236                         err: Box::into_raw(Box::new(e)),
22237                 },
22238                 result_ok: false,
22239         }
22240 }
22241 /// Checks if the given object is currently in the success state
22242 #[no_mangle]
22243 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
22244         o.result_ok
22245 }
22246 #[no_mangle]
22247 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
22248 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
22249 impl Drop for CResult_StrSecp256k1ErrorZ {
22250         fn drop(&mut self) {
22251                 if self.result_ok {
22252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22254                         }
22255                 } else {
22256                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22257                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22258                         }
22259                 }
22260         }
22261 }
22262 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
22263         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
22264                 let contents = if o.result_ok {
22265                         let result = unsafe { o.contents.result };
22266                         unsafe { o.contents.result = core::ptr::null_mut() };
22267                         CResult_StrSecp256k1ErrorZPtr { result }
22268                 } else {
22269                         let err = unsafe { o.contents.err };
22270                         unsafe { o.contents.err = core::ptr::null_mut(); }
22271                         CResult_StrSecp256k1ErrorZPtr { err }
22272                 };
22273                 Self {
22274                         contents,
22275                         result_ok: o.result_ok,
22276                 }
22277         }
22278 }
22279 impl Clone for CResult_StrSecp256k1ErrorZ {
22280         fn clone(&self) -> Self {
22281                 if self.result_ok {
22282                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
22283                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
22284                         } }
22285                 } else {
22286                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
22287                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22288                         } }
22289                 }
22290         }
22291 }
22292 #[no_mangle]
22293 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
22294 /// but with all dynamically-allocated buffers duplicated in new buffers.
22295 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
22296 #[repr(C)]
22297 /// The contents of CResult_TxOutUtxoLookupErrorZ
22298 pub union CResult_TxOutUtxoLookupErrorZPtr {
22299         /// A pointer to the contents in the success state.
22300         /// Reading from this pointer when `result_ok` is not set is undefined.
22301         pub result: *mut crate::c_types::TxOut,
22302         /// A pointer to the contents in the error state.
22303         /// Reading from this pointer when `result_ok` is set is undefined.
22304         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
22305 }
22306 #[repr(C)]
22307 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
22308 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
22309 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22310 pub struct CResult_TxOutUtxoLookupErrorZ {
22311         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
22312         /// `err` or `result` depending on the state of `result_ok`.
22313         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
22314         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
22315         pub result_ok: bool,
22316 }
22317 #[no_mangle]
22318 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
22319 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
22320         CResult_TxOutUtxoLookupErrorZ {
22321                 contents: CResult_TxOutUtxoLookupErrorZPtr {
22322                         result: Box::into_raw(Box::new(o)),
22323                 },
22324                 result_ok: true,
22325         }
22326 }
22327 #[no_mangle]
22328 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
22329 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
22330         CResult_TxOutUtxoLookupErrorZ {
22331                 contents: CResult_TxOutUtxoLookupErrorZPtr {
22332                         err: Box::into_raw(Box::new(e)),
22333                 },
22334                 result_ok: false,
22335         }
22336 }
22337 /// Checks if the given object is currently in the success state
22338 #[no_mangle]
22339 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
22340         o.result_ok
22341 }
22342 #[no_mangle]
22343 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
22344 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
22345 impl Drop for CResult_TxOutUtxoLookupErrorZ {
22346         fn drop(&mut self) {
22347                 if self.result_ok {
22348                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22349                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22350                         }
22351                 } else {
22352                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22353                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22354                         }
22355                 }
22356         }
22357 }
22358 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
22359         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
22360                 let contents = if o.result_ok {
22361                         let result = unsafe { o.contents.result };
22362                         unsafe { o.contents.result = core::ptr::null_mut() };
22363                         CResult_TxOutUtxoLookupErrorZPtr { result }
22364                 } else {
22365                         let err = unsafe { o.contents.err };
22366                         unsafe { o.contents.err = core::ptr::null_mut(); }
22367                         CResult_TxOutUtxoLookupErrorZPtr { err }
22368                 };
22369                 Self {
22370                         contents,
22371                         result_ok: o.result_ok,
22372                 }
22373         }
22374 }
22375 impl Clone for CResult_TxOutUtxoLookupErrorZ {
22376         fn clone(&self) -> Self {
22377                 if self.result_ok {
22378                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
22379                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
22380                         } }
22381                 } else {
22382                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
22383                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
22384                         } }
22385                 }
22386         }
22387 }
22388 #[no_mangle]
22389 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
22390 /// but with all dynamically-allocated buffers duplicated in new buffers.
22391 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
22392 #[repr(C)]
22393 /// The contents of CResult_OnionMessagePathNoneZ
22394 pub union CResult_OnionMessagePathNoneZPtr {
22395         /// A pointer to the contents in the success state.
22396         /// Reading from this pointer when `result_ok` is not set is undefined.
22397         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
22398         /// Note that this value is always NULL, as there are no contents in the Err variant
22399         pub err: *mut core::ffi::c_void,
22400 }
22401 #[repr(C)]
22402 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
22403 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
22404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22405 pub struct CResult_OnionMessagePathNoneZ {
22406         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
22407         /// `err` or `result` depending on the state of `result_ok`.
22408         pub contents: CResult_OnionMessagePathNoneZPtr,
22409         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
22410         pub result_ok: bool,
22411 }
22412 #[no_mangle]
22413 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
22414 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
22415         CResult_OnionMessagePathNoneZ {
22416                 contents: CResult_OnionMessagePathNoneZPtr {
22417                         result: Box::into_raw(Box::new(o)),
22418                 },
22419                 result_ok: true,
22420         }
22421 }
22422 #[no_mangle]
22423 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
22424 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
22425         CResult_OnionMessagePathNoneZ {
22426                 contents: CResult_OnionMessagePathNoneZPtr {
22427                         err: core::ptr::null_mut(),
22428                 },
22429                 result_ok: false,
22430         }
22431 }
22432 /// Checks if the given object is currently in the success state
22433 #[no_mangle]
22434 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
22435         o.result_ok
22436 }
22437 #[no_mangle]
22438 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
22439 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
22440 impl Drop for CResult_OnionMessagePathNoneZ {
22441         fn drop(&mut self) {
22442                 if self.result_ok {
22443                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22444                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22445                         }
22446                 } else {
22447                 }
22448         }
22449 }
22450 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
22451         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
22452                 let contents = if o.result_ok {
22453                         let result = unsafe { o.contents.result };
22454                         unsafe { o.contents.result = core::ptr::null_mut() };
22455                         CResult_OnionMessagePathNoneZPtr { result }
22456                 } else {
22457                         let _ = unsafe { Box::from_raw(o.contents.err) };
22458                         o.contents.err = core::ptr::null_mut();
22459                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
22460                 };
22461                 Self {
22462                         contents,
22463                         result_ok: o.result_ok,
22464                 }
22465         }
22466 }
22467 impl Clone for CResult_OnionMessagePathNoneZ {
22468         fn clone(&self) -> Self {
22469                 if self.result_ok {
22470                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
22471                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
22472                         } }
22473                 } else {
22474                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
22475                                 err: core::ptr::null_mut()
22476                         } }
22477                 }
22478         }
22479 }
22480 #[no_mangle]
22481 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
22482 /// but with all dynamically-allocated buffers duplicated in new buffers.
22483 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
22484 #[repr(C)]
22485 /// A tuple of 2 elements. See the individual fields for the types contained.
22486 pub struct C2Tuple_PublicKeyOnionMessageZ {
22487         /// The element at position 0
22488         pub a: crate::c_types::PublicKey,
22489         /// The element at position 1
22490         pub b: crate::lightning::ln::msgs::OnionMessage,
22491 }
22492 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)> for C2Tuple_PublicKeyOnionMessageZ {
22493         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)) -> Self {
22494                 Self {
22495                         a: tup.0,
22496                         b: tup.1,
22497                 }
22498         }
22499 }
22500 impl C2Tuple_PublicKeyOnionMessageZ {
22501         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage) {
22502                 (self.a, self.b)
22503         }
22504 }
22505 impl Clone for C2Tuple_PublicKeyOnionMessageZ {
22506         fn clone(&self) -> Self {
22507                 Self {
22508                         a: Clone::clone(&self.a),
22509                         b: Clone::clone(&self.b),
22510                 }
22511         }
22512 }
22513 #[no_mangle]
22514 /// Creates a new tuple which has the same data as `orig`
22515 /// but with all dynamically-allocated buffers duplicated in new buffers.
22516 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_clone(orig: &C2Tuple_PublicKeyOnionMessageZ) -> C2Tuple_PublicKeyOnionMessageZ { Clone::clone(&orig) }
22517 /// Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements.
22518 #[no_mangle]
22519 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage) -> C2Tuple_PublicKeyOnionMessageZ {
22520         C2Tuple_PublicKeyOnionMessageZ { a, b, }
22521 }
22522
22523 #[no_mangle]
22524 /// Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ.
22525 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_free(_res: C2Tuple_PublicKeyOnionMessageZ) { }
22526 #[repr(C)]
22527 /// The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ
22528 pub union CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22529         /// A pointer to the contents in the success state.
22530         /// Reading from this pointer when `result_ok` is not set is undefined.
22531         pub result: *mut crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ,
22532         /// A pointer to the contents in the error state.
22533         /// Reading from this pointer when `result_ok` is set is undefined.
22534         pub err: *mut crate::lightning::onion_message::messenger::SendError,
22535 }
22536 #[repr(C)]
22537 /// A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation,
22538 /// containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
22539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22540 pub struct CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22541         /// The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either
22542         /// `err` or `result` depending on the state of `result_ok`.
22543         pub contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr,
22544         /// Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state.
22545         pub result_ok: bool,
22546 }
22547 #[no_mangle]
22548 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state.
22549 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o: crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22550         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22551                 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22552                         result: Box::into_raw(Box::new(o)),
22553                 },
22554                 result_ok: true,
22555         }
22556 }
22557 #[no_mangle]
22558 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state.
22559 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22560         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22561                 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22562                         err: Box::into_raw(Box::new(e)),
22563                 },
22564                 result_ok: false,
22565         }
22566 }
22567 /// Checks if the given object is currently in the success state
22568 #[no_mangle]
22569 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o: &CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) -> bool {
22570         o.result_ok
22571 }
22572 #[no_mangle]
22573 /// Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ.
22574 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) { }
22575 impl Drop for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22576         fn drop(&mut self) {
22577                 if self.result_ok {
22578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22580                         }
22581                 } else {
22582                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22583                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22584                         }
22585                 }
22586         }
22587 }
22588 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22589         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
22590                 let contents = if o.result_ok {
22591                         let result = unsafe { o.contents.result };
22592                         unsafe { o.contents.result = core::ptr::null_mut() };
22593                         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { result }
22594                 } else {
22595                         let err = unsafe { o.contents.err };
22596                         unsafe { o.contents.err = core::ptr::null_mut(); }
22597                         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { err }
22598                 };
22599                 Self {
22600                         contents,
22601                         result_ok: o.result_ok,
22602                 }
22603         }
22604 }
22605 #[repr(C)]
22606 /// The contents of CResult_NoneSendErrorZ
22607 pub union CResult_NoneSendErrorZPtr {
22608         /// Note that this value is always NULL, as there are no contents in the OK variant
22609         pub result: *mut core::ffi::c_void,
22610         /// A pointer to the contents in the error state.
22611         /// Reading from this pointer when `result_ok` is set is undefined.
22612         pub err: *mut crate::lightning::onion_message::messenger::SendError,
22613 }
22614 #[repr(C)]
22615 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
22616 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
22617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22618 pub struct CResult_NoneSendErrorZ {
22619         /// The contents of this CResult_NoneSendErrorZ, accessible via either
22620         /// `err` or `result` depending on the state of `result_ok`.
22621         pub contents: CResult_NoneSendErrorZPtr,
22622         /// Whether this CResult_NoneSendErrorZ represents a success state.
22623         pub result_ok: bool,
22624 }
22625 #[no_mangle]
22626 /// Creates a new CResult_NoneSendErrorZ in the success state.
22627 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
22628         CResult_NoneSendErrorZ {
22629                 contents: CResult_NoneSendErrorZPtr {
22630                         result: core::ptr::null_mut(),
22631                 },
22632                 result_ok: true,
22633         }
22634 }
22635 #[no_mangle]
22636 /// Creates a new CResult_NoneSendErrorZ in the error state.
22637 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
22638         CResult_NoneSendErrorZ {
22639                 contents: CResult_NoneSendErrorZPtr {
22640                         err: Box::into_raw(Box::new(e)),
22641                 },
22642                 result_ok: false,
22643         }
22644 }
22645 /// Checks if the given object is currently in the success state
22646 #[no_mangle]
22647 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
22648         o.result_ok
22649 }
22650 #[no_mangle]
22651 /// Frees any resources used by the CResult_NoneSendErrorZ.
22652 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
22653 impl Drop for CResult_NoneSendErrorZ {
22654         fn drop(&mut self) {
22655                 if self.result_ok {
22656                 } else {
22657                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22658                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22659                         }
22660                 }
22661         }
22662 }
22663 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
22664         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
22665                 let contents = if o.result_ok {
22666                         let _ = unsafe { Box::from_raw(o.contents.result) };
22667                         o.contents.result = core::ptr::null_mut();
22668                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
22669                 } else {
22670                         let err = unsafe { o.contents.err };
22671                         unsafe { o.contents.err = core::ptr::null_mut(); }
22672                         CResult_NoneSendErrorZPtr { err }
22673                 };
22674                 Self {
22675                         contents,
22676                         result_ok: o.result_ok,
22677                 }
22678         }
22679 }
22680 #[repr(C)]
22681 /// The contents of CResult_BlindedPathNoneZ
22682 pub union CResult_BlindedPathNoneZPtr {
22683         /// A pointer to the contents in the success state.
22684         /// Reading from this pointer when `result_ok` is not set is undefined.
22685         pub result: *mut crate::lightning::blinded_path::BlindedPath,
22686         /// Note that this value is always NULL, as there are no contents in the Err variant
22687         pub err: *mut core::ffi::c_void,
22688 }
22689 #[repr(C)]
22690 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
22691 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
22692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22693 pub struct CResult_BlindedPathNoneZ {
22694         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
22695         /// `err` or `result` depending on the state of `result_ok`.
22696         pub contents: CResult_BlindedPathNoneZPtr,
22697         /// Whether this CResult_BlindedPathNoneZ represents a success state.
22698         pub result_ok: bool,
22699 }
22700 #[no_mangle]
22701 /// Creates a new CResult_BlindedPathNoneZ in the success state.
22702 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
22703         CResult_BlindedPathNoneZ {
22704                 contents: CResult_BlindedPathNoneZPtr {
22705                         result: Box::into_raw(Box::new(o)),
22706                 },
22707                 result_ok: true,
22708         }
22709 }
22710 #[no_mangle]
22711 /// Creates a new CResult_BlindedPathNoneZ in the error state.
22712 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
22713         CResult_BlindedPathNoneZ {
22714                 contents: CResult_BlindedPathNoneZPtr {
22715                         err: core::ptr::null_mut(),
22716                 },
22717                 result_ok: false,
22718         }
22719 }
22720 /// Checks if the given object is currently in the success state
22721 #[no_mangle]
22722 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
22723         o.result_ok
22724 }
22725 #[no_mangle]
22726 /// Frees any resources used by the CResult_BlindedPathNoneZ.
22727 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
22728 impl Drop for CResult_BlindedPathNoneZ {
22729         fn drop(&mut self) {
22730                 if self.result_ok {
22731                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22732                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22733                         }
22734                 } else {
22735                 }
22736         }
22737 }
22738 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
22739         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
22740                 let contents = if o.result_ok {
22741                         let result = unsafe { o.contents.result };
22742                         unsafe { o.contents.result = core::ptr::null_mut() };
22743                         CResult_BlindedPathNoneZPtr { result }
22744                 } else {
22745                         let _ = unsafe { Box::from_raw(o.contents.err) };
22746                         o.contents.err = core::ptr::null_mut();
22747                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
22748                 };
22749                 Self {
22750                         contents,
22751                         result_ok: o.result_ok,
22752                 }
22753         }
22754 }
22755 impl Clone for CResult_BlindedPathNoneZ {
22756         fn clone(&self) -> Self {
22757                 if self.result_ok {
22758                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
22759                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
22760                         } }
22761                 } else {
22762                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
22763                                 err: core::ptr::null_mut()
22764                         } }
22765                 }
22766         }
22767 }
22768 #[no_mangle]
22769 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
22770 /// but with all dynamically-allocated buffers duplicated in new buffers.
22771 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
22772 #[repr(C)]
22773 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
22774 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22775         /// A pointer to the contents in the success state.
22776         /// Reading from this pointer when `result_ok` is not set is undefined.
22777         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
22778         /// Note that this value is always NULL, as there are no contents in the Err variant
22779         pub err: *mut core::ffi::c_void,
22780 }
22781 #[repr(C)]
22782 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
22783 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
22784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22785 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22786         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
22787         /// `err` or `result` depending on the state of `result_ok`.
22788         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
22789         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
22790         pub result_ok: bool,
22791 }
22792 #[no_mangle]
22793 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
22794 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22795         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22796                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22797                         result: Box::into_raw(Box::new(o)),
22798                 },
22799                 result_ok: true,
22800         }
22801 }
22802 #[no_mangle]
22803 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
22804 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22805         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22806                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22807                         err: core::ptr::null_mut(),
22808                 },
22809                 result_ok: false,
22810         }
22811 }
22812 /// Checks if the given object is currently in the success state
22813 #[no_mangle]
22814 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
22815         o.result_ok
22816 }
22817 #[no_mangle]
22818 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
22819 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
22820 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22821         fn drop(&mut self) {
22822                 if self.result_ok {
22823                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22824                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22825                         }
22826                 } else {
22827                 }
22828         }
22829 }
22830 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22831         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
22832                 let contents = if o.result_ok {
22833                         let result = unsafe { o.contents.result };
22834                         unsafe { o.contents.result = core::ptr::null_mut() };
22835                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
22836                 } else {
22837                         let _ = unsafe { Box::from_raw(o.contents.err) };
22838                         o.contents.err = core::ptr::null_mut();
22839                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
22840                 };
22841                 Self {
22842                         contents,
22843                         result_ok: o.result_ok,
22844                 }
22845         }
22846 }
22847 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22848         fn clone(&self) -> Self {
22849                 if self.result_ok {
22850                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22851                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
22852                         } }
22853                 } else {
22854                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22855                                 err: core::ptr::null_mut()
22856                         } }
22857                 }
22858         }
22859 }
22860 #[no_mangle]
22861 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
22862 /// but with all dynamically-allocated buffers duplicated in new buffers.
22863 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
22864 #[repr(C)]
22865 /// The contents of CResult_BlindedPathDecodeErrorZ
22866 pub union CResult_BlindedPathDecodeErrorZPtr {
22867         /// A pointer to the contents in the success state.
22868         /// Reading from this pointer when `result_ok` is not set is undefined.
22869         pub result: *mut crate::lightning::blinded_path::BlindedPath,
22870         /// A pointer to the contents in the error state.
22871         /// Reading from this pointer when `result_ok` is set is undefined.
22872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22873 }
22874 #[repr(C)]
22875 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
22876 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
22877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22878 pub struct CResult_BlindedPathDecodeErrorZ {
22879         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
22880         /// `err` or `result` depending on the state of `result_ok`.
22881         pub contents: CResult_BlindedPathDecodeErrorZPtr,
22882         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
22883         pub result_ok: bool,
22884 }
22885 #[no_mangle]
22886 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
22887 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
22888         CResult_BlindedPathDecodeErrorZ {
22889                 contents: CResult_BlindedPathDecodeErrorZPtr {
22890                         result: Box::into_raw(Box::new(o)),
22891                 },
22892                 result_ok: true,
22893         }
22894 }
22895 #[no_mangle]
22896 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
22897 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
22898         CResult_BlindedPathDecodeErrorZ {
22899                 contents: CResult_BlindedPathDecodeErrorZPtr {
22900                         err: Box::into_raw(Box::new(e)),
22901                 },
22902                 result_ok: false,
22903         }
22904 }
22905 /// Checks if the given object is currently in the success state
22906 #[no_mangle]
22907 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
22908         o.result_ok
22909 }
22910 #[no_mangle]
22911 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
22912 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
22913 impl Drop for CResult_BlindedPathDecodeErrorZ {
22914         fn drop(&mut self) {
22915                 if self.result_ok {
22916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22918                         }
22919                 } else {
22920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22922                         }
22923                 }
22924         }
22925 }
22926 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
22927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
22928                 let contents = if o.result_ok {
22929                         let result = unsafe { o.contents.result };
22930                         unsafe { o.contents.result = core::ptr::null_mut() };
22931                         CResult_BlindedPathDecodeErrorZPtr { result }
22932                 } else {
22933                         let err = unsafe { o.contents.err };
22934                         unsafe { o.contents.err = core::ptr::null_mut(); }
22935                         CResult_BlindedPathDecodeErrorZPtr { err }
22936                 };
22937                 Self {
22938                         contents,
22939                         result_ok: o.result_ok,
22940                 }
22941         }
22942 }
22943 impl Clone for CResult_BlindedPathDecodeErrorZ {
22944         fn clone(&self) -> Self {
22945                 if self.result_ok {
22946                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
22947                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
22948                         } }
22949                 } else {
22950                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
22951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22952                         } }
22953                 }
22954         }
22955 }
22956 #[no_mangle]
22957 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
22958 /// but with all dynamically-allocated buffers duplicated in new buffers.
22959 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
22960 #[repr(C)]
22961 /// The contents of CResult_BlindedHopDecodeErrorZ
22962 pub union CResult_BlindedHopDecodeErrorZPtr {
22963         /// A pointer to the contents in the success state.
22964         /// Reading from this pointer when `result_ok` is not set is undefined.
22965         pub result: *mut crate::lightning::blinded_path::BlindedHop,
22966         /// A pointer to the contents in the error state.
22967         /// Reading from this pointer when `result_ok` is set is undefined.
22968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22969 }
22970 #[repr(C)]
22971 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
22972 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
22973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22974 pub struct CResult_BlindedHopDecodeErrorZ {
22975         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
22976         /// `err` or `result` depending on the state of `result_ok`.
22977         pub contents: CResult_BlindedHopDecodeErrorZPtr,
22978         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
22979         pub result_ok: bool,
22980 }
22981 #[no_mangle]
22982 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
22983 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
22984         CResult_BlindedHopDecodeErrorZ {
22985                 contents: CResult_BlindedHopDecodeErrorZPtr {
22986                         result: Box::into_raw(Box::new(o)),
22987                 },
22988                 result_ok: true,
22989         }
22990 }
22991 #[no_mangle]
22992 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
22993 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
22994         CResult_BlindedHopDecodeErrorZ {
22995                 contents: CResult_BlindedHopDecodeErrorZPtr {
22996                         err: Box::into_raw(Box::new(e)),
22997                 },
22998                 result_ok: false,
22999         }
23000 }
23001 /// Checks if the given object is currently in the success state
23002 #[no_mangle]
23003 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
23004         o.result_ok
23005 }
23006 #[no_mangle]
23007 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
23008 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
23009 impl Drop for CResult_BlindedHopDecodeErrorZ {
23010         fn drop(&mut self) {
23011                 if self.result_ok {
23012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23014                         }
23015                 } else {
23016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23018                         }
23019                 }
23020         }
23021 }
23022 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
23023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
23024                 let contents = if o.result_ok {
23025                         let result = unsafe { o.contents.result };
23026                         unsafe { o.contents.result = core::ptr::null_mut() };
23027                         CResult_BlindedHopDecodeErrorZPtr { result }
23028                 } else {
23029                         let err = unsafe { o.contents.err };
23030                         unsafe { o.contents.err = core::ptr::null_mut(); }
23031                         CResult_BlindedHopDecodeErrorZPtr { err }
23032                 };
23033                 Self {
23034                         contents,
23035                         result_ok: o.result_ok,
23036                 }
23037         }
23038 }
23039 impl Clone for CResult_BlindedHopDecodeErrorZ {
23040         fn clone(&self) -> Self {
23041                 if self.result_ok {
23042                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
23043                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
23044                         } }
23045                 } else {
23046                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
23047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23048                         } }
23049                 }
23050         }
23051 }
23052 #[no_mangle]
23053 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
23054 /// but with all dynamically-allocated buffers duplicated in new buffers.
23055 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
23056 #[repr(C)]
23057 /// The contents of CResult_InvoiceErrorDecodeErrorZ
23058 pub union CResult_InvoiceErrorDecodeErrorZPtr {
23059         /// A pointer to the contents in the success state.
23060         /// Reading from this pointer when `result_ok` is not set is undefined.
23061         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
23062         /// A pointer to the contents in the error state.
23063         /// Reading from this pointer when `result_ok` is set is undefined.
23064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23065 }
23066 #[repr(C)]
23067 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
23068 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
23069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23070 pub struct CResult_InvoiceErrorDecodeErrorZ {
23071         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
23072         /// `err` or `result` depending on the state of `result_ok`.
23073         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
23074         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
23075         pub result_ok: bool,
23076 }
23077 #[no_mangle]
23078 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
23079 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
23080         CResult_InvoiceErrorDecodeErrorZ {
23081                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23082                         result: Box::into_raw(Box::new(o)),
23083                 },
23084                 result_ok: true,
23085         }
23086 }
23087 #[no_mangle]
23088 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
23089 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
23090         CResult_InvoiceErrorDecodeErrorZ {
23091                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23092                         err: Box::into_raw(Box::new(e)),
23093                 },
23094                 result_ok: false,
23095         }
23096 }
23097 /// Checks if the given object is currently in the success state
23098 #[no_mangle]
23099 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
23100         o.result_ok
23101 }
23102 #[no_mangle]
23103 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
23104 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
23105 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
23106         fn drop(&mut self) {
23107                 if self.result_ok {
23108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23110                         }
23111                 } else {
23112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23114                         }
23115                 }
23116         }
23117 }
23118 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
23119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
23120                 let contents = if o.result_ok {
23121                         let result = unsafe { o.contents.result };
23122                         unsafe { o.contents.result = core::ptr::null_mut() };
23123                         CResult_InvoiceErrorDecodeErrorZPtr { result }
23124                 } else {
23125                         let err = unsafe { o.contents.err };
23126                         unsafe { o.contents.err = core::ptr::null_mut(); }
23127                         CResult_InvoiceErrorDecodeErrorZPtr { err }
23128                 };
23129                 Self {
23130                         contents,
23131                         result_ok: o.result_ok,
23132                 }
23133         }
23134 }
23135 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
23136         fn clone(&self) -> Self {
23137                 if self.result_ok {
23138                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23139                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
23140                         } }
23141                 } else {
23142                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23143                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23144                         } }
23145                 }
23146         }
23147 }
23148 #[no_mangle]
23149 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
23150 /// but with all dynamically-allocated buffers duplicated in new buffers.
23151 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
23152 #[repr(C)]
23153 /// An enum which can either contain a crate::lightning::chain::Filter or not
23154 pub enum COption_FilterZ {
23155         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
23156         Some(crate::lightning::chain::Filter),
23157         /// When we're in this state, this COption_FilterZ contains nothing
23158         None
23159 }
23160 impl COption_FilterZ {
23161         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23162                 if let Self::None = self { false } else { true }
23163         }
23164         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23165                 !self.is_some()
23166         }
23167         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
23168                 if let Self::Some(v) = self { v } else { unreachable!() }
23169         }
23170 }
23171 #[no_mangle]
23172 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
23173 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
23174         COption_FilterZ::Some(o)
23175 }
23176 #[no_mangle]
23177 /// Constructs a new COption_FilterZ containing nothing
23178 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
23179         COption_FilterZ::None
23180 }
23181 #[no_mangle]
23182 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
23183 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
23184 #[repr(C)]
23185 /// The contents of CResult_LockedChannelMonitorNoneZ
23186 pub union CResult_LockedChannelMonitorNoneZPtr {
23187         /// A pointer to the contents in the success state.
23188         /// Reading from this pointer when `result_ok` is not set is undefined.
23189         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
23190         /// Note that this value is always NULL, as there are no contents in the Err variant
23191         pub err: *mut core::ffi::c_void,
23192 }
23193 #[repr(C)]
23194 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
23195 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
23196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23197 pub struct CResult_LockedChannelMonitorNoneZ {
23198         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
23199         /// `err` or `result` depending on the state of `result_ok`.
23200         pub contents: CResult_LockedChannelMonitorNoneZPtr,
23201         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
23202         pub result_ok: bool,
23203 }
23204 #[no_mangle]
23205 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
23206 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
23207         CResult_LockedChannelMonitorNoneZ {
23208                 contents: CResult_LockedChannelMonitorNoneZPtr {
23209                         result: Box::into_raw(Box::new(o)),
23210                 },
23211                 result_ok: true,
23212         }
23213 }
23214 #[no_mangle]
23215 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
23216 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
23217         CResult_LockedChannelMonitorNoneZ {
23218                 contents: CResult_LockedChannelMonitorNoneZPtr {
23219                         err: core::ptr::null_mut(),
23220                 },
23221                 result_ok: false,
23222         }
23223 }
23224 /// Checks if the given object is currently in the success state
23225 #[no_mangle]
23226 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
23227         o.result_ok
23228 }
23229 #[no_mangle]
23230 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
23231 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
23232 impl Drop for CResult_LockedChannelMonitorNoneZ {
23233         fn drop(&mut self) {
23234                 if self.result_ok {
23235                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23236                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23237                         }
23238                 } else {
23239                 }
23240         }
23241 }
23242 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
23243         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
23244                 let contents = if o.result_ok {
23245                         let result = unsafe { o.contents.result };
23246                         unsafe { o.contents.result = core::ptr::null_mut() };
23247                         CResult_LockedChannelMonitorNoneZPtr { result }
23248                 } else {
23249                         let _ = unsafe { Box::from_raw(o.contents.err) };
23250                         o.contents.err = core::ptr::null_mut();
23251                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
23252                 };
23253                 Self {
23254                         contents,
23255                         result_ok: o.result_ok,
23256                 }
23257         }
23258 }
23259 #[repr(C)]
23260 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
23261 /// This corresponds to std::vector in C++
23262 pub struct CVec_OutPointZ {
23263         /// The elements in the array.
23264         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23265         pub data: *mut crate::lightning::chain::transaction::OutPoint,
23266         /// The number of elements pointed to by `data`.
23267         pub datalen: usize
23268 }
23269 impl CVec_OutPointZ {
23270         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
23271                 if self.datalen == 0 { return Vec::new(); }
23272                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23273                 self.data = core::ptr::null_mut();
23274                 self.datalen = 0;
23275                 ret
23276         }
23277         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
23278                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23279         }
23280 }
23281 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
23282         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
23283                 let datalen = v.len();
23284                 let data = Box::into_raw(v.into_boxed_slice());
23285                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23286         }
23287 }
23288 #[no_mangle]
23289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23290 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
23291 impl Drop for CVec_OutPointZ {
23292         fn drop(&mut self) {
23293                 if self.datalen == 0 { return; }
23294                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23295         }
23296 }
23297 impl Clone for CVec_OutPointZ {
23298         fn clone(&self) -> Self {
23299                 let mut res = Vec::new();
23300                 if self.datalen == 0 { return Self::from(res); }
23301                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23302                 Self::from(res)
23303         }
23304 }
23305 #[repr(C)]
23306 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
23307 /// This corresponds to std::vector in C++
23308 pub struct CVec_MonitorUpdateIdZ {
23309         /// The elements in the array.
23310         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23311         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
23312         /// The number of elements pointed to by `data`.
23313         pub datalen: usize
23314 }
23315 impl CVec_MonitorUpdateIdZ {
23316         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
23317                 if self.datalen == 0 { return Vec::new(); }
23318                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23319                 self.data = core::ptr::null_mut();
23320                 self.datalen = 0;
23321                 ret
23322         }
23323         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
23324                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23325         }
23326 }
23327 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
23328         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
23329                 let datalen = v.len();
23330                 let data = Box::into_raw(v.into_boxed_slice());
23331                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23332         }
23333 }
23334 #[no_mangle]
23335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23336 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
23337 impl Drop for CVec_MonitorUpdateIdZ {
23338         fn drop(&mut self) {
23339                 if self.datalen == 0 { return; }
23340                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23341         }
23342 }
23343 impl Clone for CVec_MonitorUpdateIdZ {
23344         fn clone(&self) -> Self {
23345                 let mut res = Vec::new();
23346                 if self.datalen == 0 { return Self::from(res); }
23347                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23348                 Self::from(res)
23349         }
23350 }
23351 #[repr(C)]
23352 /// A tuple of 2 elements. See the individual fields for the types contained.
23353 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23354         /// The element at position 0
23355         pub a: crate::lightning::chain::transaction::OutPoint,
23356         /// The element at position 1
23357         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
23358 }
23359 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23360         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
23361                 Self {
23362                         a: tup.0,
23363                         b: tup.1,
23364                 }
23365         }
23366 }
23367 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23368         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
23369                 (self.a, self.b)
23370         }
23371 }
23372 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23373         fn clone(&self) -> Self {
23374                 Self {
23375                         a: Clone::clone(&self.a),
23376                         b: Clone::clone(&self.b),
23377                 }
23378         }
23379 }
23380 #[no_mangle]
23381 /// Creates a new tuple which has the same data as `orig`
23382 /// but with all dynamically-allocated buffers duplicated in new buffers.
23383 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
23384 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
23385 #[no_mangle]
23386 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23387         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
23388 }
23389
23390 #[no_mangle]
23391 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
23392 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
23393 #[repr(C)]
23394 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
23395 /// This corresponds to std::vector in C++
23396 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23397         /// The elements in the array.
23398         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23399         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
23400         /// The number of elements pointed to by `data`.
23401         pub datalen: usize
23402 }
23403 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23404         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
23405                 if self.datalen == 0 { return Vec::new(); }
23406                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23407                 self.data = core::ptr::null_mut();
23408                 self.datalen = 0;
23409                 ret
23410         }
23411         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
23412                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23413         }
23414 }
23415 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23416         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
23417                 let datalen = v.len();
23418                 let data = Box::into_raw(v.into_boxed_slice());
23419                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23420         }
23421 }
23422 #[no_mangle]
23423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23424 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
23425 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23426         fn drop(&mut self) {
23427                 if self.datalen == 0 { return; }
23428                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23429         }
23430 }
23431 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23432         fn clone(&self) -> Self {
23433                 let mut res = Vec::new();
23434                 if self.datalen == 0 { return Self::from(res); }
23435                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23436                 Self::from(res)
23437         }
23438 }