ff36cb60be9b494d1bdb1a4af63ac235924ac7af
[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_ChannelDerivationParametersDecodeErrorZ
1690 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
1691         /// A pointer to the contents in the success state.
1692         /// Reading from this pointer when `result_ok` is not set is undefined.
1693         pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
1694         /// A pointer to the contents in the error state.
1695         /// Reading from this pointer when `result_ok` is set is undefined.
1696         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1697 }
1698 #[repr(C)]
1699 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
1700 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1702 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
1703         /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
1704         /// `err` or `result` depending on the state of `result_ok`.
1705         pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
1706         /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
1707         pub result_ok: bool,
1708 }
1709 #[no_mangle]
1710 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
1711 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1712         CResult_ChannelDerivationParametersDecodeErrorZ {
1713                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1714                         result: Box::into_raw(Box::new(o)),
1715                 },
1716                 result_ok: true,
1717         }
1718 }
1719 #[no_mangle]
1720 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
1721 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1722         CResult_ChannelDerivationParametersDecodeErrorZ {
1723                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1724                         err: Box::into_raw(Box::new(e)),
1725                 },
1726                 result_ok: false,
1727         }
1728 }
1729 /// Checks if the given object is currently in the success state
1730 #[no_mangle]
1731 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
1732         o.result_ok
1733 }
1734 #[no_mangle]
1735 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
1736 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
1737 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
1738         fn drop(&mut self) {
1739                 if self.result_ok {
1740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1742                         }
1743                 } else {
1744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1746                         }
1747                 }
1748         }
1749 }
1750 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
1751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1752                 let contents = if o.result_ok {
1753                         let result = unsafe { o.contents.result };
1754                         unsafe { o.contents.result = core::ptr::null_mut() };
1755                         CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
1756                 } else {
1757                         let err = unsafe { o.contents.err };
1758                         unsafe { o.contents.err = core::ptr::null_mut(); }
1759                         CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
1760                 };
1761                 Self {
1762                         contents,
1763                         result_ok: o.result_ok,
1764                 }
1765         }
1766 }
1767 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
1768         fn clone(&self) -> Self {
1769                 if self.result_ok {
1770                         Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1771                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
1772                         } }
1773                 } else {
1774                         Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1776                         } }
1777                 }
1778         }
1779 }
1780 #[no_mangle]
1781 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
1782 /// but with all dynamically-allocated buffers duplicated in new buffers.
1783 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
1784 #[repr(C)]
1785 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
1786 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
1787         /// A pointer to the contents in the success state.
1788         /// Reading from this pointer when `result_ok` is not set is undefined.
1789         pub result: *mut crate::lightning::sign::HTLCDescriptor,
1790         /// A pointer to the contents in the error state.
1791         /// Reading from this pointer when `result_ok` is set is undefined.
1792         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1793 }
1794 #[repr(C)]
1795 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
1796 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1798 pub struct CResult_HTLCDescriptorDecodeErrorZ {
1799         /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
1800         /// `err` or `result` depending on the state of `result_ok`.
1801         pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
1802         /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
1803         pub result_ok: bool,
1804 }
1805 #[no_mangle]
1806 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
1807 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
1808         CResult_HTLCDescriptorDecodeErrorZ {
1809                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1810                         result: Box::into_raw(Box::new(o)),
1811                 },
1812                 result_ok: true,
1813         }
1814 }
1815 #[no_mangle]
1816 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
1817 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
1818         CResult_HTLCDescriptorDecodeErrorZ {
1819                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1820                         err: Box::into_raw(Box::new(e)),
1821                 },
1822                 result_ok: false,
1823         }
1824 }
1825 /// Checks if the given object is currently in the success state
1826 #[no_mangle]
1827 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
1828         o.result_ok
1829 }
1830 #[no_mangle]
1831 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
1832 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
1833 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
1834         fn drop(&mut self) {
1835                 if self.result_ok {
1836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1838                         }
1839                 } else {
1840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1842                         }
1843                 }
1844         }
1845 }
1846 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
1847         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1848                 let contents = if o.result_ok {
1849                         let result = unsafe { o.contents.result };
1850                         unsafe { o.contents.result = core::ptr::null_mut() };
1851                         CResult_HTLCDescriptorDecodeErrorZPtr { result }
1852                 } else {
1853                         let err = unsafe { o.contents.err };
1854                         unsafe { o.contents.err = core::ptr::null_mut(); }
1855                         CResult_HTLCDescriptorDecodeErrorZPtr { err }
1856                 };
1857                 Self {
1858                         contents,
1859                         result_ok: o.result_ok,
1860                 }
1861         }
1862 }
1863 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
1864         fn clone(&self) -> Self {
1865                 if self.result_ok {
1866                         Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1867                                 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
1868                         } }
1869                 } else {
1870                         Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1871                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1872                         } }
1873                 }
1874         }
1875 }
1876 #[no_mangle]
1877 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
1878 /// but with all dynamically-allocated buffers duplicated in new buffers.
1879 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
1880 #[repr(C)]
1881 /// The contents of CResult_NoneNoneZ
1882 pub union CResult_NoneNoneZPtr {
1883         /// Note that this value is always NULL, as there are no contents in the OK variant
1884         pub result: *mut core::ffi::c_void,
1885         /// Note that this value is always NULL, as there are no contents in the Err variant
1886         pub err: *mut core::ffi::c_void,
1887 }
1888 #[repr(C)]
1889 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1890 /// containing a () on success and a () on failure.
1891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1892 pub struct CResult_NoneNoneZ {
1893         /// The contents of this CResult_NoneNoneZ, accessible via either
1894         /// `err` or `result` depending on the state of `result_ok`.
1895         pub contents: CResult_NoneNoneZPtr,
1896         /// Whether this CResult_NoneNoneZ represents a success state.
1897         pub result_ok: bool,
1898 }
1899 #[no_mangle]
1900 /// Creates a new CResult_NoneNoneZ in the success state.
1901 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1902         CResult_NoneNoneZ {
1903                 contents: CResult_NoneNoneZPtr {
1904                         result: core::ptr::null_mut(),
1905                 },
1906                 result_ok: true,
1907         }
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_NoneNoneZ in the error state.
1911 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1912         CResult_NoneNoneZ {
1913                 contents: CResult_NoneNoneZPtr {
1914                         err: core::ptr::null_mut(),
1915                 },
1916                 result_ok: false,
1917         }
1918 }
1919 /// Checks if the given object is currently in the success state
1920 #[no_mangle]
1921 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1922         o.result_ok
1923 }
1924 #[no_mangle]
1925 /// Frees any resources used by the CResult_NoneNoneZ.
1926 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1927 impl Drop for CResult_NoneNoneZ {
1928         fn drop(&mut self) {
1929                 if self.result_ok {
1930                 } else {
1931                 }
1932         }
1933 }
1934 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1935         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1936                 let contents = if o.result_ok {
1937                         let _ = unsafe { Box::from_raw(o.contents.result) };
1938                         o.contents.result = core::ptr::null_mut();
1939                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1940                 } else {
1941                         let _ = unsafe { Box::from_raw(o.contents.err) };
1942                         o.contents.err = core::ptr::null_mut();
1943                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1944                 };
1945                 Self {
1946                         contents,
1947                         result_ok: o.result_ok,
1948                 }
1949         }
1950 }
1951 impl Clone for CResult_NoneNoneZ {
1952         fn clone(&self) -> Self {
1953                 if self.result_ok {
1954                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1955                                 result: core::ptr::null_mut()
1956                         } }
1957                 } else {
1958                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1959                                 err: core::ptr::null_mut()
1960                         } }
1961                 }
1962         }
1963 }
1964 #[no_mangle]
1965 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1966 /// but with all dynamically-allocated buffers duplicated in new buffers.
1967 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1968 #[repr(C)]
1969 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
1970 /// This corresponds to std::vector in C++
1971 pub struct CVec_ECDSASignatureZ {
1972         /// The elements in the array.
1973         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1974         pub data: *mut crate::c_types::ECDSASignature,
1975         /// The number of elements pointed to by `data`.
1976         pub datalen: usize
1977 }
1978 impl CVec_ECDSASignatureZ {
1979         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
1980                 if self.datalen == 0 { return Vec::new(); }
1981                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1982                 self.data = core::ptr::null_mut();
1983                 self.datalen = 0;
1984                 ret
1985         }
1986         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
1987                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1988         }
1989 }
1990 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
1991         fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
1992                 let datalen = v.len();
1993                 let data = Box::into_raw(v.into_boxed_slice());
1994                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1995         }
1996 }
1997 #[no_mangle]
1998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1999 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
2000 impl Drop for CVec_ECDSASignatureZ {
2001         fn drop(&mut self) {
2002                 if self.datalen == 0 { return; }
2003                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2004         }
2005 }
2006 impl Clone for CVec_ECDSASignatureZ {
2007         fn clone(&self) -> Self {
2008                 let mut res = Vec::new();
2009                 if self.datalen == 0 { return Self::from(res); }
2010                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2011                 Self::from(res)
2012         }
2013 }
2014 #[repr(C)]
2015 /// A tuple of 2 elements. See the individual fields for the types contained.
2016 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2017         /// The element at position 0
2018         pub a: crate::c_types::ECDSASignature,
2019         /// The element at position 1
2020         pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
2021 }
2022 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2023         fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
2024                 Self {
2025                         a: tup.0,
2026                         b: tup.1,
2027                 }
2028         }
2029 }
2030 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2031         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
2032                 (self.a, self.b)
2033         }
2034 }
2035 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2036         fn clone(&self) -> Self {
2037                 Self {
2038                         a: Clone::clone(&self.a),
2039                         b: Clone::clone(&self.b),
2040                 }
2041         }
2042 }
2043 #[no_mangle]
2044 /// Creates a new tuple which has the same data as `orig`
2045 /// but with all dynamically-allocated buffers duplicated in new buffers.
2046 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
2047 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
2048 #[no_mangle]
2049 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2050         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
2051 }
2052
2053 #[no_mangle]
2054 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
2055 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
2056 #[repr(C)]
2057 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
2058 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2059         /// A pointer to the contents in the success state.
2060         /// Reading from this pointer when `result_ok` is not set is undefined.
2061         pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
2062         /// Note that this value is always NULL, as there are no contents in the Err variant
2063         pub err: *mut core::ffi::c_void,
2064 }
2065 #[repr(C)]
2066 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
2067 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
2068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2069 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2070         /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
2071         /// `err` or `result` depending on the state of `result_ok`.
2072         pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
2073         /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
2074         pub result_ok: bool,
2075 }
2076 #[no_mangle]
2077 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
2078 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2079         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2080                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2081                         result: Box::into_raw(Box::new(o)),
2082                 },
2083                 result_ok: true,
2084         }
2085 }
2086 #[no_mangle]
2087 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
2088 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2089         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2090                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2091                         err: core::ptr::null_mut(),
2092                 },
2093                 result_ok: false,
2094         }
2095 }
2096 /// Checks if the given object is currently in the success state
2097 #[no_mangle]
2098 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
2099         o.result_ok
2100 }
2101 #[no_mangle]
2102 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
2103 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
2104 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2105         fn drop(&mut self) {
2106                 if self.result_ok {
2107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2109                         }
2110                 } else {
2111                 }
2112         }
2113 }
2114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2115         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
2116                 let contents = if o.result_ok {
2117                         let result = unsafe { o.contents.result };
2118                         unsafe { o.contents.result = core::ptr::null_mut() };
2119                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
2120                 } else {
2121                         let _ = unsafe { Box::from_raw(o.contents.err) };
2122                         o.contents.err = core::ptr::null_mut();
2123                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
2124                 };
2125                 Self {
2126                         contents,
2127                         result_ok: o.result_ok,
2128                 }
2129         }
2130 }
2131 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2132         fn clone(&self) -> Self {
2133                 if self.result_ok {
2134                         Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2135                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
2136                         } }
2137                 } else {
2138                         Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2139                                 err: core::ptr::null_mut()
2140                         } }
2141                 }
2142         }
2143 }
2144 #[no_mangle]
2145 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
2146 /// but with all dynamically-allocated buffers duplicated in new buffers.
2147 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
2148 #[repr(C)]
2149 /// The contents of CResult_ECDSASignatureNoneZ
2150 pub union CResult_ECDSASignatureNoneZPtr {
2151         /// A pointer to the contents in the success state.
2152         /// Reading from this pointer when `result_ok` is not set is undefined.
2153         pub result: *mut crate::c_types::ECDSASignature,
2154         /// Note that this value is always NULL, as there are no contents in the Err variant
2155         pub err: *mut core::ffi::c_void,
2156 }
2157 #[repr(C)]
2158 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2159 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2161 pub struct CResult_ECDSASignatureNoneZ {
2162         /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2163         /// `err` or `result` depending on the state of `result_ok`.
2164         pub contents: CResult_ECDSASignatureNoneZPtr,
2165         /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2166         pub result_ok: bool,
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2170 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2171         CResult_ECDSASignatureNoneZ {
2172                 contents: CResult_ECDSASignatureNoneZPtr {
2173                         result: Box::into_raw(Box::new(o)),
2174                 },
2175                 result_ok: true,
2176         }
2177 }
2178 #[no_mangle]
2179 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2180 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2181         CResult_ECDSASignatureNoneZ {
2182                 contents: CResult_ECDSASignatureNoneZPtr {
2183                         err: core::ptr::null_mut(),
2184                 },
2185                 result_ok: false,
2186         }
2187 }
2188 /// Checks if the given object is currently in the success state
2189 #[no_mangle]
2190 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2191         o.result_ok
2192 }
2193 #[no_mangle]
2194 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2195 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2196 impl Drop for CResult_ECDSASignatureNoneZ {
2197         fn drop(&mut self) {
2198                 if self.result_ok {
2199                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2200                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2201                         }
2202                 } else {
2203                 }
2204         }
2205 }
2206 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2207         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2208                 let contents = if o.result_ok {
2209                         let result = unsafe { o.contents.result };
2210                         unsafe { o.contents.result = core::ptr::null_mut() };
2211                         CResult_ECDSASignatureNoneZPtr { result }
2212                 } else {
2213                         let _ = unsafe { Box::from_raw(o.contents.err) };
2214                         o.contents.err = core::ptr::null_mut();
2215                         CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2216                 };
2217                 Self {
2218                         contents,
2219                         result_ok: o.result_ok,
2220                 }
2221         }
2222 }
2223 impl Clone for CResult_ECDSASignatureNoneZ {
2224         fn clone(&self) -> Self {
2225                 if self.result_ok {
2226                         Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2227                                 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2228                         } }
2229                 } else {
2230                         Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2231                                 err: core::ptr::null_mut()
2232                         } }
2233                 }
2234         }
2235 }
2236 #[no_mangle]
2237 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2238 /// but with all dynamically-allocated buffers duplicated in new buffers.
2239 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2240 #[repr(C)]
2241 /// The contents of CResult_PublicKeyNoneZ
2242 pub union CResult_PublicKeyNoneZPtr {
2243         /// A pointer to the contents in the success state.
2244         /// Reading from this pointer when `result_ok` is not set is undefined.
2245         pub result: *mut crate::c_types::PublicKey,
2246         /// Note that this value is always NULL, as there are no contents in the Err variant
2247         pub err: *mut core::ffi::c_void,
2248 }
2249 #[repr(C)]
2250 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2251 /// containing a crate::c_types::PublicKey on success and a () on failure.
2252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2253 pub struct CResult_PublicKeyNoneZ {
2254         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2255         /// `err` or `result` depending on the state of `result_ok`.
2256         pub contents: CResult_PublicKeyNoneZPtr,
2257         /// Whether this CResult_PublicKeyNoneZ represents a success state.
2258         pub result_ok: bool,
2259 }
2260 #[no_mangle]
2261 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2262 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2263         CResult_PublicKeyNoneZ {
2264                 contents: CResult_PublicKeyNoneZPtr {
2265                         result: Box::into_raw(Box::new(o)),
2266                 },
2267                 result_ok: true,
2268         }
2269 }
2270 #[no_mangle]
2271 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2272 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2273         CResult_PublicKeyNoneZ {
2274                 contents: CResult_PublicKeyNoneZPtr {
2275                         err: core::ptr::null_mut(),
2276                 },
2277                 result_ok: false,
2278         }
2279 }
2280 /// Checks if the given object is currently in the success state
2281 #[no_mangle]
2282 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2283         o.result_ok
2284 }
2285 #[no_mangle]
2286 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2287 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2288 impl Drop for CResult_PublicKeyNoneZ {
2289         fn drop(&mut self) {
2290                 if self.result_ok {
2291                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2292                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2293                         }
2294                 } else {
2295                 }
2296         }
2297 }
2298 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2299         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2300                 let contents = if o.result_ok {
2301                         let result = unsafe { o.contents.result };
2302                         unsafe { o.contents.result = core::ptr::null_mut() };
2303                         CResult_PublicKeyNoneZPtr { result }
2304                 } else {
2305                         let _ = unsafe { Box::from_raw(o.contents.err) };
2306                         o.contents.err = core::ptr::null_mut();
2307                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2308                 };
2309                 Self {
2310                         contents,
2311                         result_ok: o.result_ok,
2312                 }
2313         }
2314 }
2315 impl Clone for CResult_PublicKeyNoneZ {
2316         fn clone(&self) -> Self {
2317                 if self.result_ok {
2318                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2319                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2320                         } }
2321                 } else {
2322                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2323                                 err: core::ptr::null_mut()
2324                         } }
2325                 }
2326         }
2327 }
2328 #[no_mangle]
2329 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2330 /// but with all dynamically-allocated buffers duplicated in new buffers.
2331 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2332 #[repr(C)]
2333 #[derive(Clone)]
2334 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2335 pub enum COption_BigEndianScalarZ {
2336         /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2337         Some(crate::c_types::BigEndianScalar),
2338         /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2339         None
2340 }
2341 impl COption_BigEndianScalarZ {
2342         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2343                 if let Self::None = self { false } else { true }
2344         }
2345         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2346                 !self.is_some()
2347         }
2348         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2349                 if let Self::Some(v) = self { v } else { unreachable!() }
2350         }
2351 }
2352 #[no_mangle]
2353 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2354 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2355         COption_BigEndianScalarZ::Some(o)
2356 }
2357 #[no_mangle]
2358 /// Constructs a new COption_BigEndianScalarZ containing nothing
2359 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2360         COption_BigEndianScalarZ::None
2361 }
2362 #[no_mangle]
2363 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2364 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2365 #[no_mangle]
2366 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2367 /// but with all dynamically-allocated buffers duplicated in new buffers.
2368 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2369 #[repr(C)]
2370 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2371 /// This corresponds to std::vector in C++
2372 pub struct CVec_U5Z {
2373         /// The elements in the array.
2374         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2375         pub data: *mut crate::c_types::U5,
2376         /// The number of elements pointed to by `data`.
2377         pub datalen: usize
2378 }
2379 impl CVec_U5Z {
2380         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2381                 if self.datalen == 0 { return Vec::new(); }
2382                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2383                 self.data = core::ptr::null_mut();
2384                 self.datalen = 0;
2385                 ret
2386         }
2387         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2388                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2389         }
2390 }
2391 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2392         fn from(v: Vec<crate::c_types::U5>) -> Self {
2393                 let datalen = v.len();
2394                 let data = Box::into_raw(v.into_boxed_slice());
2395                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2396         }
2397 }
2398 #[no_mangle]
2399 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2400 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2401 impl Drop for CVec_U5Z {
2402         fn drop(&mut self) {
2403                 if self.datalen == 0 { return; }
2404                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2405         }
2406 }
2407 impl Clone for CVec_U5Z {
2408         fn clone(&self) -> Self {
2409                 let mut res = Vec::new();
2410                 if self.datalen == 0 { return Self::from(res); }
2411                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2412                 Self::from(res)
2413         }
2414 }
2415 #[repr(C)]
2416 /// The contents of CResult_RecoverableSignatureNoneZ
2417 pub union CResult_RecoverableSignatureNoneZPtr {
2418         /// A pointer to the contents in the success state.
2419         /// Reading from this pointer when `result_ok` is not set is undefined.
2420         pub result: *mut crate::c_types::RecoverableSignature,
2421         /// Note that this value is always NULL, as there are no contents in the Err variant
2422         pub err: *mut core::ffi::c_void,
2423 }
2424 #[repr(C)]
2425 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2426 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2428 pub struct CResult_RecoverableSignatureNoneZ {
2429         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2430         /// `err` or `result` depending on the state of `result_ok`.
2431         pub contents: CResult_RecoverableSignatureNoneZPtr,
2432         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2433         pub result_ok: bool,
2434 }
2435 #[no_mangle]
2436 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2437 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2438         CResult_RecoverableSignatureNoneZ {
2439                 contents: CResult_RecoverableSignatureNoneZPtr {
2440                         result: Box::into_raw(Box::new(o)),
2441                 },
2442                 result_ok: true,
2443         }
2444 }
2445 #[no_mangle]
2446 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2447 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2448         CResult_RecoverableSignatureNoneZ {
2449                 contents: CResult_RecoverableSignatureNoneZPtr {
2450                         err: core::ptr::null_mut(),
2451                 },
2452                 result_ok: false,
2453         }
2454 }
2455 /// Checks if the given object is currently in the success state
2456 #[no_mangle]
2457 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2458         o.result_ok
2459 }
2460 #[no_mangle]
2461 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2462 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2463 impl Drop for CResult_RecoverableSignatureNoneZ {
2464         fn drop(&mut self) {
2465                 if self.result_ok {
2466                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2467                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2468                         }
2469                 } else {
2470                 }
2471         }
2472 }
2473 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2474         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2475                 let contents = if o.result_ok {
2476                         let result = unsafe { o.contents.result };
2477                         unsafe { o.contents.result = core::ptr::null_mut() };
2478                         CResult_RecoverableSignatureNoneZPtr { result }
2479                 } else {
2480                         let _ = unsafe { Box::from_raw(o.contents.err) };
2481                         o.contents.err = core::ptr::null_mut();
2482                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2483                 };
2484                 Self {
2485                         contents,
2486                         result_ok: o.result_ok,
2487                 }
2488         }
2489 }
2490 impl Clone for CResult_RecoverableSignatureNoneZ {
2491         fn clone(&self) -> Self {
2492                 if self.result_ok {
2493                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2494                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2495                         } }
2496                 } else {
2497                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2498                                 err: core::ptr::null_mut()
2499                         } }
2500                 }
2501         }
2502 }
2503 #[no_mangle]
2504 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2505 /// but with all dynamically-allocated buffers duplicated in new buffers.
2506 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2507 #[repr(C)]
2508 /// The contents of CResult_SchnorrSignatureNoneZ
2509 pub union CResult_SchnorrSignatureNoneZPtr {
2510         /// A pointer to the contents in the success state.
2511         /// Reading from this pointer when `result_ok` is not set is undefined.
2512         pub result: *mut crate::c_types::SchnorrSignature,
2513         /// Note that this value is always NULL, as there are no contents in the Err variant
2514         pub err: *mut core::ffi::c_void,
2515 }
2516 #[repr(C)]
2517 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2518 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_SchnorrSignatureNoneZ {
2521         /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2522         /// `err` or `result` depending on the state of `result_ok`.
2523         pub contents: CResult_SchnorrSignatureNoneZPtr,
2524         /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2525         pub result_ok: bool,
2526 }
2527 #[no_mangle]
2528 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2529 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2530         CResult_SchnorrSignatureNoneZ {
2531                 contents: CResult_SchnorrSignatureNoneZPtr {
2532                         result: Box::into_raw(Box::new(o)),
2533                 },
2534                 result_ok: true,
2535         }
2536 }
2537 #[no_mangle]
2538 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2539 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2540         CResult_SchnorrSignatureNoneZ {
2541                 contents: CResult_SchnorrSignatureNoneZPtr {
2542                         err: core::ptr::null_mut(),
2543                 },
2544                 result_ok: false,
2545         }
2546 }
2547 /// Checks if the given object is currently in the success state
2548 #[no_mangle]
2549 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2550         o.result_ok
2551 }
2552 #[no_mangle]
2553 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2554 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2555 impl Drop for CResult_SchnorrSignatureNoneZ {
2556         fn drop(&mut self) {
2557                 if self.result_ok {
2558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2560                         }
2561                 } else {
2562                 }
2563         }
2564 }
2565 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2566         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2567                 let contents = if o.result_ok {
2568                         let result = unsafe { o.contents.result };
2569                         unsafe { o.contents.result = core::ptr::null_mut() };
2570                         CResult_SchnorrSignatureNoneZPtr { result }
2571                 } else {
2572                         let _ = unsafe { Box::from_raw(o.contents.err) };
2573                         o.contents.err = core::ptr::null_mut();
2574                         CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2575                 };
2576                 Self {
2577                         contents,
2578                         result_ok: o.result_ok,
2579                 }
2580         }
2581 }
2582 impl Clone for CResult_SchnorrSignatureNoneZ {
2583         fn clone(&self) -> Self {
2584                 if self.result_ok {
2585                         Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2586                                 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2587                         } }
2588                 } else {
2589                         Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2590                                 err: core::ptr::null_mut()
2591                         } }
2592                 }
2593         }
2594 }
2595 #[no_mangle]
2596 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2597 /// but with all dynamically-allocated buffers duplicated in new buffers.
2598 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2599 #[repr(C)]
2600 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2601 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2602         /// A pointer to the contents in the success state.
2603         /// Reading from this pointer when `result_ok` is not set is undefined.
2604         pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2605         /// A pointer to the contents in the error state.
2606         /// Reading from this pointer when `result_ok` is set is undefined.
2607         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2608 }
2609 #[repr(C)]
2610 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2611 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2613 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2614         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2615         /// `err` or `result` depending on the state of `result_ok`.
2616         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2617         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2618         pub result_ok: bool,
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2622 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2623         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2624                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2625                         result: Box::into_raw(Box::new(o)),
2626                 },
2627                 result_ok: true,
2628         }
2629 }
2630 #[no_mangle]
2631 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2632 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2633         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2634                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2635                         err: Box::into_raw(Box::new(e)),
2636                 },
2637                 result_ok: false,
2638         }
2639 }
2640 /// Checks if the given object is currently in the success state
2641 #[no_mangle]
2642 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2643         o.result_ok
2644 }
2645 #[no_mangle]
2646 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2647 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2648 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2649         fn drop(&mut self) {
2650                 if self.result_ok {
2651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2653                         }
2654                 } else {
2655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2657                         }
2658                 }
2659         }
2660 }
2661 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2663                 let contents = if o.result_ok {
2664                         let result = unsafe { o.contents.result };
2665                         unsafe { o.contents.result = core::ptr::null_mut() };
2666                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2667                 } else {
2668                         let err = unsafe { o.contents.err };
2669                         unsafe { o.contents.err = core::ptr::null_mut(); }
2670                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2671                 };
2672                 Self {
2673                         contents,
2674                         result_ok: o.result_ok,
2675                 }
2676         }
2677 }
2678 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2679         fn clone(&self) -> Self {
2680                 if self.result_ok {
2681                         Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2682                                 result: Box::into_raw(Box::new(<crate::lightning::sign::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2683                         } }
2684                 } else {
2685                         Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2687                         } }
2688                 }
2689         }
2690 }
2691 #[no_mangle]
2692 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2693 /// but with all dynamically-allocated buffers duplicated in new buffers.
2694 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2695 #[repr(C)]
2696 /// The contents of CResult_CVec_u8ZNoneZ
2697 pub union CResult_CVec_u8ZNoneZPtr {
2698         /// A pointer to the contents in the success state.
2699         /// Reading from this pointer when `result_ok` is not set is undefined.
2700         pub result: *mut crate::c_types::derived::CVec_u8Z,
2701         /// Note that this value is always NULL, as there are no contents in the Err variant
2702         pub err: *mut core::ffi::c_void,
2703 }
2704 #[repr(C)]
2705 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2706 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2708 pub struct CResult_CVec_u8ZNoneZ {
2709         /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2710         /// `err` or `result` depending on the state of `result_ok`.
2711         pub contents: CResult_CVec_u8ZNoneZPtr,
2712         /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2713         pub result_ok: bool,
2714 }
2715 #[no_mangle]
2716 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2717 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2718         CResult_CVec_u8ZNoneZ {
2719                 contents: CResult_CVec_u8ZNoneZPtr {
2720                         result: Box::into_raw(Box::new(o)),
2721                 },
2722                 result_ok: true,
2723         }
2724 }
2725 #[no_mangle]
2726 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2727 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2728         CResult_CVec_u8ZNoneZ {
2729                 contents: CResult_CVec_u8ZNoneZPtr {
2730                         err: core::ptr::null_mut(),
2731                 },
2732                 result_ok: false,
2733         }
2734 }
2735 /// Checks if the given object is currently in the success state
2736 #[no_mangle]
2737 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2738         o.result_ok
2739 }
2740 #[no_mangle]
2741 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2742 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2743 impl Drop for CResult_CVec_u8ZNoneZ {
2744         fn drop(&mut self) {
2745                 if self.result_ok {
2746                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2747                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2748                         }
2749                 } else {
2750                 }
2751         }
2752 }
2753 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2754         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2755                 let contents = if o.result_ok {
2756                         let result = unsafe { o.contents.result };
2757                         unsafe { o.contents.result = core::ptr::null_mut() };
2758                         CResult_CVec_u8ZNoneZPtr { result }
2759                 } else {
2760                         let _ = unsafe { Box::from_raw(o.contents.err) };
2761                         o.contents.err = core::ptr::null_mut();
2762                         CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2763                 };
2764                 Self {
2765                         contents,
2766                         result_ok: o.result_ok,
2767                 }
2768         }
2769 }
2770 impl Clone for CResult_CVec_u8ZNoneZ {
2771         fn clone(&self) -> Self {
2772                 if self.result_ok {
2773                         Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2774                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2775                         } }
2776                 } else {
2777                         Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2778                                 err: core::ptr::null_mut()
2779                         } }
2780                 }
2781         }
2782 }
2783 #[no_mangle]
2784 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2785 /// but with all dynamically-allocated buffers duplicated in new buffers.
2786 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2787 #[repr(C)]
2788 /// The contents of CResult_ShutdownScriptNoneZ
2789 pub union CResult_ShutdownScriptNoneZPtr {
2790         /// A pointer to the contents in the success state.
2791         /// Reading from this pointer when `result_ok` is not set is undefined.
2792         pub result: *mut crate::lightning::ln::script::ShutdownScript,
2793         /// Note that this value is always NULL, as there are no contents in the Err variant
2794         pub err: *mut core::ffi::c_void,
2795 }
2796 #[repr(C)]
2797 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2798 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2800 pub struct CResult_ShutdownScriptNoneZ {
2801         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2802         /// `err` or `result` depending on the state of `result_ok`.
2803         pub contents: CResult_ShutdownScriptNoneZPtr,
2804         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2805         pub result_ok: bool,
2806 }
2807 #[no_mangle]
2808 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2809 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2810         CResult_ShutdownScriptNoneZ {
2811                 contents: CResult_ShutdownScriptNoneZPtr {
2812                         result: Box::into_raw(Box::new(o)),
2813                 },
2814                 result_ok: true,
2815         }
2816 }
2817 #[no_mangle]
2818 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2819 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2820         CResult_ShutdownScriptNoneZ {
2821                 contents: CResult_ShutdownScriptNoneZPtr {
2822                         err: core::ptr::null_mut(),
2823                 },
2824                 result_ok: false,
2825         }
2826 }
2827 /// Checks if the given object is currently in the success state
2828 #[no_mangle]
2829 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2830         o.result_ok
2831 }
2832 #[no_mangle]
2833 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2834 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2835 impl Drop for CResult_ShutdownScriptNoneZ {
2836         fn drop(&mut self) {
2837                 if self.result_ok {
2838                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2839                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2840                         }
2841                 } else {
2842                 }
2843         }
2844 }
2845 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2846         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2847                 let contents = if o.result_ok {
2848                         let result = unsafe { o.contents.result };
2849                         unsafe { o.contents.result = core::ptr::null_mut() };
2850                         CResult_ShutdownScriptNoneZPtr { result }
2851                 } else {
2852                         let _ = unsafe { Box::from_raw(o.contents.err) };
2853                         o.contents.err = core::ptr::null_mut();
2854                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2855                 };
2856                 Self {
2857                         contents,
2858                         result_ok: o.result_ok,
2859                 }
2860         }
2861 }
2862 impl Clone for CResult_ShutdownScriptNoneZ {
2863         fn clone(&self) -> Self {
2864                 if self.result_ok {
2865                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2866                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2867                         } }
2868                 } else {
2869                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2870                                 err: core::ptr::null_mut()
2871                         } }
2872                 }
2873         }
2874 }
2875 #[no_mangle]
2876 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2877 /// but with all dynamically-allocated buffers duplicated in new buffers.
2878 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2879 #[repr(C)]
2880 #[derive(Clone)]
2881 /// An enum which can either contain a u16 or not
2882 pub enum COption_u16Z {
2883         /// When we're in this state, this COption_u16Z contains a u16
2884         Some(u16),
2885         /// When we're in this state, this COption_u16Z contains nothing
2886         None
2887 }
2888 impl COption_u16Z {
2889         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2890                 if let Self::None = self { false } else { true }
2891         }
2892         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2893                 !self.is_some()
2894         }
2895         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2896                 if let Self::Some(v) = self { v } else { unreachable!() }
2897         }
2898 }
2899 #[no_mangle]
2900 /// Constructs a new COption_u16Z containing a u16
2901 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2902         COption_u16Z::Some(o)
2903 }
2904 #[no_mangle]
2905 /// Constructs a new COption_u16Z containing nothing
2906 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2907         COption_u16Z::None
2908 }
2909 #[no_mangle]
2910 /// Frees any resources associated with the u16, if we are in the Some state
2911 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2912 #[no_mangle]
2913 /// Creates a new COption_u16Z which has the same data as `orig`
2914 /// but with all dynamically-allocated buffers duplicated in new buffers.
2915 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2916 #[repr(C)]
2917 #[derive(Clone)]
2918 /// An enum which can either contain a bool or not
2919 pub enum COption_boolZ {
2920         /// When we're in this state, this COption_boolZ contains a bool
2921         Some(bool),
2922         /// When we're in this state, this COption_boolZ contains nothing
2923         None
2924 }
2925 impl COption_boolZ {
2926         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2927                 if let Self::None = self { false } else { true }
2928         }
2929         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2930                 !self.is_some()
2931         }
2932         #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2933                 if let Self::Some(v) = self { v } else { unreachable!() }
2934         }
2935 }
2936 #[no_mangle]
2937 /// Constructs a new COption_boolZ containing a bool
2938 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2939         COption_boolZ::Some(o)
2940 }
2941 #[no_mangle]
2942 /// Constructs a new COption_boolZ containing nothing
2943 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2944         COption_boolZ::None
2945 }
2946 #[no_mangle]
2947 /// Frees any resources associated with the bool, if we are in the Some state
2948 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2949 #[no_mangle]
2950 /// Creates a new COption_boolZ which has the same data as `orig`
2951 /// but with all dynamically-allocated buffers duplicated in new buffers.
2952 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2953 #[repr(C)]
2954 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2955 /// This corresponds to std::vector in C++
2956 pub struct CVec_CVec_u8ZZ {
2957         /// The elements in the array.
2958         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2959         pub data: *mut crate::c_types::derived::CVec_u8Z,
2960         /// The number of elements pointed to by `data`.
2961         pub datalen: usize
2962 }
2963 impl CVec_CVec_u8ZZ {
2964         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2965                 if self.datalen == 0 { return Vec::new(); }
2966                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2967                 self.data = core::ptr::null_mut();
2968                 self.datalen = 0;
2969                 ret
2970         }
2971         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2972                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2973         }
2974 }
2975 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2976         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2977                 let datalen = v.len();
2978                 let data = Box::into_raw(v.into_boxed_slice());
2979                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2980         }
2981 }
2982 #[no_mangle]
2983 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2984 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2985 impl Drop for CVec_CVec_u8ZZ {
2986         fn drop(&mut self) {
2987                 if self.datalen == 0 { return; }
2988                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2989         }
2990 }
2991 impl Clone for CVec_CVec_u8ZZ {
2992         fn clone(&self) -> Self {
2993                 let mut res = Vec::new();
2994                 if self.datalen == 0 { return Self::from(res); }
2995                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2996                 Self::from(res)
2997         }
2998 }
2999 #[repr(C)]
3000 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3001 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3002         /// A pointer to the contents in the success state.
3003         /// Reading from this pointer when `result_ok` is not set is undefined.
3004         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3005         /// Note that this value is always NULL, as there are no contents in the Err variant
3006         pub err: *mut core::ffi::c_void,
3007 }
3008 #[repr(C)]
3009 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3010 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3011 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3012 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3013         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3014         /// `err` or `result` depending on the state of `result_ok`.
3015         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3016         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3017         pub result_ok: bool,
3018 }
3019 #[no_mangle]
3020 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3021 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3022         CResult_CVec_CVec_u8ZZNoneZ {
3023                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3024                         result: Box::into_raw(Box::new(o)),
3025                 },
3026                 result_ok: true,
3027         }
3028 }
3029 #[no_mangle]
3030 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3031 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3032         CResult_CVec_CVec_u8ZZNoneZ {
3033                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3034                         err: core::ptr::null_mut(),
3035                 },
3036                 result_ok: false,
3037         }
3038 }
3039 /// Checks if the given object is currently in the success state
3040 #[no_mangle]
3041 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
3042         o.result_ok
3043 }
3044 #[no_mangle]
3045 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3046 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3047 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3048         fn drop(&mut self) {
3049                 if self.result_ok {
3050                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3051                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3052                         }
3053                 } else {
3054                 }
3055         }
3056 }
3057 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3058         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3059                 let contents = if o.result_ok {
3060                         let result = unsafe { o.contents.result };
3061                         unsafe { o.contents.result = core::ptr::null_mut() };
3062                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
3063                 } else {
3064                         let _ = unsafe { Box::from_raw(o.contents.err) };
3065                         o.contents.err = core::ptr::null_mut();
3066                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
3067                 };
3068                 Self {
3069                         contents,
3070                         result_ok: o.result_ok,
3071                 }
3072         }
3073 }
3074 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3075         fn clone(&self) -> Self {
3076                 if self.result_ok {
3077                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3078                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3079                         } }
3080                 } else {
3081                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3082                                 err: core::ptr::null_mut()
3083                         } }
3084                 }
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3089 /// but with all dynamically-allocated buffers duplicated in new buffers.
3090 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
3091 #[repr(C)]
3092 /// The contents of CResult_InMemorySignerDecodeErrorZ
3093 pub union CResult_InMemorySignerDecodeErrorZPtr {
3094         /// A pointer to the contents in the success state.
3095         /// Reading from this pointer when `result_ok` is not set is undefined.
3096         pub result: *mut crate::lightning::sign::InMemorySigner,
3097         /// A pointer to the contents in the error state.
3098         /// Reading from this pointer when `result_ok` is set is undefined.
3099         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3100 }
3101 #[repr(C)]
3102 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3103 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3105 pub struct CResult_InMemorySignerDecodeErrorZ {
3106         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3107         /// `err` or `result` depending on the state of `result_ok`.
3108         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3109         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3110         pub result_ok: bool,
3111 }
3112 #[no_mangle]
3113 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3114 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3115         CResult_InMemorySignerDecodeErrorZ {
3116                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3117                         result: Box::into_raw(Box::new(o)),
3118                 },
3119                 result_ok: true,
3120         }
3121 }
3122 #[no_mangle]
3123 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3124 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3125         CResult_InMemorySignerDecodeErrorZ {
3126                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3127                         err: Box::into_raw(Box::new(e)),
3128                 },
3129                 result_ok: false,
3130         }
3131 }
3132 /// Checks if the given object is currently in the success state
3133 #[no_mangle]
3134 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3135         o.result_ok
3136 }
3137 #[no_mangle]
3138 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3139 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3140 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3141         fn drop(&mut self) {
3142                 if self.result_ok {
3143                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3144                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3145                         }
3146                 } else {
3147                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3148                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3149                         }
3150                 }
3151         }
3152 }
3153 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3154         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3155                 let contents = if o.result_ok {
3156                         let result = unsafe { o.contents.result };
3157                         unsafe { o.contents.result = core::ptr::null_mut() };
3158                         CResult_InMemorySignerDecodeErrorZPtr { result }
3159                 } else {
3160                         let err = unsafe { o.contents.err };
3161                         unsafe { o.contents.err = core::ptr::null_mut(); }
3162                         CResult_InMemorySignerDecodeErrorZPtr { err }
3163                 };
3164                 Self {
3165                         contents,
3166                         result_ok: o.result_ok,
3167                 }
3168         }
3169 }
3170 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3171         fn clone(&self) -> Self {
3172                 if self.result_ok {
3173                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3174                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3175                         } }
3176                 } else {
3177                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3178                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3179                         } }
3180                 }
3181         }
3182 }
3183 #[no_mangle]
3184 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3185 /// but with all dynamically-allocated buffers duplicated in new buffers.
3186 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3187 #[repr(C)]
3188 /// The contents of CResult_TransactionNoneZ
3189 pub union CResult_TransactionNoneZPtr {
3190         /// A pointer to the contents in the success state.
3191         /// Reading from this pointer when `result_ok` is not set is undefined.
3192         pub result: *mut crate::c_types::Transaction,
3193         /// Note that this value is always NULL, as there are no contents in the Err variant
3194         pub err: *mut core::ffi::c_void,
3195 }
3196 #[repr(C)]
3197 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3198 /// containing a crate::c_types::Transaction on success and a () on failure.
3199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3200 pub struct CResult_TransactionNoneZ {
3201         /// The contents of this CResult_TransactionNoneZ, accessible via either
3202         /// `err` or `result` depending on the state of `result_ok`.
3203         pub contents: CResult_TransactionNoneZPtr,
3204         /// Whether this CResult_TransactionNoneZ represents a success state.
3205         pub result_ok: bool,
3206 }
3207 #[no_mangle]
3208 /// Creates a new CResult_TransactionNoneZ in the success state.
3209 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3210         CResult_TransactionNoneZ {
3211                 contents: CResult_TransactionNoneZPtr {
3212                         result: Box::into_raw(Box::new(o)),
3213                 },
3214                 result_ok: true,
3215         }
3216 }
3217 #[no_mangle]
3218 /// Creates a new CResult_TransactionNoneZ in the error state.
3219 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3220         CResult_TransactionNoneZ {
3221                 contents: CResult_TransactionNoneZPtr {
3222                         err: core::ptr::null_mut(),
3223                 },
3224                 result_ok: false,
3225         }
3226 }
3227 /// Checks if the given object is currently in the success state
3228 #[no_mangle]
3229 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3230         o.result_ok
3231 }
3232 #[no_mangle]
3233 /// Frees any resources used by the CResult_TransactionNoneZ.
3234 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3235 impl Drop for CResult_TransactionNoneZ {
3236         fn drop(&mut self) {
3237                 if self.result_ok {
3238                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3239                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3240                         }
3241                 } else {
3242                 }
3243         }
3244 }
3245 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3246         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3247                 let contents = if o.result_ok {
3248                         let result = unsafe { o.contents.result };
3249                         unsafe { o.contents.result = core::ptr::null_mut() };
3250                         CResult_TransactionNoneZPtr { result }
3251                 } else {
3252                         let _ = unsafe { Box::from_raw(o.contents.err) };
3253                         o.contents.err = core::ptr::null_mut();
3254                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3255                 };
3256                 Self {
3257                         contents,
3258                         result_ok: o.result_ok,
3259                 }
3260         }
3261 }
3262 impl Clone for CResult_TransactionNoneZ {
3263         fn clone(&self) -> Self {
3264                 if self.result_ok {
3265                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3266                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3267                         } }
3268                 } else {
3269                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3270                                 err: core::ptr::null_mut()
3271                         } }
3272                 }
3273         }
3274 }
3275 #[no_mangle]
3276 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3277 /// but with all dynamically-allocated buffers duplicated in new buffers.
3278 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3279 #[repr(C)]
3280 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3281 pub enum COption_WriteableScoreZ {
3282         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3283         Some(crate::lightning::routing::scoring::WriteableScore),
3284         /// When we're in this state, this COption_WriteableScoreZ contains nothing
3285         None
3286 }
3287 impl COption_WriteableScoreZ {
3288         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3289                 if let Self::None = self { false } else { true }
3290         }
3291         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3292                 !self.is_some()
3293         }
3294         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3295                 if let Self::Some(v) = self { v } else { unreachable!() }
3296         }
3297 }
3298 #[no_mangle]
3299 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3300 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3301         COption_WriteableScoreZ::Some(o)
3302 }
3303 #[no_mangle]
3304 /// Constructs a new COption_WriteableScoreZ containing nothing
3305 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3306         COption_WriteableScoreZ::None
3307 }
3308 #[no_mangle]
3309 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3310 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3311 #[repr(C)]
3312 /// The contents of CResult_NoneIOErrorZ
3313 pub union CResult_NoneIOErrorZPtr {
3314         /// Note that this value is always NULL, as there are no contents in the OK variant
3315         pub result: *mut core::ffi::c_void,
3316         /// A pointer to the contents in the error state.
3317         /// Reading from this pointer when `result_ok` is set is undefined.
3318         pub err: *mut crate::c_types::IOError,
3319 }
3320 #[repr(C)]
3321 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3322 /// containing a () on success and a crate::c_types::IOError on failure.
3323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3324 pub struct CResult_NoneIOErrorZ {
3325         /// The contents of this CResult_NoneIOErrorZ, accessible via either
3326         /// `err` or `result` depending on the state of `result_ok`.
3327         pub contents: CResult_NoneIOErrorZPtr,
3328         /// Whether this CResult_NoneIOErrorZ represents a success state.
3329         pub result_ok: bool,
3330 }
3331 #[no_mangle]
3332 /// Creates a new CResult_NoneIOErrorZ in the success state.
3333 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3334         CResult_NoneIOErrorZ {
3335                 contents: CResult_NoneIOErrorZPtr {
3336                         result: core::ptr::null_mut(),
3337                 },
3338                 result_ok: true,
3339         }
3340 }
3341 #[no_mangle]
3342 /// Creates a new CResult_NoneIOErrorZ in the error state.
3343 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3344         CResult_NoneIOErrorZ {
3345                 contents: CResult_NoneIOErrorZPtr {
3346                         err: Box::into_raw(Box::new(e)),
3347                 },
3348                 result_ok: false,
3349         }
3350 }
3351 /// Checks if the given object is currently in the success state
3352 #[no_mangle]
3353 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3354         o.result_ok
3355 }
3356 #[no_mangle]
3357 /// Frees any resources used by the CResult_NoneIOErrorZ.
3358 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3359 impl Drop for CResult_NoneIOErrorZ {
3360         fn drop(&mut self) {
3361                 if self.result_ok {
3362                 } else {
3363                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3364                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3365                         }
3366                 }
3367         }
3368 }
3369 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3370         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3371                 let contents = if o.result_ok {
3372                         let _ = unsafe { Box::from_raw(o.contents.result) };
3373                         o.contents.result = core::ptr::null_mut();
3374                         CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3375                 } else {
3376                         let err = unsafe { o.contents.err };
3377                         unsafe { o.contents.err = core::ptr::null_mut(); }
3378                         CResult_NoneIOErrorZPtr { err }
3379                 };
3380                 Self {
3381                         contents,
3382                         result_ok: o.result_ok,
3383                 }
3384         }
3385 }
3386 impl Clone for CResult_NoneIOErrorZ {
3387         fn clone(&self) -> Self {
3388                 if self.result_ok {
3389                         Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3390                                 result: core::ptr::null_mut()
3391                         } }
3392                 } else {
3393                         Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3394                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3395                         } }
3396                 }
3397         }
3398 }
3399 #[no_mangle]
3400 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3401 /// but with all dynamically-allocated buffers duplicated in new buffers.
3402 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3403 #[repr(C)]
3404 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3405 /// This corresponds to std::vector in C++
3406 pub struct CVec_ChannelDetailsZ {
3407         /// The elements in the array.
3408         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3409         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3410         /// The number of elements pointed to by `data`.
3411         pub datalen: usize
3412 }
3413 impl CVec_ChannelDetailsZ {
3414         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3415                 if self.datalen == 0 { return Vec::new(); }
3416                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3417                 self.data = core::ptr::null_mut();
3418                 self.datalen = 0;
3419                 ret
3420         }
3421         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3422                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3423         }
3424 }
3425 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3426         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3427                 let datalen = v.len();
3428                 let data = Box::into_raw(v.into_boxed_slice());
3429                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3430         }
3431 }
3432 #[no_mangle]
3433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3434 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3435 impl Drop for CVec_ChannelDetailsZ {
3436         fn drop(&mut self) {
3437                 if self.datalen == 0 { return; }
3438                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3439         }
3440 }
3441 impl Clone for CVec_ChannelDetailsZ {
3442         fn clone(&self) -> Self {
3443                 let mut res = Vec::new();
3444                 if self.datalen == 0 { return Self::from(res); }
3445                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3446                 Self::from(res)
3447         }
3448 }
3449 #[repr(C)]
3450 /// The contents of CResult_RouteLightningErrorZ
3451 pub union CResult_RouteLightningErrorZPtr {
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::Route,
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::LightningError,
3458 }
3459 #[repr(C)]
3460 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3461 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3463 pub struct CResult_RouteLightningErrorZ {
3464         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3465         /// `err` or `result` depending on the state of `result_ok`.
3466         pub contents: CResult_RouteLightningErrorZPtr,
3467         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3468         pub result_ok: bool,
3469 }
3470 #[no_mangle]
3471 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3472 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3473         CResult_RouteLightningErrorZ {
3474                 contents: CResult_RouteLightningErrorZPtr {
3475                         result: Box::into_raw(Box::new(o)),
3476                 },
3477                 result_ok: true,
3478         }
3479 }
3480 #[no_mangle]
3481 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3482 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3483         CResult_RouteLightningErrorZ {
3484                 contents: CResult_RouteLightningErrorZPtr {
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_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3493         o.result_ok
3494 }
3495 #[no_mangle]
3496 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3497 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3498 impl Drop for CResult_RouteLightningErrorZ {
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::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> 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_RouteLightningErrorZPtr { result }
3517                 } else {
3518                         let err = unsafe { o.contents.err };
3519                         unsafe { o.contents.err = core::ptr::null_mut(); }
3520                         CResult_RouteLightningErrorZPtr { err }
3521                 };
3522                 Self {
3523                         contents,
3524                         result_ok: o.result_ok,
3525                 }
3526         }
3527 }
3528 impl Clone for CResult_RouteLightningErrorZ {
3529         fn clone(&self) -> Self {
3530                 if self.result_ok {
3531                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3532                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3533                         } }
3534                 } else {
3535                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3537                         } }
3538                 }
3539         }
3540 }
3541 #[no_mangle]
3542 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3543 /// but with all dynamically-allocated buffers duplicated in new buffers.
3544 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3545 #[repr(C)]
3546 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3547 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3548         /// A pointer to the contents in the success state.
3549         /// Reading from this pointer when `result_ok` is not set is undefined.
3550         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3551         /// A pointer to the contents in the error state.
3552         /// Reading from this pointer when `result_ok` is set is undefined.
3553         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3554 }
3555 #[repr(C)]
3556 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3557 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3559 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3560         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3561         /// `err` or `result` depending on the state of `result_ok`.
3562         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3563         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3564         pub result_ok: bool,
3565 }
3566 #[no_mangle]
3567 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3568 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3569         CResult_InFlightHtlcsDecodeErrorZ {
3570                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3571                         result: Box::into_raw(Box::new(o)),
3572                 },
3573                 result_ok: true,
3574         }
3575 }
3576 #[no_mangle]
3577 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3578 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3579         CResult_InFlightHtlcsDecodeErrorZ {
3580                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3581                         err: Box::into_raw(Box::new(e)),
3582                 },
3583                 result_ok: false,
3584         }
3585 }
3586 /// Checks if the given object is currently in the success state
3587 #[no_mangle]
3588 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3589         o.result_ok
3590 }
3591 #[no_mangle]
3592 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3593 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3594 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3595         fn drop(&mut self) {
3596                 if self.result_ok {
3597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3599                         }
3600                 } else {
3601                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3602                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3603                         }
3604                 }
3605         }
3606 }
3607 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3608         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3609                 let contents = if o.result_ok {
3610                         let result = unsafe { o.contents.result };
3611                         unsafe { o.contents.result = core::ptr::null_mut() };
3612                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
3613                 } else {
3614                         let err = unsafe { o.contents.err };
3615                         unsafe { o.contents.err = core::ptr::null_mut(); }
3616                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
3617                 };
3618                 Self {
3619                         contents,
3620                         result_ok: o.result_ok,
3621                 }
3622         }
3623 }
3624 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3625         fn clone(&self) -> Self {
3626                 if self.result_ok {
3627                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3628                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3629                         } }
3630                 } else {
3631                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3632                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3633                         } }
3634                 }
3635         }
3636 }
3637 #[no_mangle]
3638 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3639 /// but with all dynamically-allocated buffers duplicated in new buffers.
3640 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3641 #[repr(C)]
3642 /// The contents of CResult_RouteHopDecodeErrorZ
3643 pub union CResult_RouteHopDecodeErrorZPtr {
3644         /// A pointer to the contents in the success state.
3645         /// Reading from this pointer when `result_ok` is not set is undefined.
3646         pub result: *mut crate::lightning::routing::router::RouteHop,
3647         /// A pointer to the contents in the error state.
3648         /// Reading from this pointer when `result_ok` is set is undefined.
3649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3650 }
3651 #[repr(C)]
3652 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3653 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3655 pub struct CResult_RouteHopDecodeErrorZ {
3656         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3657         /// `err` or `result` depending on the state of `result_ok`.
3658         pub contents: CResult_RouteHopDecodeErrorZPtr,
3659         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3660         pub result_ok: bool,
3661 }
3662 #[no_mangle]
3663 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3664 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3665         CResult_RouteHopDecodeErrorZ {
3666                 contents: CResult_RouteHopDecodeErrorZPtr {
3667                         result: Box::into_raw(Box::new(o)),
3668                 },
3669                 result_ok: true,
3670         }
3671 }
3672 #[no_mangle]
3673 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3674 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3675         CResult_RouteHopDecodeErrorZ {
3676                 contents: CResult_RouteHopDecodeErrorZPtr {
3677                         err: Box::into_raw(Box::new(e)),
3678                 },
3679                 result_ok: false,
3680         }
3681 }
3682 /// Checks if the given object is currently in the success state
3683 #[no_mangle]
3684 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3685         o.result_ok
3686 }
3687 #[no_mangle]
3688 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3689 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3690 impl Drop for CResult_RouteHopDecodeErrorZ {
3691         fn drop(&mut self) {
3692                 if self.result_ok {
3693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3695                         }
3696                 } else {
3697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3699                         }
3700                 }
3701         }
3702 }
3703 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3704         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3705                 let contents = if o.result_ok {
3706                         let result = unsafe { o.contents.result };
3707                         unsafe { o.contents.result = core::ptr::null_mut() };
3708                         CResult_RouteHopDecodeErrorZPtr { result }
3709                 } else {
3710                         let err = unsafe { o.contents.err };
3711                         unsafe { o.contents.err = core::ptr::null_mut(); }
3712                         CResult_RouteHopDecodeErrorZPtr { err }
3713                 };
3714                 Self {
3715                         contents,
3716                         result_ok: o.result_ok,
3717                 }
3718         }
3719 }
3720 impl Clone for CResult_RouteHopDecodeErrorZ {
3721         fn clone(&self) -> Self {
3722                 if self.result_ok {
3723                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3724                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3725                         } }
3726                 } else {
3727                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3728                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3729                         } }
3730                 }
3731         }
3732 }
3733 #[no_mangle]
3734 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3735 /// but with all dynamically-allocated buffers duplicated in new buffers.
3736 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3737 #[repr(C)]
3738 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3739 /// This corresponds to std::vector in C++
3740 pub struct CVec_BlindedHopZ {
3741         /// The elements in the array.
3742         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3743         pub data: *mut crate::lightning::blinded_path::BlindedHop,
3744         /// The number of elements pointed to by `data`.
3745         pub datalen: usize
3746 }
3747 impl CVec_BlindedHopZ {
3748         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3749                 if self.datalen == 0 { return Vec::new(); }
3750                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3751                 self.data = core::ptr::null_mut();
3752                 self.datalen = 0;
3753                 ret
3754         }
3755         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3756                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3757         }
3758 }
3759 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3760         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3761                 let datalen = v.len();
3762                 let data = Box::into_raw(v.into_boxed_slice());
3763                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3764         }
3765 }
3766 #[no_mangle]
3767 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3768 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3769 impl Drop for CVec_BlindedHopZ {
3770         fn drop(&mut self) {
3771                 if self.datalen == 0 { return; }
3772                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3773         }
3774 }
3775 impl Clone for CVec_BlindedHopZ {
3776         fn clone(&self) -> Self {
3777                 let mut res = Vec::new();
3778                 if self.datalen == 0 { return Self::from(res); }
3779                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3780                 Self::from(res)
3781         }
3782 }
3783 #[repr(C)]
3784 /// The contents of CResult_BlindedTailDecodeErrorZ
3785 pub union CResult_BlindedTailDecodeErrorZPtr {
3786         /// A pointer to the contents in the success state.
3787         /// Reading from this pointer when `result_ok` is not set is undefined.
3788         pub result: *mut crate::lightning::routing::router::BlindedTail,
3789         /// A pointer to the contents in the error state.
3790         /// Reading from this pointer when `result_ok` is set is undefined.
3791         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3792 }
3793 #[repr(C)]
3794 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3795 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3797 pub struct CResult_BlindedTailDecodeErrorZ {
3798         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3799         /// `err` or `result` depending on the state of `result_ok`.
3800         pub contents: CResult_BlindedTailDecodeErrorZPtr,
3801         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3802         pub result_ok: bool,
3803 }
3804 #[no_mangle]
3805 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3806 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3807         CResult_BlindedTailDecodeErrorZ {
3808                 contents: CResult_BlindedTailDecodeErrorZPtr {
3809                         result: Box::into_raw(Box::new(o)),
3810                 },
3811                 result_ok: true,
3812         }
3813 }
3814 #[no_mangle]
3815 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3816 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3817         CResult_BlindedTailDecodeErrorZ {
3818                 contents: CResult_BlindedTailDecodeErrorZPtr {
3819                         err: Box::into_raw(Box::new(e)),
3820                 },
3821                 result_ok: false,
3822         }
3823 }
3824 /// Checks if the given object is currently in the success state
3825 #[no_mangle]
3826 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3827         o.result_ok
3828 }
3829 #[no_mangle]
3830 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3831 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3832 impl Drop for CResult_BlindedTailDecodeErrorZ {
3833         fn drop(&mut self) {
3834                 if self.result_ok {
3835                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3836                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3837                         }
3838                 } else {
3839                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3840                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3841                         }
3842                 }
3843         }
3844 }
3845 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3846         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3847                 let contents = if o.result_ok {
3848                         let result = unsafe { o.contents.result };
3849                         unsafe { o.contents.result = core::ptr::null_mut() };
3850                         CResult_BlindedTailDecodeErrorZPtr { result }
3851                 } else {
3852                         let err = unsafe { o.contents.err };
3853                         unsafe { o.contents.err = core::ptr::null_mut(); }
3854                         CResult_BlindedTailDecodeErrorZPtr { err }
3855                 };
3856                 Self {
3857                         contents,
3858                         result_ok: o.result_ok,
3859                 }
3860         }
3861 }
3862 impl Clone for CResult_BlindedTailDecodeErrorZ {
3863         fn clone(&self) -> Self {
3864                 if self.result_ok {
3865                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3866                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3867                         } }
3868                 } else {
3869                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3870                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3871                         } }
3872                 }
3873         }
3874 }
3875 #[no_mangle]
3876 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3877 /// but with all dynamically-allocated buffers duplicated in new buffers.
3878 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3879 #[repr(C)]
3880 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3881 /// This corresponds to std::vector in C++
3882 pub struct CVec_RouteHopZ {
3883         /// The elements in the array.
3884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3885         pub data: *mut crate::lightning::routing::router::RouteHop,
3886         /// The number of elements pointed to by `data`.
3887         pub datalen: usize
3888 }
3889 impl CVec_RouteHopZ {
3890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3891                 if self.datalen == 0 { return Vec::new(); }
3892                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3893                 self.data = core::ptr::null_mut();
3894                 self.datalen = 0;
3895                 ret
3896         }
3897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3898                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3899         }
3900 }
3901 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3902         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3903                 let datalen = v.len();
3904                 let data = Box::into_raw(v.into_boxed_slice());
3905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3906         }
3907 }
3908 #[no_mangle]
3909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3910 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3911 impl Drop for CVec_RouteHopZ {
3912         fn drop(&mut self) {
3913                 if self.datalen == 0 { return; }
3914                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3915         }
3916 }
3917 impl Clone for CVec_RouteHopZ {
3918         fn clone(&self) -> Self {
3919                 let mut res = Vec::new();
3920                 if self.datalen == 0 { return Self::from(res); }
3921                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3922                 Self::from(res)
3923         }
3924 }
3925 #[repr(C)]
3926 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3927 /// This corresponds to std::vector in C++
3928 pub struct CVec_PathZ {
3929         /// The elements in the array.
3930         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3931         pub data: *mut crate::lightning::routing::router::Path,
3932         /// The number of elements pointed to by `data`.
3933         pub datalen: usize
3934 }
3935 impl CVec_PathZ {
3936         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3937                 if self.datalen == 0 { return Vec::new(); }
3938                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3939                 self.data = core::ptr::null_mut();
3940                 self.datalen = 0;
3941                 ret
3942         }
3943         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3944                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3945         }
3946 }
3947 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3948         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3949                 let datalen = v.len();
3950                 let data = Box::into_raw(v.into_boxed_slice());
3951                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3952         }
3953 }
3954 #[no_mangle]
3955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3956 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3957 impl Drop for CVec_PathZ {
3958         fn drop(&mut self) {
3959                 if self.datalen == 0 { return; }
3960                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3961         }
3962 }
3963 impl Clone for CVec_PathZ {
3964         fn clone(&self) -> Self {
3965                 let mut res = Vec::new();
3966                 if self.datalen == 0 { return Self::from(res); }
3967                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3968                 Self::from(res)
3969         }
3970 }
3971 #[repr(C)]
3972 /// The contents of CResult_RouteDecodeErrorZ
3973 pub union CResult_RouteDecodeErrorZPtr {
3974         /// A pointer to the contents in the success state.
3975         /// Reading from this pointer when `result_ok` is not set is undefined.
3976         pub result: *mut crate::lightning::routing::router::Route,
3977         /// A pointer to the contents in the error state.
3978         /// Reading from this pointer when `result_ok` is set is undefined.
3979         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3980 }
3981 #[repr(C)]
3982 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3983 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3985 pub struct CResult_RouteDecodeErrorZ {
3986         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3987         /// `err` or `result` depending on the state of `result_ok`.
3988         pub contents: CResult_RouteDecodeErrorZPtr,
3989         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3990         pub result_ok: bool,
3991 }
3992 #[no_mangle]
3993 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3994 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3995         CResult_RouteDecodeErrorZ {
3996                 contents: CResult_RouteDecodeErrorZPtr {
3997                         result: Box::into_raw(Box::new(o)),
3998                 },
3999                 result_ok: true,
4000         }
4001 }
4002 #[no_mangle]
4003 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4004 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4005         CResult_RouteDecodeErrorZ {
4006                 contents: CResult_RouteDecodeErrorZPtr {
4007                         err: Box::into_raw(Box::new(e)),
4008                 },
4009                 result_ok: false,
4010         }
4011 }
4012 /// Checks if the given object is currently in the success state
4013 #[no_mangle]
4014 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4015         o.result_ok
4016 }
4017 #[no_mangle]
4018 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4019 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4020 impl Drop for CResult_RouteDecodeErrorZ {
4021         fn drop(&mut self) {
4022                 if self.result_ok {
4023                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4024                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4025                         }
4026                 } else {
4027                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4028                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4029                         }
4030                 }
4031         }
4032 }
4033 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4034         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4035                 let contents = if o.result_ok {
4036                         let result = unsafe { o.contents.result };
4037                         unsafe { o.contents.result = core::ptr::null_mut() };
4038                         CResult_RouteDecodeErrorZPtr { result }
4039                 } else {
4040                         let err = unsafe { o.contents.err };
4041                         unsafe { o.contents.err = core::ptr::null_mut(); }
4042                         CResult_RouteDecodeErrorZPtr { err }
4043                 };
4044                 Self {
4045                         contents,
4046                         result_ok: o.result_ok,
4047                 }
4048         }
4049 }
4050 impl Clone for CResult_RouteDecodeErrorZ {
4051         fn clone(&self) -> Self {
4052                 if self.result_ok {
4053                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4054                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4055                         } }
4056                 } else {
4057                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4058                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4059                         } }
4060                 }
4061         }
4062 }
4063 #[no_mangle]
4064 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4065 /// but with all dynamically-allocated buffers duplicated in new buffers.
4066 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4067 #[repr(C)]
4068 /// The contents of CResult_RouteParametersDecodeErrorZ
4069 pub union CResult_RouteParametersDecodeErrorZPtr {
4070         /// A pointer to the contents in the success state.
4071         /// Reading from this pointer when `result_ok` is not set is undefined.
4072         pub result: *mut crate::lightning::routing::router::RouteParameters,
4073         /// A pointer to the contents in the error state.
4074         /// Reading from this pointer when `result_ok` is set is undefined.
4075         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4076 }
4077 #[repr(C)]
4078 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4079 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4081 pub struct CResult_RouteParametersDecodeErrorZ {
4082         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4083         /// `err` or `result` depending on the state of `result_ok`.
4084         pub contents: CResult_RouteParametersDecodeErrorZPtr,
4085         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4086         pub result_ok: bool,
4087 }
4088 #[no_mangle]
4089 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4090 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4091         CResult_RouteParametersDecodeErrorZ {
4092                 contents: CResult_RouteParametersDecodeErrorZPtr {
4093                         result: Box::into_raw(Box::new(o)),
4094                 },
4095                 result_ok: true,
4096         }
4097 }
4098 #[no_mangle]
4099 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4100 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4101         CResult_RouteParametersDecodeErrorZ {
4102                 contents: CResult_RouteParametersDecodeErrorZPtr {
4103                         err: Box::into_raw(Box::new(e)),
4104                 },
4105                 result_ok: false,
4106         }
4107 }
4108 /// Checks if the given object is currently in the success state
4109 #[no_mangle]
4110 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4111         o.result_ok
4112 }
4113 #[no_mangle]
4114 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4115 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4116 impl Drop for CResult_RouteParametersDecodeErrorZ {
4117         fn drop(&mut self) {
4118                 if self.result_ok {
4119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4121                         }
4122                 } else {
4123                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4124                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4125                         }
4126                 }
4127         }
4128 }
4129 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4130         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4131                 let contents = if o.result_ok {
4132                         let result = unsafe { o.contents.result };
4133                         unsafe { o.contents.result = core::ptr::null_mut() };
4134                         CResult_RouteParametersDecodeErrorZPtr { result }
4135                 } else {
4136                         let err = unsafe { o.contents.err };
4137                         unsafe { o.contents.err = core::ptr::null_mut(); }
4138                         CResult_RouteParametersDecodeErrorZPtr { err }
4139                 };
4140                 Self {
4141                         contents,
4142                         result_ok: o.result_ok,
4143                 }
4144         }
4145 }
4146 impl Clone for CResult_RouteParametersDecodeErrorZ {
4147         fn clone(&self) -> Self {
4148                 if self.result_ok {
4149                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4150                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4151                         } }
4152                 } else {
4153                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4154                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4155                         } }
4156                 }
4157         }
4158 }
4159 #[no_mangle]
4160 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4161 /// but with all dynamically-allocated buffers duplicated in new buffers.
4162 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4163 #[repr(C)]
4164 /// A dynamically-allocated array of u64s of arbitrary size.
4165 /// This corresponds to std::vector in C++
4166 pub struct CVec_u64Z {
4167         /// The elements in the array.
4168         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4169         pub data: *mut u64,
4170         /// The number of elements pointed to by `data`.
4171         pub datalen: usize
4172 }
4173 impl CVec_u64Z {
4174         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4175                 if self.datalen == 0 { return Vec::new(); }
4176                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4177                 self.data = core::ptr::null_mut();
4178                 self.datalen = 0;
4179                 ret
4180         }
4181         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4182                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4183         }
4184 }
4185 impl From<Vec<u64>> for CVec_u64Z {
4186         fn from(v: Vec<u64>) -> Self {
4187                 let datalen = v.len();
4188                 let data = Box::into_raw(v.into_boxed_slice());
4189                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4190         }
4191 }
4192 #[no_mangle]
4193 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4194 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4195 impl Drop for CVec_u64Z {
4196         fn drop(&mut self) {
4197                 if self.datalen == 0 { return; }
4198                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4199         }
4200 }
4201 impl Clone for CVec_u64Z {
4202         fn clone(&self) -> Self {
4203                 let mut res = Vec::new();
4204                 if self.datalen == 0 { return Self::from(res); }
4205                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4206                 Self::from(res)
4207         }
4208 }
4209 #[repr(C)]
4210 /// The contents of CResult_PaymentParametersDecodeErrorZ
4211 pub union CResult_PaymentParametersDecodeErrorZPtr {
4212         /// A pointer to the contents in the success state.
4213         /// Reading from this pointer when `result_ok` is not set is undefined.
4214         pub result: *mut crate::lightning::routing::router::PaymentParameters,
4215         /// A pointer to the contents in the error state.
4216         /// Reading from this pointer when `result_ok` is set is undefined.
4217         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4218 }
4219 #[repr(C)]
4220 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4221 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4223 pub struct CResult_PaymentParametersDecodeErrorZ {
4224         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4225         /// `err` or `result` depending on the state of `result_ok`.
4226         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4227         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4228         pub result_ok: bool,
4229 }
4230 #[no_mangle]
4231 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4232 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4233         CResult_PaymentParametersDecodeErrorZ {
4234                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4235                         result: Box::into_raw(Box::new(o)),
4236                 },
4237                 result_ok: true,
4238         }
4239 }
4240 #[no_mangle]
4241 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4242 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4243         CResult_PaymentParametersDecodeErrorZ {
4244                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4245                         err: Box::into_raw(Box::new(e)),
4246                 },
4247                 result_ok: false,
4248         }
4249 }
4250 /// Checks if the given object is currently in the success state
4251 #[no_mangle]
4252 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4253         o.result_ok
4254 }
4255 #[no_mangle]
4256 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4257 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4258 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4259         fn drop(&mut self) {
4260                 if self.result_ok {
4261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4263                         }
4264                 } else {
4265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4267                         }
4268                 }
4269         }
4270 }
4271 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4273                 let contents = if o.result_ok {
4274                         let result = unsafe { o.contents.result };
4275                         unsafe { o.contents.result = core::ptr::null_mut() };
4276                         CResult_PaymentParametersDecodeErrorZPtr { result }
4277                 } else {
4278                         let err = unsafe { o.contents.err };
4279                         unsafe { o.contents.err = core::ptr::null_mut(); }
4280                         CResult_PaymentParametersDecodeErrorZPtr { err }
4281                 };
4282                 Self {
4283                         contents,
4284                         result_ok: o.result_ok,
4285                 }
4286         }
4287 }
4288 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4289         fn clone(&self) -> Self {
4290                 if self.result_ok {
4291                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4292                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4293                         } }
4294                 } else {
4295                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4297                         } }
4298                 }
4299         }
4300 }
4301 #[no_mangle]
4302 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4305 #[repr(C)]
4306 /// A tuple of 2 elements. See the individual fields for the types contained.
4307 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
4308         /// The element at position 0
4309         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
4310         /// The element at position 1
4311         pub b: crate::lightning::blinded_path::BlindedPath,
4312 }
4313 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
4314         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
4315                 Self {
4316                         a: tup.0,
4317                         b: tup.1,
4318                 }
4319         }
4320 }
4321 impl C2Tuple_BlindedPayInfoBlindedPathZ {
4322         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
4323                 (self.a, self.b)
4324         }
4325 }
4326 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
4327         fn clone(&self) -> Self {
4328                 Self {
4329                         a: Clone::clone(&self.a),
4330                         b: Clone::clone(&self.b),
4331                 }
4332         }
4333 }
4334 #[no_mangle]
4335 /// Creates a new tuple which has the same data as `orig`
4336 /// but with all dynamically-allocated buffers duplicated in new buffers.
4337 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
4338 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
4339 #[no_mangle]
4340 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
4341         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
4342 }
4343
4344 #[no_mangle]
4345 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
4346 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
4347 #[repr(C)]
4348 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4349 /// This corresponds to std::vector in C++
4350 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4351         /// The elements in the array.
4352         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4353         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4354         /// The number of elements pointed to by `data`.
4355         pub datalen: usize
4356 }
4357 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4358         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4359                 if self.datalen == 0 { return Vec::new(); }
4360                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4361                 self.data = core::ptr::null_mut();
4362                 self.datalen = 0;
4363                 ret
4364         }
4365         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4366                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4367         }
4368 }
4369 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4370         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4371                 let datalen = v.len();
4372                 let data = Box::into_raw(v.into_boxed_slice());
4373                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4374         }
4375 }
4376 #[no_mangle]
4377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4378 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4379 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4380         fn drop(&mut self) {
4381                 if self.datalen == 0 { return; }
4382                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4383         }
4384 }
4385 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4386         fn clone(&self) -> Self {
4387                 let mut res = Vec::new();
4388                 if self.datalen == 0 { return Self::from(res); }
4389                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4390                 Self::from(res)
4391         }
4392 }
4393 #[repr(C)]
4394 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4395 /// This corresponds to std::vector in C++
4396 pub struct CVec_RouteHintZ {
4397         /// The elements in the array.
4398         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4399         pub data: *mut crate::lightning::routing::router::RouteHint,
4400         /// The number of elements pointed to by `data`.
4401         pub datalen: usize
4402 }
4403 impl CVec_RouteHintZ {
4404         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4405                 if self.datalen == 0 { return Vec::new(); }
4406                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4407                 self.data = core::ptr::null_mut();
4408                 self.datalen = 0;
4409                 ret
4410         }
4411         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4412                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4413         }
4414 }
4415 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4416         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4417                 let datalen = v.len();
4418                 let data = Box::into_raw(v.into_boxed_slice());
4419                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4420         }
4421 }
4422 #[no_mangle]
4423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4424 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4425 impl Drop for CVec_RouteHintZ {
4426         fn drop(&mut self) {
4427                 if self.datalen == 0 { return; }
4428                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4429         }
4430 }
4431 impl Clone for CVec_RouteHintZ {
4432         fn clone(&self) -> Self {
4433                 let mut res = Vec::new();
4434                 if self.datalen == 0 { return Self::from(res); }
4435                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4436                 Self::from(res)
4437         }
4438 }
4439 #[repr(C)]
4440 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4441 /// This corresponds to std::vector in C++
4442 pub struct CVec_RouteHintHopZ {
4443         /// The elements in the array.
4444         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4445         pub data: *mut crate::lightning::routing::router::RouteHintHop,
4446         /// The number of elements pointed to by `data`.
4447         pub datalen: usize
4448 }
4449 impl CVec_RouteHintHopZ {
4450         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4451                 if self.datalen == 0 { return Vec::new(); }
4452                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4453                 self.data = core::ptr::null_mut();
4454                 self.datalen = 0;
4455                 ret
4456         }
4457         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4458                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4459         }
4460 }
4461 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4462         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4463                 let datalen = v.len();
4464                 let data = Box::into_raw(v.into_boxed_slice());
4465                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4466         }
4467 }
4468 #[no_mangle]
4469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4470 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4471 impl Drop for CVec_RouteHintHopZ {
4472         fn drop(&mut self) {
4473                 if self.datalen == 0 { return; }
4474                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4475         }
4476 }
4477 impl Clone for CVec_RouteHintHopZ {
4478         fn clone(&self) -> Self {
4479                 let mut res = Vec::new();
4480                 if self.datalen == 0 { return Self::from(res); }
4481                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4482                 Self::from(res)
4483         }
4484 }
4485 #[repr(C)]
4486 /// The contents of CResult_RouteHintDecodeErrorZ
4487 pub union CResult_RouteHintDecodeErrorZPtr {
4488         /// A pointer to the contents in the success state.
4489         /// Reading from this pointer when `result_ok` is not set is undefined.
4490         pub result: *mut crate::lightning::routing::router::RouteHint,
4491         /// A pointer to the contents in the error state.
4492         /// Reading from this pointer when `result_ok` is set is undefined.
4493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4494 }
4495 #[repr(C)]
4496 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4497 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4499 pub struct CResult_RouteHintDecodeErrorZ {
4500         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4501         /// `err` or `result` depending on the state of `result_ok`.
4502         pub contents: CResult_RouteHintDecodeErrorZPtr,
4503         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4504         pub result_ok: bool,
4505 }
4506 #[no_mangle]
4507 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4508 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4509         CResult_RouteHintDecodeErrorZ {
4510                 contents: CResult_RouteHintDecodeErrorZPtr {
4511                         result: Box::into_raw(Box::new(o)),
4512                 },
4513                 result_ok: true,
4514         }
4515 }
4516 #[no_mangle]
4517 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4518 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4519         CResult_RouteHintDecodeErrorZ {
4520                 contents: CResult_RouteHintDecodeErrorZPtr {
4521                         err: Box::into_raw(Box::new(e)),
4522                 },
4523                 result_ok: false,
4524         }
4525 }
4526 /// Checks if the given object is currently in the success state
4527 #[no_mangle]
4528 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4529         o.result_ok
4530 }
4531 #[no_mangle]
4532 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4533 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4534 impl Drop for CResult_RouteHintDecodeErrorZ {
4535         fn drop(&mut self) {
4536                 if self.result_ok {
4537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4539                         }
4540                 } else {
4541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4543                         }
4544                 }
4545         }
4546 }
4547 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4548         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4549                 let contents = if o.result_ok {
4550                         let result = unsafe { o.contents.result };
4551                         unsafe { o.contents.result = core::ptr::null_mut() };
4552                         CResult_RouteHintDecodeErrorZPtr { result }
4553                 } else {
4554                         let err = unsafe { o.contents.err };
4555                         unsafe { o.contents.err = core::ptr::null_mut(); }
4556                         CResult_RouteHintDecodeErrorZPtr { err }
4557                 };
4558                 Self {
4559                         contents,
4560                         result_ok: o.result_ok,
4561                 }
4562         }
4563 }
4564 impl Clone for CResult_RouteHintDecodeErrorZ {
4565         fn clone(&self) -> Self {
4566                 if self.result_ok {
4567                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4568                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4569                         } }
4570                 } else {
4571                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4573                         } }
4574                 }
4575         }
4576 }
4577 #[no_mangle]
4578 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4581 #[repr(C)]
4582 /// The contents of CResult_RouteHintHopDecodeErrorZ
4583 pub union CResult_RouteHintHopDecodeErrorZPtr {
4584         /// A pointer to the contents in the success state.
4585         /// Reading from this pointer when `result_ok` is not set is undefined.
4586         pub result: *mut crate::lightning::routing::router::RouteHintHop,
4587         /// A pointer to the contents in the error state.
4588         /// Reading from this pointer when `result_ok` is set is undefined.
4589         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4590 }
4591 #[repr(C)]
4592 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4593 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4595 pub struct CResult_RouteHintHopDecodeErrorZ {
4596         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4597         /// `err` or `result` depending on the state of `result_ok`.
4598         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4599         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4600         pub result_ok: bool,
4601 }
4602 #[no_mangle]
4603 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4604 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4605         CResult_RouteHintHopDecodeErrorZ {
4606                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4607                         result: Box::into_raw(Box::new(o)),
4608                 },
4609                 result_ok: true,
4610         }
4611 }
4612 #[no_mangle]
4613 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4614 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4615         CResult_RouteHintHopDecodeErrorZ {
4616                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4617                         err: Box::into_raw(Box::new(e)),
4618                 },
4619                 result_ok: false,
4620         }
4621 }
4622 /// Checks if the given object is currently in the success state
4623 #[no_mangle]
4624 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4625         o.result_ok
4626 }
4627 #[no_mangle]
4628 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4629 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4630 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4631         fn drop(&mut self) {
4632                 if self.result_ok {
4633                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4634                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4635                         }
4636                 } else {
4637                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4638                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4639                         }
4640                 }
4641         }
4642 }
4643 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4644         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4645                 let contents = if o.result_ok {
4646                         let result = unsafe { o.contents.result };
4647                         unsafe { o.contents.result = core::ptr::null_mut() };
4648                         CResult_RouteHintHopDecodeErrorZPtr { result }
4649                 } else {
4650                         let err = unsafe { o.contents.err };
4651                         unsafe { o.contents.err = core::ptr::null_mut(); }
4652                         CResult_RouteHintHopDecodeErrorZPtr { err }
4653                 };
4654                 Self {
4655                         contents,
4656                         result_ok: o.result_ok,
4657                 }
4658         }
4659 }
4660 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4661         fn clone(&self) -> Self {
4662                 if self.result_ok {
4663                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4664                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4665                         } }
4666                 } else {
4667                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4668                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4669                         } }
4670                 }
4671         }
4672 }
4673 #[no_mangle]
4674 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4675 /// but with all dynamically-allocated buffers duplicated in new buffers.
4676 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4677 #[repr(C)]
4678 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4679 /// This corresponds to std::vector in C++
4680 pub struct CVec_PublicKeyZ {
4681         /// The elements in the array.
4682         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4683         pub data: *mut crate::c_types::PublicKey,
4684         /// The number of elements pointed to by `data`.
4685         pub datalen: usize
4686 }
4687 impl CVec_PublicKeyZ {
4688         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4689                 if self.datalen == 0 { return Vec::new(); }
4690                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4691                 self.data = core::ptr::null_mut();
4692                 self.datalen = 0;
4693                 ret
4694         }
4695         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4696                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4697         }
4698 }
4699 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4700         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4701                 let datalen = v.len();
4702                 let data = Box::into_raw(v.into_boxed_slice());
4703                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4704         }
4705 }
4706 #[no_mangle]
4707 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4708 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4709 impl Drop for CVec_PublicKeyZ {
4710         fn drop(&mut self) {
4711                 if self.datalen == 0 { return; }
4712                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4713         }
4714 }
4715 impl Clone for CVec_PublicKeyZ {
4716         fn clone(&self) -> Self {
4717                 let mut res = Vec::new();
4718                 if self.datalen == 0 { return Self::from(res); }
4719                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4720                 Self::from(res)
4721         }
4722 }
4723 #[repr(C)]
4724 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4725 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4726         /// A pointer to the contents in the success state.
4727         /// Reading from this pointer when `result_ok` is not set is undefined.
4728         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4729         /// A pointer to the contents in the error state.
4730         /// Reading from this pointer when `result_ok` is set is undefined.
4731         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4732 }
4733 #[repr(C)]
4734 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4735 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4737 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4738         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4739         /// `err` or `result` depending on the state of `result_ok`.
4740         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4741         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4742         pub result_ok: bool,
4743 }
4744 #[no_mangle]
4745 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4746 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4747         CResult_FixedPenaltyScorerDecodeErrorZ {
4748                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4749                         result: Box::into_raw(Box::new(o)),
4750                 },
4751                 result_ok: true,
4752         }
4753 }
4754 #[no_mangle]
4755 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4756 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4757         CResult_FixedPenaltyScorerDecodeErrorZ {
4758                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4759                         err: Box::into_raw(Box::new(e)),
4760                 },
4761                 result_ok: false,
4762         }
4763 }
4764 /// Checks if the given object is currently in the success state
4765 #[no_mangle]
4766 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4767         o.result_ok
4768 }
4769 #[no_mangle]
4770 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4771 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4772 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4773         fn drop(&mut self) {
4774                 if self.result_ok {
4775                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4776                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4777                         }
4778                 } else {
4779                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4780                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4781                         }
4782                 }
4783         }
4784 }
4785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4786         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4787                 let contents = if o.result_ok {
4788                         let result = unsafe { o.contents.result };
4789                         unsafe { o.contents.result = core::ptr::null_mut() };
4790                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4791                 } else {
4792                         let err = unsafe { o.contents.err };
4793                         unsafe { o.contents.err = core::ptr::null_mut(); }
4794                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4795                 };
4796                 Self {
4797                         contents,
4798                         result_ok: o.result_ok,
4799                 }
4800         }
4801 }
4802 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4803         fn clone(&self) -> Self {
4804                 if self.result_ok {
4805                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4806                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4807                         } }
4808                 } else {
4809                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4810                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4811                         } }
4812                 }
4813         }
4814 }
4815 #[no_mangle]
4816 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4817 /// but with all dynamically-allocated buffers duplicated in new buffers.
4818 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4819 #[repr(C)]
4820 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4821 /// This corresponds to std::vector in C++
4822 pub struct CVec_NodeIdZ {
4823         /// The elements in the array.
4824         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4825         pub data: *mut crate::lightning::routing::gossip::NodeId,
4826         /// The number of elements pointed to by `data`.
4827         pub datalen: usize
4828 }
4829 impl CVec_NodeIdZ {
4830         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4831                 if self.datalen == 0 { return Vec::new(); }
4832                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4833                 self.data = core::ptr::null_mut();
4834                 self.datalen = 0;
4835                 ret
4836         }
4837         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4838                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4839         }
4840 }
4841 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4842         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4843                 let datalen = v.len();
4844                 let data = Box::into_raw(v.into_boxed_slice());
4845                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4846         }
4847 }
4848 #[no_mangle]
4849 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4850 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4851 impl Drop for CVec_NodeIdZ {
4852         fn drop(&mut self) {
4853                 if self.datalen == 0 { return; }
4854                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4855         }
4856 }
4857 impl Clone for CVec_NodeIdZ {
4858         fn clone(&self) -> Self {
4859                 let mut res = Vec::new();
4860                 if self.datalen == 0 { return Self::from(res); }
4861                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4862                 Self::from(res)
4863         }
4864 }
4865 #[repr(C)]
4866 /// A tuple of 2 elements. See the individual fields for the types contained.
4867 pub struct C2Tuple_u64u64Z {
4868         /// The element at position 0
4869         pub a: u64,
4870         /// The element at position 1
4871         pub b: u64,
4872 }
4873 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4874         fn from (tup: (u64, u64)) -> Self {
4875                 Self {
4876                         a: tup.0,
4877                         b: tup.1,
4878                 }
4879         }
4880 }
4881 impl C2Tuple_u64u64Z {
4882         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4883                 (self.a, self.b)
4884         }
4885 }
4886 impl Clone for C2Tuple_u64u64Z {
4887         fn clone(&self) -> Self {
4888                 Self {
4889                         a: Clone::clone(&self.a),
4890                         b: Clone::clone(&self.b),
4891                 }
4892         }
4893 }
4894 #[no_mangle]
4895 /// Creates a new tuple which has the same data as `orig`
4896 /// but with all dynamically-allocated buffers duplicated in new buffers.
4897 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4898 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4899 #[no_mangle]
4900 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4901         C2Tuple_u64u64Z { a, b, }
4902 }
4903
4904 #[no_mangle]
4905 /// Frees any resources used by the C2Tuple_u64u64Z.
4906 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4907 #[repr(C)]
4908 #[derive(Clone)]
4909 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4910 pub enum COption_C2Tuple_u64u64ZZ {
4911         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4912         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4913         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4914         None
4915 }
4916 impl COption_C2Tuple_u64u64ZZ {
4917         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4918                 if let Self::None = self { false } else { true }
4919         }
4920         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4921                 !self.is_some()
4922         }
4923         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4924                 if let Self::Some(v) = self { v } else { unreachable!() }
4925         }
4926 }
4927 #[no_mangle]
4928 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4929 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4930         COption_C2Tuple_u64u64ZZ::Some(o)
4931 }
4932 #[no_mangle]
4933 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4934 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4935         COption_C2Tuple_u64u64ZZ::None
4936 }
4937 #[no_mangle]
4938 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4939 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4940 #[no_mangle]
4941 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4944 #[repr(C)]
4945 /// A tuple of 2 elements. See the individual fields for the types contained.
4946 pub struct C2Tuple_Z {
4947         /// The element at position 0
4948         pub a: crate::c_types::ThirtyTwoU16s,
4949         /// The element at position 1
4950         pub b: crate::c_types::ThirtyTwoU16s,
4951 }
4952 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
4953         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4954                 Self {
4955                         a: tup.0,
4956                         b: tup.1,
4957                 }
4958         }
4959 }
4960 impl C2Tuple_Z {
4961         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4962                 (self.a, self.b)
4963         }
4964 }
4965 /// Creates a new C2Tuple_Z from the contained elements.
4966 #[no_mangle]
4967 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
4968         C2Tuple_Z { a, b, }
4969 }
4970
4971 #[no_mangle]
4972 /// Frees any resources used by the C2Tuple_Z.
4973 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4974 #[repr(C)]
4975 /// A tuple of 2 elements. See the individual fields for the types contained.
4976 pub struct C2Tuple__u1632_u1632Z {
4977         /// The element at position 0
4978         pub a: crate::c_types::ThirtyTwoU16s,
4979         /// The element at position 1
4980         pub b: crate::c_types::ThirtyTwoU16s,
4981 }
4982 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
4983         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4984                 Self {
4985                         a: tup.0,
4986                         b: tup.1,
4987                 }
4988         }
4989 }
4990 impl C2Tuple__u1632_u1632Z {
4991         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4992                 (self.a, self.b)
4993         }
4994 }
4995 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
4996 #[no_mangle]
4997 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
4998         C2Tuple__u1632_u1632Z { a, b, }
4999 }
5000
5001 #[no_mangle]
5002 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5003 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5004 #[repr(C)]
5005 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5006 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5007         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5008         Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5009         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5010         None
5011 }
5012 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5013         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5014                 if let Self::None = self { false } else { true }
5015         }
5016         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5017                 !self.is_some()
5018         }
5019         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5020                 if let Self::Some(v) = self { v } else { unreachable!() }
5021         }
5022 }
5023 #[no_mangle]
5024 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5025 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5026         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5027 }
5028 #[no_mangle]
5029 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5030 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5031         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5032 }
5033 #[no_mangle]
5034 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5035 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5036 #[repr(C)]
5037 #[derive(Clone)]
5038 /// An enum which can either contain a f64 or not
5039 pub enum COption_f64Z {
5040         /// When we're in this state, this COption_f64Z contains a f64
5041         Some(f64),
5042         /// When we're in this state, this COption_f64Z contains nothing
5043         None
5044 }
5045 impl COption_f64Z {
5046         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5047                 if let Self::None = self { false } else { true }
5048         }
5049         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5050                 !self.is_some()
5051         }
5052         #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5053                 if let Self::Some(v) = self { v } else { unreachable!() }
5054         }
5055 }
5056 #[no_mangle]
5057 /// Constructs a new COption_f64Z containing a f64
5058 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5059         COption_f64Z::Some(o)
5060 }
5061 #[no_mangle]
5062 /// Constructs a new COption_f64Z containing nothing
5063 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5064         COption_f64Z::None
5065 }
5066 #[no_mangle]
5067 /// Frees any resources associated with the f64, if we are in the Some state
5068 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5069 #[no_mangle]
5070 /// Creates a new COption_f64Z which has the same data as `orig`
5071 /// but with all dynamically-allocated buffers duplicated in new buffers.
5072 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5073 #[repr(C)]
5074 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5075 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5076         /// A pointer to the contents in the success state.
5077         /// Reading from this pointer when `result_ok` is not set is undefined.
5078         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5079         /// A pointer to the contents in the error state.
5080         /// Reading from this pointer when `result_ok` is set is undefined.
5081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5082 }
5083 #[repr(C)]
5084 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5085 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5087 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5088         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5089         /// `err` or `result` depending on the state of `result_ok`.
5090         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5091         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5092         pub result_ok: bool,
5093 }
5094 #[no_mangle]
5095 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5096 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5097         CResult_ProbabilisticScorerDecodeErrorZ {
5098                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5099                         result: Box::into_raw(Box::new(o)),
5100                 },
5101                 result_ok: true,
5102         }
5103 }
5104 #[no_mangle]
5105 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5106 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5107         CResult_ProbabilisticScorerDecodeErrorZ {
5108                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5109                         err: Box::into_raw(Box::new(e)),
5110                 },
5111                 result_ok: false,
5112         }
5113 }
5114 /// Checks if the given object is currently in the success state
5115 #[no_mangle]
5116 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5117         o.result_ok
5118 }
5119 #[no_mangle]
5120 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5121 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5122 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5123         fn drop(&mut self) {
5124                 if self.result_ok {
5125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5127                         }
5128                 } else {
5129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5131                         }
5132                 }
5133         }
5134 }
5135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5137                 let contents = if o.result_ok {
5138                         let result = unsafe { o.contents.result };
5139                         unsafe { o.contents.result = core::ptr::null_mut() };
5140                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5141                 } else {
5142                         let err = unsafe { o.contents.err };
5143                         unsafe { o.contents.err = core::ptr::null_mut(); }
5144                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5145                 };
5146                 Self {
5147                         contents,
5148                         result_ok: o.result_ok,
5149                 }
5150         }
5151 }
5152 #[repr(C)]
5153 /// A tuple of 2 elements. See the individual fields for the types contained.
5154 pub struct C2Tuple_usizeTransactionZ {
5155         /// The element at position 0
5156         pub a: usize,
5157         /// The element at position 1
5158         pub b: crate::c_types::Transaction,
5159 }
5160 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5161         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5162                 Self {
5163                         a: tup.0,
5164                         b: tup.1,
5165                 }
5166         }
5167 }
5168 impl C2Tuple_usizeTransactionZ {
5169         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5170                 (self.a, self.b)
5171         }
5172 }
5173 impl Clone for C2Tuple_usizeTransactionZ {
5174         fn clone(&self) -> Self {
5175                 Self {
5176                         a: Clone::clone(&self.a),
5177                         b: Clone::clone(&self.b),
5178                 }
5179         }
5180 }
5181 #[no_mangle]
5182 /// Creates a new tuple which has the same data as `orig`
5183 /// but with all dynamically-allocated buffers duplicated in new buffers.
5184 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5185 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5186 #[no_mangle]
5187 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5188         C2Tuple_usizeTransactionZ { a, b, }
5189 }
5190
5191 #[no_mangle]
5192 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5193 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5194 #[repr(C)]
5195 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5196 /// This corresponds to std::vector in C++
5197 pub struct CVec_C2Tuple_usizeTransactionZZ {
5198         /// The elements in the array.
5199         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5200         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5201         /// The number of elements pointed to by `data`.
5202         pub datalen: usize
5203 }
5204 impl CVec_C2Tuple_usizeTransactionZZ {
5205         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5206                 if self.datalen == 0 { return Vec::new(); }
5207                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5208                 self.data = core::ptr::null_mut();
5209                 self.datalen = 0;
5210                 ret
5211         }
5212         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5213                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5214         }
5215 }
5216 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5217         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5218                 let datalen = v.len();
5219                 let data = Box::into_raw(v.into_boxed_slice());
5220                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5221         }
5222 }
5223 #[no_mangle]
5224 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5225 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5226 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5227         fn drop(&mut self) {
5228                 if self.datalen == 0 { return; }
5229                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5230         }
5231 }
5232 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5233         fn clone(&self) -> Self {
5234                 let mut res = Vec::new();
5235                 if self.datalen == 0 { return Self::from(res); }
5236                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5237                 Self::from(res)
5238         }
5239 }
5240 #[repr(C)]
5241 /// A tuple of 2 elements. See the individual fields for the types contained.
5242 pub struct C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5243         /// The element at position 0
5244         pub a: crate::c_types::ThirtyTwoBytes,
5245         /// The element at position 1
5246         pub b: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5247 }
5248 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5249         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5250                 Self {
5251                         a: tup.0,
5252                         b: tup.1,
5253                 }
5254         }
5255 }
5256 impl C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5257         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5258                 (self.a, self.b)
5259         }
5260 }
5261 impl Clone for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5262         fn clone(&self) -> Self {
5263                 Self {
5264                         a: Clone::clone(&self.a),
5265                         b: Clone::clone(&self.b),
5266                 }
5267         }
5268 }
5269 #[no_mangle]
5270 /// Creates a new tuple which has the same data as `orig`
5271 /// but with all dynamically-allocated buffers duplicated in new buffers.
5272 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5273 /// Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements.
5274 #[no_mangle]
5275 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5276         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { a, b, }
5277 }
5278
5279 #[no_mangle]
5280 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.
5281 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res: C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) { }
5282 #[repr(C)]
5283 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size.
5284 /// This corresponds to std::vector in C++
5285 pub struct CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5286         /// The elements in the array.
5287         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5288         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ,
5289         /// The number of elements pointed to by `data`.
5290         pub datalen: usize
5291 }
5292 impl CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5293         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ> {
5294                 if self.datalen == 0 { return Vec::new(); }
5295                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5296                 self.data = core::ptr::null_mut();
5297                 self.datalen = 0;
5298                 ret
5299         }
5300         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ] {
5301                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5302         }
5303 }
5304 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>> for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5305         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>) -> Self {
5306                 let datalen = v.len();
5307                 let data = Box::into_raw(v.into_boxed_slice());
5308                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5309         }
5310 }
5311 #[no_mangle]
5312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5313 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ) { }
5314 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5315         fn drop(&mut self) {
5316                 if self.datalen == 0 { return; }
5317                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5318         }
5319 }
5320 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5321         fn clone(&self) -> Self {
5322                 let mut res = Vec::new();
5323                 if self.datalen == 0 { return Self::from(res); }
5324                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5325                 Self::from(res)
5326         }
5327 }
5328 #[repr(C)]
5329 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5330 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5331         /// A pointer to the contents in the success state.
5332         /// Reading from this pointer when `result_ok` is not set is undefined.
5333         pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5334         /// Note that this value is always NULL, as there are no contents in the Err variant
5335         pub err: *mut core::ffi::c_void,
5336 }
5337 #[repr(C)]
5338 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5339 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5340 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5341 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5342         /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5343         /// `err` or `result` depending on the state of `result_ok`.
5344         pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5345         /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5346         pub result_ok: bool,
5347 }
5348 #[no_mangle]
5349 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5350 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5351         CResult_ChannelMonitorUpdateStatusNoneZ {
5352                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5353                         result: Box::into_raw(Box::new(o)),
5354                 },
5355                 result_ok: true,
5356         }
5357 }
5358 #[no_mangle]
5359 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5360 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5361         CResult_ChannelMonitorUpdateStatusNoneZ {
5362                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5363                         err: core::ptr::null_mut(),
5364                 },
5365                 result_ok: false,
5366         }
5367 }
5368 /// Checks if the given object is currently in the success state
5369 #[no_mangle]
5370 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5371         o.result_ok
5372 }
5373 #[no_mangle]
5374 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5375 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5376 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5377         fn drop(&mut self) {
5378                 if self.result_ok {
5379                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5380                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5381                         }
5382                 } else {
5383                 }
5384         }
5385 }
5386 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5387         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
5388                 let contents = if o.result_ok {
5389                         let result = unsafe { o.contents.result };
5390                         unsafe { o.contents.result = core::ptr::null_mut() };
5391                         CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
5392                 } else {
5393                         let _ = unsafe { Box::from_raw(o.contents.err) };
5394                         o.contents.err = core::ptr::null_mut();
5395                         CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5396                 };
5397                 Self {
5398                         contents,
5399                         result_ok: o.result_ok,
5400                 }
5401         }
5402 }
5403 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5404         fn clone(&self) -> Self {
5405                 if self.result_ok {
5406                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5407                                 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5408                         } }
5409                 } else {
5410                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5411                                 err: core::ptr::null_mut()
5412                         } }
5413                 }
5414         }
5415 }
5416 #[no_mangle]
5417 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5418 /// but with all dynamically-allocated buffers duplicated in new buffers.
5419 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5420 #[repr(C)]
5421 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5422 /// This corresponds to std::vector in C++
5423 pub struct CVec_MonitorEventZ {
5424         /// The elements in the array.
5425         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5426         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5427         /// The number of elements pointed to by `data`.
5428         pub datalen: usize
5429 }
5430 impl CVec_MonitorEventZ {
5431         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5432                 if self.datalen == 0 { return Vec::new(); }
5433                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5434                 self.data = core::ptr::null_mut();
5435                 self.datalen = 0;
5436                 ret
5437         }
5438         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5439                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5440         }
5441 }
5442 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5443         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5444                 let datalen = v.len();
5445                 let data = Box::into_raw(v.into_boxed_slice());
5446                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5447         }
5448 }
5449 #[no_mangle]
5450 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5451 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5452 impl Drop for CVec_MonitorEventZ {
5453         fn drop(&mut self) {
5454                 if self.datalen == 0 { return; }
5455                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5456         }
5457 }
5458 impl Clone for CVec_MonitorEventZ {
5459         fn clone(&self) -> Self {
5460                 let mut res = Vec::new();
5461                 if self.datalen == 0 { return Self::from(res); }
5462                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5463                 Self::from(res)
5464         }
5465 }
5466 #[repr(C)]
5467 /// A tuple of 3 elements. See the individual fields for the types contained.
5468 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5469         /// The element at position 0
5470         pub a: crate::lightning::chain::transaction::OutPoint,
5471         /// The element at position 1
5472         pub b: crate::c_types::derived::CVec_MonitorEventZ,
5473         /// The element at position 2
5474         pub c: crate::c_types::PublicKey,
5475 }
5476 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5477         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5478                 Self {
5479                         a: tup.0,
5480                         b: tup.1,
5481                         c: tup.2,
5482                 }
5483         }
5484 }
5485 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5486         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5487                 (self.a, self.b, self.c)
5488         }
5489 }
5490 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5491         fn clone(&self) -> Self {
5492                 Self {
5493                         a: Clone::clone(&self.a),
5494                         b: Clone::clone(&self.b),
5495                         c: Clone::clone(&self.c),
5496                 }
5497         }
5498 }
5499 #[no_mangle]
5500 /// Creates a new tuple which has the same data as `orig`
5501 /// but with all dynamically-allocated buffers duplicated in new buffers.
5502 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5503 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5504 #[no_mangle]
5505 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 {
5506         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5507 }
5508
5509 #[no_mangle]
5510 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5511 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5512 #[repr(C)]
5513 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5514 /// This corresponds to std::vector in C++
5515 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5516         /// The elements in the array.
5517         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5518         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5519         /// The number of elements pointed to by `data`.
5520         pub datalen: usize
5521 }
5522 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5523         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5524                 if self.datalen == 0 { return Vec::new(); }
5525                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5526                 self.data = core::ptr::null_mut();
5527                 self.datalen = 0;
5528                 ret
5529         }
5530         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5531                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5532         }
5533 }
5534 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5535         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5536                 let datalen = v.len();
5537                 let data = Box::into_raw(v.into_boxed_slice());
5538                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5539         }
5540 }
5541 #[no_mangle]
5542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5543 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5544 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5545         fn drop(&mut self) {
5546                 if self.datalen == 0 { return; }
5547                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5548         }
5549 }
5550 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5551         fn clone(&self) -> Self {
5552                 let mut res = Vec::new();
5553                 if self.datalen == 0 { return Self::from(res); }
5554                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5555                 Self::from(res)
5556         }
5557 }
5558 #[repr(C)]
5559 /// The contents of CResult_InitFeaturesDecodeErrorZ
5560 pub union CResult_InitFeaturesDecodeErrorZPtr {
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::InitFeatures,
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_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5570 /// containing a crate::lightning::ln::features::InitFeatures 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_InitFeaturesDecodeErrorZ {
5573         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5574         /// `err` or `result` depending on the state of `result_ok`.
5575         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5576         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5577         pub result_ok: bool,
5578 }
5579 #[no_mangle]
5580 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5581 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5582         CResult_InitFeaturesDecodeErrorZ {
5583                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5584                         result: Box::into_raw(Box::new(o)),
5585                 },
5586                 result_ok: true,
5587         }
5588 }
5589 #[no_mangle]
5590 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5591 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5592         CResult_InitFeaturesDecodeErrorZ {
5593                 contents: CResult_InitFeaturesDecodeErrorZPtr {
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_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5602         o.result_ok
5603 }
5604 #[no_mangle]
5605 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5606 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5607 impl Drop for CResult_InitFeaturesDecodeErrorZ {
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::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, 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_InitFeaturesDecodeErrorZPtr { result }
5626                 } else {
5627                         let err = unsafe { o.contents.err };
5628                         unsafe { o.contents.err = core::ptr::null_mut(); }
5629                         CResult_InitFeaturesDecodeErrorZPtr { err }
5630                 };
5631                 Self {
5632                         contents,
5633                         result_ok: o.result_ok,
5634                 }
5635         }
5636 }
5637 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5638         fn clone(&self) -> Self {
5639                 if self.result_ok {
5640                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5641                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5642                         } }
5643                 } else {
5644                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
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_InitFeaturesDecodeErrorZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5654 #[repr(C)]
5655 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5656 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
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::ChannelFeatures,
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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5666 /// containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
5669         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5670         /// `err` or `result` depending on the state of `result_ok`.
5671         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5672         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5673         pub result_ok: bool,
5674 }
5675 #[no_mangle]
5676 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5677 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5678         CResult_ChannelFeaturesDecodeErrorZ {
5679                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5680                         result: Box::into_raw(Box::new(o)),
5681                 },
5682                 result_ok: true,
5683         }
5684 }
5685 #[no_mangle]
5686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5688         CResult_ChannelFeaturesDecodeErrorZ {
5689                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
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_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5698         o.result_ok
5699 }
5700 #[no_mangle]
5701 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
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::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5717         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, 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_ChannelFeaturesDecodeErrorZPtr { result }
5722                 } else {
5723                         let err = unsafe { o.contents.err };
5724                         unsafe { o.contents.err = core::ptr::null_mut(); }
5725                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5726                 };
5727                 Self {
5728                         contents,
5729                         result_ok: o.result_ok,
5730                 }
5731         }
5732 }
5733 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5734         fn clone(&self) -> Self {
5735                 if self.result_ok {
5736                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5737                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5738                         } }
5739                 } else {
5740                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
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_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5750 #[repr(C)]
5751 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5752 pub union CResult_NodeFeaturesDecodeErrorZPtr {
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::NodeFeatures,
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_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::ln::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ {
5765         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5766         /// `err` or `result` depending on the state of `result_ok`.
5767         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5768         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5769         pub result_ok: bool,
5770 }
5771 #[no_mangle]
5772 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5774         CResult_NodeFeaturesDecodeErrorZ {
5775                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5776                         result: Box::into_raw(Box::new(o)),
5777                 },
5778                 result_ok: true,
5779         }
5780 }
5781 #[no_mangle]
5782 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5784         CResult_NodeFeaturesDecodeErrorZ {
5785                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
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_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5794         o.result_ok
5795 }
5796 #[no_mangle]
5797 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5798 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5799 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
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::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5813         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, 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_NodeFeaturesDecodeErrorZPtr { result }
5818                 } else {
5819                         let err = unsafe { o.contents.err };
5820                         unsafe { o.contents.err = core::ptr::null_mut(); }
5821                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5822                 };
5823                 Self {
5824                         contents,
5825                         result_ok: o.result_ok,
5826                 }
5827         }
5828 }
5829 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5830         fn clone(&self) -> Self {
5831                 if self.result_ok {
5832                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5833                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5834                         } }
5835                 } else {
5836                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
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_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5846 #[repr(C)]
5847 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5848 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
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::Bolt11InvoiceFeatures,
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_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ {
5861         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5862         /// `err` or `result` depending on the state of `result_ok`.
5863         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5864         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5865         pub result_ok: bool,
5866 }
5867 #[no_mangle]
5868 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5870         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5871                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5872                         result: Box::into_raw(Box::new(o)),
5873                 },
5874                 result_ok: true,
5875         }
5876 }
5877 #[no_mangle]
5878 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5880         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5881                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
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_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5890         o.result_ok
5891 }
5892 #[no_mangle]
5893 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5894 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5895 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
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::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, 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_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5914                 } else {
5915                         let err = unsafe { o.contents.err };
5916                         unsafe { o.contents.err = core::ptr::null_mut(); }
5917                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5918                 };
5919                 Self {
5920                         contents,
5921                         result_ok: o.result_ok,
5922                 }
5923         }
5924 }
5925 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5926         fn clone(&self) -> Self {
5927                 if self.result_ok {
5928                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5930                         } }
5931                 } else {
5932                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
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_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5942 #[repr(C)]
5943 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5944 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
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::Bolt12InvoiceFeatures,
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_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ {
5957         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5958         /// `err` or `result` depending on the state of `result_ok`.
5959         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5960         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5961         pub result_ok: bool,
5962 }
5963 #[no_mangle]
5964 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5966         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5967                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5968                         result: Box::into_raw(Box::new(o)),
5969                 },
5970                 result_ok: true,
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5976         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5977                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
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_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5986         o.result_ok
5987 }
5988 #[no_mangle]
5989 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5990 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5991 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
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::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6005         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6010                 } else {
6011                         let err = unsafe { o.contents.err };
6012                         unsafe { o.contents.err = core::ptr::null_mut(); }
6013                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6014                 };
6015                 Self {
6016                         contents,
6017                         result_ok: o.result_ok,
6018                 }
6019         }
6020 }
6021 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6022         fn clone(&self) -> Self {
6023                 if self.result_ok {
6024                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6025                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6026                         } }
6027                 } else {
6028                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
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_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6038 #[repr(C)]
6039 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6040 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
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::ln::features::BlindedHopFeatures,
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::ln::msgs::DecodeError,
6047 }
6048 #[repr(C)]
6049 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6050 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6052 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6053         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6054         /// `err` or `result` depending on the state of `result_ok`.
6055         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6056         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6057         pub result_ok: bool,
6058 }
6059 #[no_mangle]
6060 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6061 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6062         CResult_BlindedHopFeaturesDecodeErrorZ {
6063                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6064                         result: Box::into_raw(Box::new(o)),
6065                 },
6066                 result_ok: true,
6067         }
6068 }
6069 #[no_mangle]
6070 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6071 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6072         CResult_BlindedHopFeaturesDecodeErrorZ {
6073                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
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_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6082         o.result_ok
6083 }
6084 #[no_mangle]
6085 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6086 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6087 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
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::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_BlindedHopFeaturesDecodeErrorZPtr { result }
6106                 } else {
6107                         let err = unsafe { o.contents.err };
6108                         unsafe { o.contents.err = core::ptr::null_mut(); }
6109                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6110                 };
6111                 Self {
6112                         contents,
6113                         result_ok: o.result_ok,
6114                 }
6115         }
6116 }
6117 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6118         fn clone(&self) -> Self {
6119                 if self.result_ok {
6120                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6121                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6122                         } }
6123                 } else {
6124                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6126                         } }
6127                 }
6128         }
6129 }
6130 #[no_mangle]
6131 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6132 /// but with all dynamically-allocated buffers duplicated in new buffers.
6133 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6134 #[repr(C)]
6135 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6136 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
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::lightning::ln::features::ChannelTypeFeatures,
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::lightning::ln::msgs::DecodeError,
6143 }
6144 #[repr(C)]
6145 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6146 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6148 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6149         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6150         /// `err` or `result` depending on the state of `result_ok`.
6151         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6152         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6153         pub result_ok: bool,
6154 }
6155 #[no_mangle]
6156 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6157 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6158         CResult_ChannelTypeFeaturesDecodeErrorZ {
6159                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6160                         result: Box::into_raw(Box::new(o)),
6161                 },
6162                 result_ok: true,
6163         }
6164 }
6165 #[no_mangle]
6166 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6167 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6168         CResult_ChannelTypeFeaturesDecodeErrorZ {
6169                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
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_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6178         o.result_ok
6179 }
6180 #[no_mangle]
6181 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6182 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6183 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
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::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6197         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelTypeFeaturesDecodeErrorZPtr { result }
6202                 } else {
6203                         let err = unsafe { o.contents.err };
6204                         unsafe { o.contents.err = core::ptr::null_mut(); }
6205                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6206                 };
6207                 Self {
6208                         contents,
6209                         result_ok: o.result_ok,
6210                 }
6211         }
6212 }
6213 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6214         fn clone(&self) -> Self {
6215                 if self.result_ok {
6216                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6217                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6218                         } }
6219                 } else {
6220                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6221                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6222                         } }
6223                 }
6224         }
6225 }
6226 #[no_mangle]
6227 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6228 /// but with all dynamically-allocated buffers duplicated in new buffers.
6229 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6230 #[repr(C)]
6231 /// The contents of CResult_OfferBolt12ParseErrorZ
6232 pub union CResult_OfferBolt12ParseErrorZPtr {
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::offers::offer::Offer,
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::offers::parse::Bolt12ParseError,
6239 }
6240 #[repr(C)]
6241 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6242 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6244 pub struct CResult_OfferBolt12ParseErrorZ {
6245         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6246         /// `err` or `result` depending on the state of `result_ok`.
6247         pub contents: CResult_OfferBolt12ParseErrorZPtr,
6248         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6249         pub result_ok: bool,
6250 }
6251 #[no_mangle]
6252 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6253 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6254         CResult_OfferBolt12ParseErrorZ {
6255                 contents: CResult_OfferBolt12ParseErrorZPtr {
6256                         result: Box::into_raw(Box::new(o)),
6257                 },
6258                 result_ok: true,
6259         }
6260 }
6261 #[no_mangle]
6262 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6263 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6264         CResult_OfferBolt12ParseErrorZ {
6265                 contents: CResult_OfferBolt12ParseErrorZPtr {
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_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6274         o.result_ok
6275 }
6276 #[no_mangle]
6277 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6278 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6279 impl Drop for CResult_OfferBolt12ParseErrorZ {
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::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> 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_OfferBolt12ParseErrorZPtr { result }
6298                 } else {
6299                         let err = unsafe { o.contents.err };
6300                         unsafe { o.contents.err = core::ptr::null_mut(); }
6301                         CResult_OfferBolt12ParseErrorZPtr { err }
6302                 };
6303                 Self {
6304                         contents,
6305                         result_ok: o.result_ok,
6306                 }
6307         }
6308 }
6309 impl Clone for CResult_OfferBolt12ParseErrorZ {
6310         fn clone(&self) -> Self {
6311                 if self.result_ok {
6312                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6313                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6314                         } }
6315                 } else {
6316                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6317                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6318                         } }
6319                 }
6320         }
6321 }
6322 #[no_mangle]
6323 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6324 /// but with all dynamically-allocated buffers duplicated in new buffers.
6325 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6326 #[repr(C)]
6327 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6328 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6329         /// A pointer to the contents in the success state.
6330         /// Reading from this pointer when `result_ok` is not set is undefined.
6331         pub result: *mut crate::c_types::PublicKey,
6332         /// A pointer to the contents in the error state.
6333         /// Reading from this pointer when `result_ok` is set is undefined.
6334         pub err: *mut crate::c_types::Secp256k1Error,
6335 }
6336 #[repr(C)]
6337 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6338 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6340 pub struct CResult_PublicKeySecp256k1ErrorZ {
6341         /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6342         /// `err` or `result` depending on the state of `result_ok`.
6343         pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6344         /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6345         pub result_ok: bool,
6346 }
6347 #[no_mangle]
6348 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6349 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6350         CResult_PublicKeySecp256k1ErrorZ {
6351                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6352                         result: Box::into_raw(Box::new(o)),
6353                 },
6354                 result_ok: true,
6355         }
6356 }
6357 #[no_mangle]
6358 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6359 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6360         CResult_PublicKeySecp256k1ErrorZ {
6361                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6362                         err: Box::into_raw(Box::new(e)),
6363                 },
6364                 result_ok: false,
6365         }
6366 }
6367 /// Checks if the given object is currently in the success state
6368 #[no_mangle]
6369 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6370         o.result_ok
6371 }
6372 #[no_mangle]
6373 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6374 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6375 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6376         fn drop(&mut self) {
6377                 if self.result_ok {
6378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6380                         }
6381                 } else {
6382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6384                         }
6385                 }
6386         }
6387 }
6388 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6389         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6390                 let contents = if o.result_ok {
6391                         let result = unsafe { o.contents.result };
6392                         unsafe { o.contents.result = core::ptr::null_mut() };
6393                         CResult_PublicKeySecp256k1ErrorZPtr { result }
6394                 } else {
6395                         let err = unsafe { o.contents.err };
6396                         unsafe { o.contents.err = core::ptr::null_mut(); }
6397                         CResult_PublicKeySecp256k1ErrorZPtr { err }
6398                 };
6399                 Self {
6400                         contents,
6401                         result_ok: o.result_ok,
6402                 }
6403         }
6404 }
6405 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6406         fn clone(&self) -> Self {
6407                 if self.result_ok {
6408                         Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6409                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6410                         } }
6411                 } else {
6412                         Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6413                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6414                         } }
6415                 }
6416         }
6417 }
6418 #[no_mangle]
6419 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6420 /// but with all dynamically-allocated buffers duplicated in new buffers.
6421 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6422 #[repr(C)]
6423 /// The contents of CResult_NodeIdDecodeErrorZ
6424 pub union CResult_NodeIdDecodeErrorZPtr {
6425         /// A pointer to the contents in the success state.
6426         /// Reading from this pointer when `result_ok` is not set is undefined.
6427         pub result: *mut crate::lightning::routing::gossip::NodeId,
6428         /// A pointer to the contents in the error state.
6429         /// Reading from this pointer when `result_ok` is set is undefined.
6430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6431 }
6432 #[repr(C)]
6433 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6434 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6436 pub struct CResult_NodeIdDecodeErrorZ {
6437         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6438         /// `err` or `result` depending on the state of `result_ok`.
6439         pub contents: CResult_NodeIdDecodeErrorZPtr,
6440         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6441         pub result_ok: bool,
6442 }
6443 #[no_mangle]
6444 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6445 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6446         CResult_NodeIdDecodeErrorZ {
6447                 contents: CResult_NodeIdDecodeErrorZPtr {
6448                         result: Box::into_raw(Box::new(o)),
6449                 },
6450                 result_ok: true,
6451         }
6452 }
6453 #[no_mangle]
6454 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6455 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6456         CResult_NodeIdDecodeErrorZ {
6457                 contents: CResult_NodeIdDecodeErrorZPtr {
6458                         err: Box::into_raw(Box::new(e)),
6459                 },
6460                 result_ok: false,
6461         }
6462 }
6463 /// Checks if the given object is currently in the success state
6464 #[no_mangle]
6465 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6466         o.result_ok
6467 }
6468 #[no_mangle]
6469 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6470 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6471 impl Drop for CResult_NodeIdDecodeErrorZ {
6472         fn drop(&mut self) {
6473                 if self.result_ok {
6474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6476                         }
6477                 } else {
6478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6480                         }
6481                 }
6482         }
6483 }
6484 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6485         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6486                 let contents = if o.result_ok {
6487                         let result = unsafe { o.contents.result };
6488                         unsafe { o.contents.result = core::ptr::null_mut() };
6489                         CResult_NodeIdDecodeErrorZPtr { result }
6490                 } else {
6491                         let err = unsafe { o.contents.err };
6492                         unsafe { o.contents.err = core::ptr::null_mut(); }
6493                         CResult_NodeIdDecodeErrorZPtr { err }
6494                 };
6495                 Self {
6496                         contents,
6497                         result_ok: o.result_ok,
6498                 }
6499         }
6500 }
6501 impl Clone for CResult_NodeIdDecodeErrorZ {
6502         fn clone(&self) -> Self {
6503                 if self.result_ok {
6504                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6505                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6506                         } }
6507                 } else {
6508                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6509                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6510                         } }
6511                 }
6512         }
6513 }
6514 #[no_mangle]
6515 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6516 /// but with all dynamically-allocated buffers duplicated in new buffers.
6517 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6518 #[repr(C)]
6519 #[derive(Clone)]
6520 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6521 pub enum COption_NetworkUpdateZ {
6522         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6523         Some(crate::lightning::routing::gossip::NetworkUpdate),
6524         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6525         None
6526 }
6527 impl COption_NetworkUpdateZ {
6528         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6529                 if let Self::None = self { false } else { true }
6530         }
6531         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6532                 !self.is_some()
6533         }
6534         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6535                 if let Self::Some(v) = self { v } else { unreachable!() }
6536         }
6537 }
6538 #[no_mangle]
6539 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6540 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6541         COption_NetworkUpdateZ::Some(o)
6542 }
6543 #[no_mangle]
6544 /// Constructs a new COption_NetworkUpdateZ containing nothing
6545 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6546         COption_NetworkUpdateZ::None
6547 }
6548 #[no_mangle]
6549 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6550 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6551 #[no_mangle]
6552 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6553 /// but with all dynamically-allocated buffers duplicated in new buffers.
6554 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6555 #[repr(C)]
6556 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6557 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6558         /// A pointer to the contents in the success state.
6559         /// Reading from this pointer when `result_ok` is not set is undefined.
6560         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6561         /// A pointer to the contents in the error state.
6562         /// Reading from this pointer when `result_ok` is set is undefined.
6563         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6564 }
6565 #[repr(C)]
6566 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6567 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6569 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6570         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6571         /// `err` or `result` depending on the state of `result_ok`.
6572         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6573         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6574         pub result_ok: bool,
6575 }
6576 #[no_mangle]
6577 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6578 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6579         CResult_COption_NetworkUpdateZDecodeErrorZ {
6580                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6581                         result: Box::into_raw(Box::new(o)),
6582                 },
6583                 result_ok: true,
6584         }
6585 }
6586 #[no_mangle]
6587 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6588 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6589         CResult_COption_NetworkUpdateZDecodeErrorZ {
6590                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6591                         err: Box::into_raw(Box::new(e)),
6592                 },
6593                 result_ok: false,
6594         }
6595 }
6596 /// Checks if the given object is currently in the success state
6597 #[no_mangle]
6598 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6599         o.result_ok
6600 }
6601 #[no_mangle]
6602 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6603 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6604 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6605         fn drop(&mut self) {
6606                 if self.result_ok {
6607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6609                         }
6610                 } else {
6611                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6612                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6613                         }
6614                 }
6615         }
6616 }
6617 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6618         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6619                 let contents = if o.result_ok {
6620                         let result = unsafe { o.contents.result };
6621                         unsafe { o.contents.result = core::ptr::null_mut() };
6622                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6623                 } else {
6624                         let err = unsafe { o.contents.err };
6625                         unsafe { o.contents.err = core::ptr::null_mut(); }
6626                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6627                 };
6628                 Self {
6629                         contents,
6630                         result_ok: o.result_ok,
6631                 }
6632         }
6633 }
6634 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6635         fn clone(&self) -> Self {
6636                 if self.result_ok {
6637                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6638                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6639                         } }
6640                 } else {
6641                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6642                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6643                         } }
6644                 }
6645         }
6646 }
6647 #[no_mangle]
6648 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6649 /// but with all dynamically-allocated buffers duplicated in new buffers.
6650 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6651 #[repr(C)]
6652 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6653 pub enum COption_UtxoLookupZ {
6654         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6655         Some(crate::lightning::routing::utxo::UtxoLookup),
6656         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6657         None
6658 }
6659 impl COption_UtxoLookupZ {
6660         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6661                 if let Self::None = self { false } else { true }
6662         }
6663         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6664                 !self.is_some()
6665         }
6666         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6667                 if let Self::Some(v) = self { v } else { unreachable!() }
6668         }
6669 }
6670 #[no_mangle]
6671 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6672 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6673         COption_UtxoLookupZ::Some(o)
6674 }
6675 #[no_mangle]
6676 /// Constructs a new COption_UtxoLookupZ containing nothing
6677 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6678         COption_UtxoLookupZ::None
6679 }
6680 #[no_mangle]
6681 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6682 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6683 #[repr(C)]
6684 /// The contents of CResult_NoneLightningErrorZ
6685 pub union CResult_NoneLightningErrorZPtr {
6686         /// Note that this value is always NULL, as there are no contents in the OK variant
6687         pub result: *mut core::ffi::c_void,
6688         /// A pointer to the contents in the error state.
6689         /// Reading from this pointer when `result_ok` is set is undefined.
6690         pub err: *mut crate::lightning::ln::msgs::LightningError,
6691 }
6692 #[repr(C)]
6693 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6694 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6696 pub struct CResult_NoneLightningErrorZ {
6697         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6698         /// `err` or `result` depending on the state of `result_ok`.
6699         pub contents: CResult_NoneLightningErrorZPtr,
6700         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6701         pub result_ok: bool,
6702 }
6703 #[no_mangle]
6704 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6705 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6706         CResult_NoneLightningErrorZ {
6707                 contents: CResult_NoneLightningErrorZPtr {
6708                         result: core::ptr::null_mut(),
6709                 },
6710                 result_ok: true,
6711         }
6712 }
6713 #[no_mangle]
6714 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6715 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6716         CResult_NoneLightningErrorZ {
6717                 contents: CResult_NoneLightningErrorZPtr {
6718                         err: Box::into_raw(Box::new(e)),
6719                 },
6720                 result_ok: false,
6721         }
6722 }
6723 /// Checks if the given object is currently in the success state
6724 #[no_mangle]
6725 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6726         o.result_ok
6727 }
6728 #[no_mangle]
6729 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6730 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6731 impl Drop for CResult_NoneLightningErrorZ {
6732         fn drop(&mut self) {
6733                 if self.result_ok {
6734                 } else {
6735                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6736                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6737                         }
6738                 }
6739         }
6740 }
6741 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6742         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6743                 let contents = if o.result_ok {
6744                         let _ = unsafe { Box::from_raw(o.contents.result) };
6745                         o.contents.result = core::ptr::null_mut();
6746                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6747                 } else {
6748                         let err = unsafe { o.contents.err };
6749                         unsafe { o.contents.err = core::ptr::null_mut(); }
6750                         CResult_NoneLightningErrorZPtr { err }
6751                 };
6752                 Self {
6753                         contents,
6754                         result_ok: o.result_ok,
6755                 }
6756         }
6757 }
6758 impl Clone for CResult_NoneLightningErrorZ {
6759         fn clone(&self) -> Self {
6760                 if self.result_ok {
6761                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6762                                 result: core::ptr::null_mut()
6763                         } }
6764                 } else {
6765                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6766                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6767                         } }
6768                 }
6769         }
6770 }
6771 #[no_mangle]
6772 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6773 /// but with all dynamically-allocated buffers duplicated in new buffers.
6774 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6775 #[repr(C)]
6776 /// The contents of CResult_boolLightningErrorZ
6777 pub union CResult_boolLightningErrorZPtr {
6778         /// A pointer to the contents in the success state.
6779         /// Reading from this pointer when `result_ok` is not set is undefined.
6780         pub result: *mut bool,
6781         /// A pointer to the contents in the error state.
6782         /// Reading from this pointer when `result_ok` is set is undefined.
6783         pub err: *mut crate::lightning::ln::msgs::LightningError,
6784 }
6785 #[repr(C)]
6786 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6787 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6789 pub struct CResult_boolLightningErrorZ {
6790         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6791         /// `err` or `result` depending on the state of `result_ok`.
6792         pub contents: CResult_boolLightningErrorZPtr,
6793         /// Whether this CResult_boolLightningErrorZ represents a success state.
6794         pub result_ok: bool,
6795 }
6796 #[no_mangle]
6797 /// Creates a new CResult_boolLightningErrorZ in the success state.
6798 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6799         CResult_boolLightningErrorZ {
6800                 contents: CResult_boolLightningErrorZPtr {
6801                         result: Box::into_raw(Box::new(o)),
6802                 },
6803                 result_ok: true,
6804         }
6805 }
6806 #[no_mangle]
6807 /// Creates a new CResult_boolLightningErrorZ in the error state.
6808 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6809         CResult_boolLightningErrorZ {
6810                 contents: CResult_boolLightningErrorZPtr {
6811                         err: Box::into_raw(Box::new(e)),
6812                 },
6813                 result_ok: false,
6814         }
6815 }
6816 /// Checks if the given object is currently in the success state
6817 #[no_mangle]
6818 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6819         o.result_ok
6820 }
6821 #[no_mangle]
6822 /// Frees any resources used by the CResult_boolLightningErrorZ.
6823 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6824 impl Drop for CResult_boolLightningErrorZ {
6825         fn drop(&mut self) {
6826                 if self.result_ok {
6827                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6828                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6829                         }
6830                 } else {
6831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6833                         }
6834                 }
6835         }
6836 }
6837 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6838         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6839                 let contents = if o.result_ok {
6840                         let result = unsafe { o.contents.result };
6841                         unsafe { o.contents.result = core::ptr::null_mut() };
6842                         CResult_boolLightningErrorZPtr { result }
6843                 } else {
6844                         let err = unsafe { o.contents.err };
6845                         unsafe { o.contents.err = core::ptr::null_mut(); }
6846                         CResult_boolLightningErrorZPtr { err }
6847                 };
6848                 Self {
6849                         contents,
6850                         result_ok: o.result_ok,
6851                 }
6852         }
6853 }
6854 impl Clone for CResult_boolLightningErrorZ {
6855         fn clone(&self) -> Self {
6856                 if self.result_ok {
6857                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6858                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6859                         } }
6860                 } else {
6861                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6862                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6863                         } }
6864                 }
6865         }
6866 }
6867 #[no_mangle]
6868 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6869 /// but with all dynamically-allocated buffers duplicated in new buffers.
6870 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6871 #[repr(C)]
6872 /// A tuple of 3 elements. See the individual fields for the types contained.
6873 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6874         /// The element at position 0
6875         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6876         /// The element at position 1
6877         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6878         /// The element at position 2
6879         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6880 }
6881 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6882         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6883                 Self {
6884                         a: tup.0,
6885                         b: tup.1,
6886                         c: tup.2,
6887                 }
6888         }
6889 }
6890 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6891         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6892                 (self.a, self.b, self.c)
6893         }
6894 }
6895 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6896         fn clone(&self) -> Self {
6897                 Self {
6898                         a: Clone::clone(&self.a),
6899                         b: Clone::clone(&self.b),
6900                         c: Clone::clone(&self.c),
6901                 }
6902         }
6903 }
6904 #[no_mangle]
6905 /// Creates a new tuple which has the same data as `orig`
6906 /// but with all dynamically-allocated buffers duplicated in new buffers.
6907 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6908 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6909 #[no_mangle]
6910 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 {
6911         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6912 }
6913
6914 #[no_mangle]
6915 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6916 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6917 #[repr(C)]
6918 #[derive(Clone)]
6919 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6920 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6921         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6922         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6923         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6924         None
6925 }
6926 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6927         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6928                 if let Self::None = self { false } else { true }
6929         }
6930         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6931                 !self.is_some()
6932         }
6933         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6934                 if let Self::Some(v) = self { v } else { unreachable!() }
6935         }
6936 }
6937 #[no_mangle]
6938 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6939 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6940         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6941 }
6942 #[no_mangle]
6943 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6944 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6945         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6946 }
6947 #[no_mangle]
6948 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6949 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6950 #[no_mangle]
6951 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6954 #[repr(C)]
6955 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6956 /// This corresponds to std::vector in C++
6957 pub struct CVec_MessageSendEventZ {
6958         /// The elements in the array.
6959         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6960         pub data: *mut crate::lightning::events::MessageSendEvent,
6961         /// The number of elements pointed to by `data`.
6962         pub datalen: usize
6963 }
6964 impl CVec_MessageSendEventZ {
6965         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6966                 if self.datalen == 0 { return Vec::new(); }
6967                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6968                 self.data = core::ptr::null_mut();
6969                 self.datalen = 0;
6970                 ret
6971         }
6972         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6973                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6974         }
6975 }
6976 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6977         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6978                 let datalen = v.len();
6979                 let data = Box::into_raw(v.into_boxed_slice());
6980                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6981         }
6982 }
6983 #[no_mangle]
6984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6985 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6986 impl Drop for CVec_MessageSendEventZ {
6987         fn drop(&mut self) {
6988                 if self.datalen == 0 { return; }
6989                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6990         }
6991 }
6992 impl Clone for CVec_MessageSendEventZ {
6993         fn clone(&self) -> Self {
6994                 let mut res = Vec::new();
6995                 if self.datalen == 0 { return Self::from(res); }
6996                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6997                 Self::from(res)
6998         }
6999 }
7000 #[repr(C)]
7001 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
7002 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
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::ChannelUpdateInfo,
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_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
7012 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
7015         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
7016         /// `err` or `result` depending on the state of `result_ok`.
7017         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
7018         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
7019         pub result_ok: bool,
7020 }
7021 #[no_mangle]
7022 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
7023 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7024         CResult_ChannelUpdateInfoDecodeErrorZ {
7025                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7026                         result: Box::into_raw(Box::new(o)),
7027                 },
7028                 result_ok: true,
7029         }
7030 }
7031 #[no_mangle]
7032 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
7033 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7034         CResult_ChannelUpdateInfoDecodeErrorZ {
7035                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
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_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
7044         o.result_ok
7045 }
7046 #[no_mangle]
7047 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
7048 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
7049 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
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::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
7063         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, 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_ChannelUpdateInfoDecodeErrorZPtr { result }
7068                 } else {
7069                         let err = unsafe { o.contents.err };
7070                         unsafe { o.contents.err = core::ptr::null_mut(); }
7071                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
7072                 };
7073                 Self {
7074                         contents,
7075                         result_ok: o.result_ok,
7076                 }
7077         }
7078 }
7079 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
7080         fn clone(&self) -> Self {
7081                 if self.result_ok {
7082                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7083                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
7084                         } }
7085                 } else {
7086                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
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_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
7094 /// but with all dynamically-allocated buffers duplicated in new buffers.
7095 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
7096 #[repr(C)]
7097 /// The contents of CResult_ChannelInfoDecodeErrorZ
7098 pub union CResult_ChannelInfoDecodeErrorZPtr {
7099         /// A pointer to the contents in the success state.
7100         /// Reading from this pointer when `result_ok` is not set is undefined.
7101         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
7102         /// A pointer to the contents in the error state.
7103         /// Reading from this pointer when `result_ok` is set is undefined.
7104         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7105 }
7106 #[repr(C)]
7107 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7108 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7110 pub struct CResult_ChannelInfoDecodeErrorZ {
7111         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7112         /// `err` or `result` depending on the state of `result_ok`.
7113         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7114         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7115         pub result_ok: bool,
7116 }
7117 #[no_mangle]
7118 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7119 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7120         CResult_ChannelInfoDecodeErrorZ {
7121                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7122                         result: Box::into_raw(Box::new(o)),
7123                 },
7124                 result_ok: true,
7125         }
7126 }
7127 #[no_mangle]
7128 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7129 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7130         CResult_ChannelInfoDecodeErrorZ {
7131                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7132                         err: Box::into_raw(Box::new(e)),
7133                 },
7134                 result_ok: false,
7135         }
7136 }
7137 /// Checks if the given object is currently in the success state
7138 #[no_mangle]
7139 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
7140         o.result_ok
7141 }
7142 #[no_mangle]
7143 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7144 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7145 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7146         fn drop(&mut self) {
7147                 if self.result_ok {
7148                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7149                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7150                         }
7151                 } else {
7152                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7153                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7154                         }
7155                 }
7156         }
7157 }
7158 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7159         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7160                 let contents = if o.result_ok {
7161                         let result = unsafe { o.contents.result };
7162                         unsafe { o.contents.result = core::ptr::null_mut() };
7163                         CResult_ChannelInfoDecodeErrorZPtr { result }
7164                 } else {
7165                         let err = unsafe { o.contents.err };
7166                         unsafe { o.contents.err = core::ptr::null_mut(); }
7167                         CResult_ChannelInfoDecodeErrorZPtr { err }
7168                 };
7169                 Self {
7170                         contents,
7171                         result_ok: o.result_ok,
7172                 }
7173         }
7174 }
7175 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7176         fn clone(&self) -> Self {
7177                 if self.result_ok {
7178                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7179                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7180                         } }
7181                 } else {
7182                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7183                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7184                         } }
7185                 }
7186         }
7187 }
7188 #[no_mangle]
7189 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7190 /// but with all dynamically-allocated buffers duplicated in new buffers.
7191 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7192 #[repr(C)]
7193 /// The contents of CResult_RoutingFeesDecodeErrorZ
7194 pub union CResult_RoutingFeesDecodeErrorZPtr {
7195         /// A pointer to the contents in the success state.
7196         /// Reading from this pointer when `result_ok` is not set is undefined.
7197         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7198         /// A pointer to the contents in the error state.
7199         /// Reading from this pointer when `result_ok` is set is undefined.
7200         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7201 }
7202 #[repr(C)]
7203 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7204 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7206 pub struct CResult_RoutingFeesDecodeErrorZ {
7207         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7208         /// `err` or `result` depending on the state of `result_ok`.
7209         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7210         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7211         pub result_ok: bool,
7212 }
7213 #[no_mangle]
7214 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7215 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7216         CResult_RoutingFeesDecodeErrorZ {
7217                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7218                         result: Box::into_raw(Box::new(o)),
7219                 },
7220                 result_ok: true,
7221         }
7222 }
7223 #[no_mangle]
7224 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7225 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7226         CResult_RoutingFeesDecodeErrorZ {
7227                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7228                         err: Box::into_raw(Box::new(e)),
7229                 },
7230                 result_ok: false,
7231         }
7232 }
7233 /// Checks if the given object is currently in the success state
7234 #[no_mangle]
7235 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7236         o.result_ok
7237 }
7238 #[no_mangle]
7239 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7240 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7241 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7242         fn drop(&mut self) {
7243                 if self.result_ok {
7244                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7245                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7246                         }
7247                 } else {
7248                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7249                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7250                         }
7251                 }
7252         }
7253 }
7254 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7255         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7256                 let contents = if o.result_ok {
7257                         let result = unsafe { o.contents.result };
7258                         unsafe { o.contents.result = core::ptr::null_mut() };
7259                         CResult_RoutingFeesDecodeErrorZPtr { result }
7260                 } else {
7261                         let err = unsafe { o.contents.err };
7262                         unsafe { o.contents.err = core::ptr::null_mut(); }
7263                         CResult_RoutingFeesDecodeErrorZPtr { err }
7264                 };
7265                 Self {
7266                         contents,
7267                         result_ok: o.result_ok,
7268                 }
7269         }
7270 }
7271 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7272         fn clone(&self) -> Self {
7273                 if self.result_ok {
7274                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7275                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7276                         } }
7277                 } else {
7278                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7279                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7280                         } }
7281                 }
7282         }
7283 }
7284 #[no_mangle]
7285 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7286 /// but with all dynamically-allocated buffers duplicated in new buffers.
7287 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7288 #[repr(C)]
7289 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7290 /// This corresponds to std::vector in C++
7291 pub struct CVec_SocketAddressZ {
7292         /// The elements in the array.
7293         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7294         pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7295         /// The number of elements pointed to by `data`.
7296         pub datalen: usize
7297 }
7298 impl CVec_SocketAddressZ {
7299         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7300                 if self.datalen == 0 { return Vec::new(); }
7301                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7302                 self.data = core::ptr::null_mut();
7303                 self.datalen = 0;
7304                 ret
7305         }
7306         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7307                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7308         }
7309 }
7310 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7311         fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7312                 let datalen = v.len();
7313                 let data = Box::into_raw(v.into_boxed_slice());
7314                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7315         }
7316 }
7317 #[no_mangle]
7318 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7319 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7320 impl Drop for CVec_SocketAddressZ {
7321         fn drop(&mut self) {
7322                 if self.datalen == 0 { return; }
7323                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7324         }
7325 }
7326 impl Clone for CVec_SocketAddressZ {
7327         fn clone(&self) -> Self {
7328                 let mut res = Vec::new();
7329                 if self.datalen == 0 { return Self::from(res); }
7330                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7331                 Self::from(res)
7332         }
7333 }
7334 #[repr(C)]
7335 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7336 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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::NodeAnnouncementInfo,
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_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7346 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ {
7349         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7350         /// `err` or `result` depending on the state of `result_ok`.
7351         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7352         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7353         pub result_ok: bool,
7354 }
7355 #[no_mangle]
7356 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7357 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7358         CResult_NodeAnnouncementInfoDecodeErrorZ {
7359                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7360                         result: Box::into_raw(Box::new(o)),
7361                 },
7362                 result_ok: true,
7363         }
7364 }
7365 #[no_mangle]
7366 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7367 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7368         CResult_NodeAnnouncementInfoDecodeErrorZ {
7369                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7378         o.result_ok
7379 }
7380 #[no_mangle]
7381 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7382 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7383 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
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::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, 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_NodeAnnouncementInfoDecodeErrorZPtr { result }
7402                 } else {
7403                         let err = unsafe { o.contents.err };
7404                         unsafe { o.contents.err = core::ptr::null_mut(); }
7405                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7406                 };
7407                 Self {
7408                         contents,
7409                         result_ok: o.result_ok,
7410                 }
7411         }
7412 }
7413 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7414         fn clone(&self) -> Self {
7415                 if self.result_ok {
7416                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7417                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7418                         } }
7419                 } else {
7420                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7428 /// but with all dynamically-allocated buffers duplicated in new buffers.
7429 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7430 #[repr(C)]
7431 /// The contents of CResult_NodeAliasDecodeErrorZ
7432 pub union CResult_NodeAliasDecodeErrorZPtr {
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::NodeAlias,
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_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7442 /// containing a crate::lightning::routing::gossip::NodeAlias 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_NodeAliasDecodeErrorZ {
7445         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7446         /// `err` or `result` depending on the state of `result_ok`.
7447         pub contents: CResult_NodeAliasDecodeErrorZPtr,
7448         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7449         pub result_ok: bool,
7450 }
7451 #[no_mangle]
7452 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7453 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7454         CResult_NodeAliasDecodeErrorZ {
7455                 contents: CResult_NodeAliasDecodeErrorZPtr {
7456                         result: Box::into_raw(Box::new(o)),
7457                 },
7458                 result_ok: true,
7459         }
7460 }
7461 #[no_mangle]
7462 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7463 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7464         CResult_NodeAliasDecodeErrorZ {
7465                 contents: CResult_NodeAliasDecodeErrorZPtr {
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_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7474         o.result_ok
7475 }
7476 #[no_mangle]
7477 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7478 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7479 impl Drop for CResult_NodeAliasDecodeErrorZ {
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::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7493         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, 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_NodeAliasDecodeErrorZPtr { result }
7498                 } else {
7499                         let err = unsafe { o.contents.err };
7500                         unsafe { o.contents.err = core::ptr::null_mut(); }
7501                         CResult_NodeAliasDecodeErrorZPtr { err }
7502                 };
7503                 Self {
7504                         contents,
7505                         result_ok: o.result_ok,
7506                 }
7507         }
7508 }
7509 impl Clone for CResult_NodeAliasDecodeErrorZ {
7510         fn clone(&self) -> Self {
7511                 if self.result_ok {
7512                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7513                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7514                         } }
7515                 } else {
7516                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7517                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7518                         } }
7519                 }
7520         }
7521 }
7522 #[no_mangle]
7523 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7524 /// but with all dynamically-allocated buffers duplicated in new buffers.
7525 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7526 #[repr(C)]
7527 /// The contents of CResult_NodeInfoDecodeErrorZ
7528 pub union CResult_NodeInfoDecodeErrorZPtr {
7529         /// A pointer to the contents in the success state.
7530         /// Reading from this pointer when `result_ok` is not set is undefined.
7531         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7532         /// A pointer to the contents in the error state.
7533         /// Reading from this pointer when `result_ok` is set is undefined.
7534         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7535 }
7536 #[repr(C)]
7537 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7538 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7540 pub struct CResult_NodeInfoDecodeErrorZ {
7541         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7542         /// `err` or `result` depending on the state of `result_ok`.
7543         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7544         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7545         pub result_ok: bool,
7546 }
7547 #[no_mangle]
7548 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7549 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7550         CResult_NodeInfoDecodeErrorZ {
7551                 contents: CResult_NodeInfoDecodeErrorZPtr {
7552                         result: Box::into_raw(Box::new(o)),
7553                 },
7554                 result_ok: true,
7555         }
7556 }
7557 #[no_mangle]
7558 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7559 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7560         CResult_NodeInfoDecodeErrorZ {
7561                 contents: CResult_NodeInfoDecodeErrorZPtr {
7562                         err: Box::into_raw(Box::new(e)),
7563                 },
7564                 result_ok: false,
7565         }
7566 }
7567 /// Checks if the given object is currently in the success state
7568 #[no_mangle]
7569 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7570         o.result_ok
7571 }
7572 #[no_mangle]
7573 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7574 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7575 impl Drop for CResult_NodeInfoDecodeErrorZ {
7576         fn drop(&mut self) {
7577                 if self.result_ok {
7578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7580                         }
7581                 } else {
7582                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7583                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7584                         }
7585                 }
7586         }
7587 }
7588 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7589         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7590                 let contents = if o.result_ok {
7591                         let result = unsafe { o.contents.result };
7592                         unsafe { o.contents.result = core::ptr::null_mut() };
7593                         CResult_NodeInfoDecodeErrorZPtr { result }
7594                 } else {
7595                         let err = unsafe { o.contents.err };
7596                         unsafe { o.contents.err = core::ptr::null_mut(); }
7597                         CResult_NodeInfoDecodeErrorZPtr { err }
7598                 };
7599                 Self {
7600                         contents,
7601                         result_ok: o.result_ok,
7602                 }
7603         }
7604 }
7605 impl Clone for CResult_NodeInfoDecodeErrorZ {
7606         fn clone(&self) -> Self {
7607                 if self.result_ok {
7608                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7609                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7610                         } }
7611                 } else {
7612                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7613                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7614                         } }
7615                 }
7616         }
7617 }
7618 #[no_mangle]
7619 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7620 /// but with all dynamically-allocated buffers duplicated in new buffers.
7621 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7622 #[repr(C)]
7623 /// The contents of CResult_NetworkGraphDecodeErrorZ
7624 pub union CResult_NetworkGraphDecodeErrorZPtr {
7625         /// A pointer to the contents in the success state.
7626         /// Reading from this pointer when `result_ok` is not set is undefined.
7627         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7628         /// A pointer to the contents in the error state.
7629         /// Reading from this pointer when `result_ok` is set is undefined.
7630         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7631 }
7632 #[repr(C)]
7633 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7634 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7636 pub struct CResult_NetworkGraphDecodeErrorZ {
7637         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7638         /// `err` or `result` depending on the state of `result_ok`.
7639         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7640         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7641         pub result_ok: bool,
7642 }
7643 #[no_mangle]
7644 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7645 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7646         CResult_NetworkGraphDecodeErrorZ {
7647                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7648                         result: Box::into_raw(Box::new(o)),
7649                 },
7650                 result_ok: true,
7651         }
7652 }
7653 #[no_mangle]
7654 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7655 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7656         CResult_NetworkGraphDecodeErrorZ {
7657                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7658                         err: Box::into_raw(Box::new(e)),
7659                 },
7660                 result_ok: false,
7661         }
7662 }
7663 /// Checks if the given object is currently in the success state
7664 #[no_mangle]
7665 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7666         o.result_ok
7667 }
7668 #[no_mangle]
7669 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7670 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7671 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7672         fn drop(&mut self) {
7673                 if self.result_ok {
7674                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7675                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7676                         }
7677                 } else {
7678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7680                         }
7681                 }
7682         }
7683 }
7684 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7685         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7686                 let contents = if o.result_ok {
7687                         let result = unsafe { o.contents.result };
7688                         unsafe { o.contents.result = core::ptr::null_mut() };
7689                         CResult_NetworkGraphDecodeErrorZPtr { result }
7690                 } else {
7691                         let err = unsafe { o.contents.err };
7692                         unsafe { o.contents.err = core::ptr::null_mut(); }
7693                         CResult_NetworkGraphDecodeErrorZPtr { err }
7694                 };
7695                 Self {
7696                         contents,
7697                         result_ok: o.result_ok,
7698                 }
7699         }
7700 }
7701 #[repr(C)]
7702 #[derive(Clone)]
7703 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7704 pub enum COption_CVec_SocketAddressZZ {
7705         /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7706         Some(crate::c_types::derived::CVec_SocketAddressZ),
7707         /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7708         None
7709 }
7710 impl COption_CVec_SocketAddressZZ {
7711         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7712                 if let Self::None = self { false } else { true }
7713         }
7714         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7715                 !self.is_some()
7716         }
7717         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7718                 if let Self::Some(v) = self { v } else { unreachable!() }
7719         }
7720 }
7721 #[no_mangle]
7722 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7723 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7724         COption_CVec_SocketAddressZZ::Some(o)
7725 }
7726 #[no_mangle]
7727 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7728 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7729         COption_CVec_SocketAddressZZ::None
7730 }
7731 #[no_mangle]
7732 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7733 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7734 #[no_mangle]
7735 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7736 /// but with all dynamically-allocated buffers duplicated in new buffers.
7737 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { 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::sign::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::sign::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::sign::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::sign::HTLCDescriptor] {
7803                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7804         }
7805 }
7806 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7807         fn from(v: Vec<crate::lightning::sign::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 #[derive(Clone)]
9139 /// An enum which can either contain a crate::c_types::Str or not
9140 pub enum COption_StrZ {
9141         /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
9142         Some(crate::c_types::Str),
9143         /// When we're in this state, this COption_StrZ contains nothing
9144         None
9145 }
9146 impl COption_StrZ {
9147         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9148                 if let Self::None = self { false } else { true }
9149         }
9150         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9151                 !self.is_some()
9152         }
9153         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
9154                 if let Self::Some(v) = self { v } else { unreachable!() }
9155         }
9156 }
9157 #[no_mangle]
9158 /// Constructs a new COption_StrZ containing a crate::c_types::Str
9159 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
9160         COption_StrZ::Some(o)
9161 }
9162 #[no_mangle]
9163 /// Constructs a new COption_StrZ containing nothing
9164 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
9165         COption_StrZ::None
9166 }
9167 #[no_mangle]
9168 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
9169 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
9170 #[no_mangle]
9171 /// Creates a new COption_StrZ which has the same data as `orig`
9172 /// but with all dynamically-allocated buffers duplicated in new buffers.
9173 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
9174 #[repr(C)]
9175 /// The contents of CResult_NoneBolt12SemanticErrorZ
9176 pub union CResult_NoneBolt12SemanticErrorZPtr {
9177         /// Note that this value is always NULL, as there are no contents in the OK variant
9178         pub result: *mut core::ffi::c_void,
9179         /// A pointer to the contents in the error state.
9180         /// Reading from this pointer when `result_ok` is set is undefined.
9181         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
9182 }
9183 #[repr(C)]
9184 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
9185 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
9186 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9187 pub struct CResult_NoneBolt12SemanticErrorZ {
9188         /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
9189         /// `err` or `result` depending on the state of `result_ok`.
9190         pub contents: CResult_NoneBolt12SemanticErrorZPtr,
9191         /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
9192         pub result_ok: bool,
9193 }
9194 #[no_mangle]
9195 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
9196 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
9197         CResult_NoneBolt12SemanticErrorZ {
9198                 contents: CResult_NoneBolt12SemanticErrorZPtr {
9199                         result: core::ptr::null_mut(),
9200                 },
9201                 result_ok: true,
9202         }
9203 }
9204 #[no_mangle]
9205 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
9206 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
9207         CResult_NoneBolt12SemanticErrorZ {
9208                 contents: CResult_NoneBolt12SemanticErrorZPtr {
9209                         err: Box::into_raw(Box::new(e)),
9210                 },
9211                 result_ok: false,
9212         }
9213 }
9214 /// Checks if the given object is currently in the success state
9215 #[no_mangle]
9216 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
9217         o.result_ok
9218 }
9219 #[no_mangle]
9220 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
9221 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
9222 impl Drop for CResult_NoneBolt12SemanticErrorZ {
9223         fn drop(&mut self) {
9224                 if self.result_ok {
9225                 } else {
9226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9228                         }
9229                 }
9230         }
9231 }
9232 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
9233         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
9234                 let contents = if o.result_ok {
9235                         let _ = unsafe { Box::from_raw(o.contents.result) };
9236                         o.contents.result = core::ptr::null_mut();
9237                         CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
9238                 } else {
9239                         let err = unsafe { o.contents.err };
9240                         unsafe { o.contents.err = core::ptr::null_mut(); }
9241                         CResult_NoneBolt12SemanticErrorZPtr { err }
9242                 };
9243                 Self {
9244                         contents,
9245                         result_ok: o.result_ok,
9246                 }
9247         }
9248 }
9249 impl Clone for CResult_NoneBolt12SemanticErrorZ {
9250         fn clone(&self) -> Self {
9251                 if self.result_ok {
9252                         Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
9253                                 result: core::ptr::null_mut()
9254                         } }
9255                 } else {
9256                         Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
9257                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
9258                         } }
9259                 }
9260         }
9261 }
9262 #[no_mangle]
9263 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
9264 /// but with all dynamically-allocated buffers duplicated in new buffers.
9265 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
9266 #[repr(C)]
9267 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9268 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9269         /// A pointer to the contents in the success state.
9270         /// Reading from this pointer when `result_ok` is not set is undefined.
9271         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9272         /// Note that this value is always NULL, as there are no contents in the Err variant
9273         pub err: *mut core::ffi::c_void,
9274 }
9275 #[repr(C)]
9276 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9277 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9279 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9280         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9281         /// `err` or `result` depending on the state of `result_ok`.
9282         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9283         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9284         pub result_ok: bool,
9285 }
9286 #[no_mangle]
9287 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9288 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9289         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9290                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9291                         result: Box::into_raw(Box::new(o)),
9292                 },
9293                 result_ok: true,
9294         }
9295 }
9296 #[no_mangle]
9297 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9298 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9299         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9300                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9301                         err: core::ptr::null_mut(),
9302                 },
9303                 result_ok: false,
9304         }
9305 }
9306 /// Checks if the given object is currently in the success state
9307 #[no_mangle]
9308 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9309         o.result_ok
9310 }
9311 #[no_mangle]
9312 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9313 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9314 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9315         fn drop(&mut self) {
9316                 if self.result_ok {
9317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9319                         }
9320                 } else {
9321                 }
9322         }
9323 }
9324 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9325         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9326                 let contents = if o.result_ok {
9327                         let result = unsafe { o.contents.result };
9328                         unsafe { o.contents.result = core::ptr::null_mut() };
9329                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9330                 } else {
9331                         let _ = unsafe { Box::from_raw(o.contents.err) };
9332                         o.contents.err = core::ptr::null_mut();
9333                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9334                 };
9335                 Self {
9336                         contents,
9337                         result_ok: o.result_ok,
9338                 }
9339         }
9340 }
9341 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9342         fn clone(&self) -> Self {
9343                 if self.result_ok {
9344                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9345                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9346                         } }
9347                 } else {
9348                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9349                                 err: core::ptr::null_mut()
9350                         } }
9351                 }
9352         }
9353 }
9354 #[no_mangle]
9355 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9356 /// but with all dynamically-allocated buffers duplicated in new buffers.
9357 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9358 #[repr(C)]
9359 #[derive(Clone)]
9360 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
9361 pub enum COption_OffersMessageZ {
9362         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
9363         Some(crate::lightning::onion_message::offers::OffersMessage),
9364         /// When we're in this state, this COption_OffersMessageZ contains nothing
9365         None
9366 }
9367 impl COption_OffersMessageZ {
9368         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9369                 if let Self::None = self { false } else { true }
9370         }
9371         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9372                 !self.is_some()
9373         }
9374         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
9375                 if let Self::Some(v) = self { v } else { unreachable!() }
9376         }
9377 }
9378 #[no_mangle]
9379 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
9380 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
9381         COption_OffersMessageZ::Some(o)
9382 }
9383 #[no_mangle]
9384 /// Constructs a new COption_OffersMessageZ containing nothing
9385 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
9386         COption_OffersMessageZ::None
9387 }
9388 #[no_mangle]
9389 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
9390 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
9391 #[no_mangle]
9392 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
9393 /// but with all dynamically-allocated buffers duplicated in new buffers.
9394 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
9395 #[repr(C)]
9396 /// A tuple of 3 elements. See the individual fields for the types contained.
9397 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
9398         /// The element at position 0
9399         pub a: crate::lightning::onion_message::offers::OffersMessage,
9400         /// The element at position 1
9401         pub b: crate::lightning::onion_message::messenger::Destination,
9402         /// The element at position 2
9403         pub c: crate::lightning::blinded_path::BlindedPath,
9404 }
9405 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
9406         fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
9407                 Self {
9408                         a: tup.0,
9409                         b: tup.1,
9410                         c: tup.2,
9411                 }
9412         }
9413 }
9414 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
9415         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
9416                 (self.a, self.b, self.c)
9417         }
9418 }
9419 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
9420         fn clone(&self) -> Self {
9421                 Self {
9422                         a: Clone::clone(&self.a),
9423                         b: Clone::clone(&self.b),
9424                         c: Clone::clone(&self.c),
9425                 }
9426         }
9427 }
9428 #[no_mangle]
9429 /// Creates a new tuple which has the same data as `orig`
9430 /// but with all dynamically-allocated buffers duplicated in new buffers.
9431 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
9432 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
9433 #[no_mangle]
9434 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
9435         C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
9436 }
9437
9438 #[no_mangle]
9439 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
9440 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
9441 #[repr(C)]
9442 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
9443 /// This corresponds to std::vector in C++
9444 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9445         /// The elements in the array.
9446         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9447         pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
9448         /// The number of elements pointed to by `data`.
9449         pub datalen: usize
9450 }
9451 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9452         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
9453                 if self.datalen == 0 { return Vec::new(); }
9454                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9455                 self.data = core::ptr::null_mut();
9456                 self.datalen = 0;
9457                 ret
9458         }
9459         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
9460                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9461         }
9462 }
9463 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9464         fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
9465                 let datalen = v.len();
9466                 let data = Box::into_raw(v.into_boxed_slice());
9467                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9468         }
9469 }
9470 #[no_mangle]
9471 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9472 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
9473 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9474         fn drop(&mut self) {
9475                 if self.datalen == 0 { return; }
9476                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9477         }
9478 }
9479 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9480         fn clone(&self) -> Self {
9481                 let mut res = Vec::new();
9482                 if self.datalen == 0 { return Self::from(res); }
9483                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9484                 Self::from(res)
9485         }
9486 }
9487 #[repr(C)]
9488 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9489 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9490         /// A pointer to the contents in the success state.
9491         /// Reading from this pointer when `result_ok` is not set is undefined.
9492         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9493         /// A pointer to the contents in the error state.
9494         /// Reading from this pointer when `result_ok` is set is undefined.
9495         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9496 }
9497 #[repr(C)]
9498 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9499 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9501 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9502         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9503         /// `err` or `result` depending on the state of `result_ok`.
9504         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9505         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9506         pub result_ok: bool,
9507 }
9508 #[no_mangle]
9509 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9510 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9511         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9512                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9513                         result: Box::into_raw(Box::new(o)),
9514                 },
9515                 result_ok: true,
9516         }
9517 }
9518 #[no_mangle]
9519 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9520 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9521         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9522                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9523                         err: Box::into_raw(Box::new(e)),
9524                 },
9525                 result_ok: false,
9526         }
9527 }
9528 /// Checks if the given object is currently in the success state
9529 #[no_mangle]
9530 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9531         o.result_ok
9532 }
9533 #[no_mangle]
9534 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9535 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9536 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9537         fn drop(&mut self) {
9538                 if self.result_ok {
9539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9541                         }
9542                 } else {
9543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9545                         }
9546                 }
9547         }
9548 }
9549 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9550         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9551                 let contents = if o.result_ok {
9552                         let result = unsafe { o.contents.result };
9553                         unsafe { o.contents.result = core::ptr::null_mut() };
9554                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9555                 } else {
9556                         let err = unsafe { o.contents.err };
9557                         unsafe { o.contents.err = core::ptr::null_mut(); }
9558                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9559                 };
9560                 Self {
9561                         contents,
9562                         result_ok: o.result_ok,
9563                 }
9564         }
9565 }
9566 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9567         fn clone(&self) -> Self {
9568                 if self.result_ok {
9569                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9570                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9571                         } }
9572                 } else {
9573                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9574                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9575                         } }
9576                 }
9577         }
9578 }
9579 #[no_mangle]
9580 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9581 /// but with all dynamically-allocated buffers duplicated in new buffers.
9582 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9583 #[repr(C)]
9584 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9585 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9586         /// A pointer to the contents in the success state.
9587         /// Reading from this pointer when `result_ok` is not set is undefined.
9588         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9589         /// A pointer to the contents in the error state.
9590         /// Reading from this pointer when `result_ok` is set is undefined.
9591         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9592 }
9593 #[repr(C)]
9594 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9595 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9597 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9598         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9599         /// `err` or `result` depending on the state of `result_ok`.
9600         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9601         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9602         pub result_ok: bool,
9603 }
9604 #[no_mangle]
9605 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9606 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9607         CResult_ChannelCounterpartyDecodeErrorZ {
9608                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9609                         result: Box::into_raw(Box::new(o)),
9610                 },
9611                 result_ok: true,
9612         }
9613 }
9614 #[no_mangle]
9615 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9616 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9617         CResult_ChannelCounterpartyDecodeErrorZ {
9618                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9619                         err: Box::into_raw(Box::new(e)),
9620                 },
9621                 result_ok: false,
9622         }
9623 }
9624 /// Checks if the given object is currently in the success state
9625 #[no_mangle]
9626 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9627         o.result_ok
9628 }
9629 #[no_mangle]
9630 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9631 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9632 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9633         fn drop(&mut self) {
9634                 if self.result_ok {
9635                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9636                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9637                         }
9638                 } else {
9639                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9640                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9641                         }
9642                 }
9643         }
9644 }
9645 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9646         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9647                 let contents = if o.result_ok {
9648                         let result = unsafe { o.contents.result };
9649                         unsafe { o.contents.result = core::ptr::null_mut() };
9650                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9651                 } else {
9652                         let err = unsafe { o.contents.err };
9653                         unsafe { o.contents.err = core::ptr::null_mut(); }
9654                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9655                 };
9656                 Self {
9657                         contents,
9658                         result_ok: o.result_ok,
9659                 }
9660         }
9661 }
9662 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9663         fn clone(&self) -> Self {
9664                 if self.result_ok {
9665                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9666                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9667                         } }
9668                 } else {
9669                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9670                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9671                         } }
9672                 }
9673         }
9674 }
9675 #[no_mangle]
9676 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9677 /// but with all dynamically-allocated buffers duplicated in new buffers.
9678 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9679 #[repr(C)]
9680 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9681 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9682         /// A pointer to the contents in the success state.
9683         /// Reading from this pointer when `result_ok` is not set is undefined.
9684         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9685         /// A pointer to the contents in the error state.
9686         /// Reading from this pointer when `result_ok` is set is undefined.
9687         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9688 }
9689 #[repr(C)]
9690 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9691 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9693 pub struct CResult_ChannelDetailsDecodeErrorZ {
9694         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9695         /// `err` or `result` depending on the state of `result_ok`.
9696         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9697         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9698         pub result_ok: bool,
9699 }
9700 #[no_mangle]
9701 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9702 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9703         CResult_ChannelDetailsDecodeErrorZ {
9704                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9705                         result: Box::into_raw(Box::new(o)),
9706                 },
9707                 result_ok: true,
9708         }
9709 }
9710 #[no_mangle]
9711 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9712 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9713         CResult_ChannelDetailsDecodeErrorZ {
9714                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9715                         err: Box::into_raw(Box::new(e)),
9716                 },
9717                 result_ok: false,
9718         }
9719 }
9720 /// Checks if the given object is currently in the success state
9721 #[no_mangle]
9722 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9723         o.result_ok
9724 }
9725 #[no_mangle]
9726 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9727 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9728 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9729         fn drop(&mut self) {
9730                 if self.result_ok {
9731                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9732                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9733                         }
9734                 } else {
9735                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9736                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9737                         }
9738                 }
9739         }
9740 }
9741 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9742         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9743                 let contents = if o.result_ok {
9744                         let result = unsafe { o.contents.result };
9745                         unsafe { o.contents.result = core::ptr::null_mut() };
9746                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9747                 } else {
9748                         let err = unsafe { o.contents.err };
9749                         unsafe { o.contents.err = core::ptr::null_mut(); }
9750                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9751                 };
9752                 Self {
9753                         contents,
9754                         result_ok: o.result_ok,
9755                 }
9756         }
9757 }
9758 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9759         fn clone(&self) -> Self {
9760                 if self.result_ok {
9761                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9762                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9763                         } }
9764                 } else {
9765                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9766                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9767                         } }
9768                 }
9769         }
9770 }
9771 #[no_mangle]
9772 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9773 /// but with all dynamically-allocated buffers duplicated in new buffers.
9774 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9775 #[repr(C)]
9776 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9777 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9778         /// A pointer to the contents in the success state.
9779         /// Reading from this pointer when `result_ok` is not set is undefined.
9780         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9781         /// A pointer to the contents in the error state.
9782         /// Reading from this pointer when `result_ok` is set is undefined.
9783         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9784 }
9785 #[repr(C)]
9786 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9787 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9789 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9790         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9791         /// `err` or `result` depending on the state of `result_ok`.
9792         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9793         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9794         pub result_ok: bool,
9795 }
9796 #[no_mangle]
9797 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9798 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9799         CResult_PhantomRouteHintsDecodeErrorZ {
9800                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9801                         result: Box::into_raw(Box::new(o)),
9802                 },
9803                 result_ok: true,
9804         }
9805 }
9806 #[no_mangle]
9807 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9808 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9809         CResult_PhantomRouteHintsDecodeErrorZ {
9810                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9811                         err: Box::into_raw(Box::new(e)),
9812                 },
9813                 result_ok: false,
9814         }
9815 }
9816 /// Checks if the given object is currently in the success state
9817 #[no_mangle]
9818 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9819         o.result_ok
9820 }
9821 #[no_mangle]
9822 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9823 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9824 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9825         fn drop(&mut self) {
9826                 if self.result_ok {
9827                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9828                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9829                         }
9830                 } else {
9831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9833                         }
9834                 }
9835         }
9836 }
9837 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9838         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9839                 let contents = if o.result_ok {
9840                         let result = unsafe { o.contents.result };
9841                         unsafe { o.contents.result = core::ptr::null_mut() };
9842                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9843                 } else {
9844                         let err = unsafe { o.contents.err };
9845                         unsafe { o.contents.err = core::ptr::null_mut(); }
9846                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9847                 };
9848                 Self {
9849                         contents,
9850                         result_ok: o.result_ok,
9851                 }
9852         }
9853 }
9854 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9855         fn clone(&self) -> Self {
9856                 if self.result_ok {
9857                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9858                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9859                         } }
9860                 } else {
9861                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9862                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9863                         } }
9864                 }
9865         }
9866 }
9867 #[no_mangle]
9868 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9869 /// but with all dynamically-allocated buffers duplicated in new buffers.
9870 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9871 #[repr(C)]
9872 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9873 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9874         /// A pointer to the contents in the success state.
9875         /// Reading from this pointer when `result_ok` is not set is undefined.
9876         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9877         /// A pointer to the contents in the error state.
9878         /// Reading from this pointer when `result_ok` is set is undefined.
9879         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9880 }
9881 #[repr(C)]
9882 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9883 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9885 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9886         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9887         /// `err` or `result` depending on the state of `result_ok`.
9888         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9889         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9890         pub result_ok: bool,
9891 }
9892 #[no_mangle]
9893 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9894 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9895         CResult_ChannelShutdownStateDecodeErrorZ {
9896                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9897                         result: Box::into_raw(Box::new(o)),
9898                 },
9899                 result_ok: true,
9900         }
9901 }
9902 #[no_mangle]
9903 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9904 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9905         CResult_ChannelShutdownStateDecodeErrorZ {
9906                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9907                         err: Box::into_raw(Box::new(e)),
9908                 },
9909                 result_ok: false,
9910         }
9911 }
9912 /// Checks if the given object is currently in the success state
9913 #[no_mangle]
9914 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9915         o.result_ok
9916 }
9917 #[no_mangle]
9918 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9919 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9920 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9921         fn drop(&mut self) {
9922                 if self.result_ok {
9923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9925                         }
9926                 } else {
9927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9929                         }
9930                 }
9931         }
9932 }
9933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9935                 let contents = if o.result_ok {
9936                         let result = unsafe { o.contents.result };
9937                         unsafe { o.contents.result = core::ptr::null_mut() };
9938                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9939                 } else {
9940                         let err = unsafe { o.contents.err };
9941                         unsafe { o.contents.err = core::ptr::null_mut(); }
9942                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9943                 };
9944                 Self {
9945                         contents,
9946                         result_ok: o.result_ok,
9947                 }
9948         }
9949 }
9950 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9951         fn clone(&self) -> Self {
9952                 if self.result_ok {
9953                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9954                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9955                         } }
9956                 } else {
9957                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9958                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9959                         } }
9960                 }
9961         }
9962 }
9963 #[no_mangle]
9964 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9965 /// but with all dynamically-allocated buffers duplicated in new buffers.
9966 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9967 #[repr(C)]
9968 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9969 /// This corresponds to std::vector in C++
9970 pub struct CVec_ChannelMonitorZ {
9971         /// The elements in the array.
9972         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9973         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9974         /// The number of elements pointed to by `data`.
9975         pub datalen: usize
9976 }
9977 impl CVec_ChannelMonitorZ {
9978         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9979                 if self.datalen == 0 { return Vec::new(); }
9980                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9981                 self.data = core::ptr::null_mut();
9982                 self.datalen = 0;
9983                 ret
9984         }
9985         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9986                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9987         }
9988 }
9989 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9990         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9991                 let datalen = v.len();
9992                 let data = Box::into_raw(v.into_boxed_slice());
9993                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9994         }
9995 }
9996 #[no_mangle]
9997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9998 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9999 impl Drop for CVec_ChannelMonitorZ {
10000         fn drop(&mut self) {
10001                 if self.datalen == 0 { return; }
10002                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10003         }
10004 }
10005 impl Clone for CVec_ChannelMonitorZ {
10006         fn clone(&self) -> Self {
10007                 let mut res = Vec::new();
10008                 if self.datalen == 0 { return Self::from(res); }
10009                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10010                 Self::from(res)
10011         }
10012 }
10013 #[repr(C)]
10014 /// A tuple of 2 elements. See the individual fields for the types contained.
10015 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
10016         /// The element at position 0
10017         pub a: crate::c_types::ThirtyTwoBytes,
10018         /// The element at position 1
10019         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10020 }
10021 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
10022         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10023                 Self {
10024                         a: tup.0,
10025                         b: tup.1,
10026                 }
10027         }
10028 }
10029 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
10030         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10031                 (self.a, self.b)
10032         }
10033 }
10034 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
10035 #[no_mangle]
10036 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
10037         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
10038 }
10039
10040 #[no_mangle]
10041 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
10042 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
10043 #[repr(C)]
10044 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
10045 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10046         /// A pointer to the contents in the success state.
10047         /// Reading from this pointer when `result_ok` is not set is undefined.
10048         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
10049         /// A pointer to the contents in the error state.
10050         /// Reading from this pointer when `result_ok` is set is undefined.
10051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10052 }
10053 #[repr(C)]
10054 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10055 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10057 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10058         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
10059         /// `err` or `result` depending on the state of `result_ok`.
10060         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
10061         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
10062         pub result_ok: bool,
10063 }
10064 #[no_mangle]
10065 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
10066 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10067         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10068                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10069                         result: Box::into_raw(Box::new(o)),
10070                 },
10071                 result_ok: true,
10072         }
10073 }
10074 #[no_mangle]
10075 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
10076 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10077         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10078                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10079                         err: Box::into_raw(Box::new(e)),
10080                 },
10081                 result_ok: false,
10082         }
10083 }
10084 /// Checks if the given object is currently in the success state
10085 #[no_mangle]
10086 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
10087         o.result_ok
10088 }
10089 #[no_mangle]
10090 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
10091 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
10092 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10093         fn drop(&mut self) {
10094                 if self.result_ok {
10095                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10096                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10097                         }
10098                 } else {
10099                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10100                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10101                         }
10102                 }
10103         }
10104 }
10105 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10106         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10107                 let contents = if o.result_ok {
10108                         let result = unsafe { o.contents.result };
10109                         unsafe { o.contents.result = core::ptr::null_mut() };
10110                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
10111                 } else {
10112                         let err = unsafe { o.contents.err };
10113                         unsafe { o.contents.err = core::ptr::null_mut(); }
10114                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
10115                 };
10116                 Self {
10117                         contents,
10118                         result_ok: o.result_ok,
10119                 }
10120         }
10121 }
10122 #[repr(C)]
10123 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
10124 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10125         /// A pointer to the contents in the success state.
10126         /// Reading from this pointer when `result_ok` is not set is undefined.
10127         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
10128         /// A pointer to the contents in the error state.
10129         /// Reading from this pointer when `result_ok` is set is undefined.
10130         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10131 }
10132 #[repr(C)]
10133 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
10134 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10136 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
10137         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
10138         /// `err` or `result` depending on the state of `result_ok`.
10139         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
10140         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
10141         pub result_ok: bool,
10142 }
10143 #[no_mangle]
10144 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
10145 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10146         CResult_MaxDustHTLCExposureDecodeErrorZ {
10147                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10148                         result: Box::into_raw(Box::new(o)),
10149                 },
10150                 result_ok: true,
10151         }
10152 }
10153 #[no_mangle]
10154 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
10155 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10156         CResult_MaxDustHTLCExposureDecodeErrorZ {
10157                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10158                         err: Box::into_raw(Box::new(e)),
10159                 },
10160                 result_ok: false,
10161         }
10162 }
10163 /// Checks if the given object is currently in the success state
10164 #[no_mangle]
10165 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
10166         o.result_ok
10167 }
10168 #[no_mangle]
10169 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
10170 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
10171 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
10172         fn drop(&mut self) {
10173                 if self.result_ok {
10174                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10175                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10176                         }
10177                 } else {
10178                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10179                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10180                         }
10181                 }
10182         }
10183 }
10184 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
10185         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10186                 let contents = if o.result_ok {
10187                         let result = unsafe { o.contents.result };
10188                         unsafe { o.contents.result = core::ptr::null_mut() };
10189                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
10190                 } else {
10191                         let err = unsafe { o.contents.err };
10192                         unsafe { o.contents.err = core::ptr::null_mut(); }
10193                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
10194                 };
10195                 Self {
10196                         contents,
10197                         result_ok: o.result_ok,
10198                 }
10199         }
10200 }
10201 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
10202         fn clone(&self) -> Self {
10203                 if self.result_ok {
10204                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10205                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
10206                         } }
10207                 } else {
10208                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10209                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10210                         } }
10211                 }
10212         }
10213 }
10214 #[no_mangle]
10215 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
10216 /// but with all dynamically-allocated buffers duplicated in new buffers.
10217 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
10218 #[repr(C)]
10219 /// The contents of CResult_ChannelConfigDecodeErrorZ
10220 pub union CResult_ChannelConfigDecodeErrorZPtr {
10221         /// A pointer to the contents in the success state.
10222         /// Reading from this pointer when `result_ok` is not set is undefined.
10223         pub result: *mut crate::lightning::util::config::ChannelConfig,
10224         /// A pointer to the contents in the error state.
10225         /// Reading from this pointer when `result_ok` is set is undefined.
10226         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10227 }
10228 #[repr(C)]
10229 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10230 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10231 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10232 pub struct CResult_ChannelConfigDecodeErrorZ {
10233         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10234         /// `err` or `result` depending on the state of `result_ok`.
10235         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10236         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10237         pub result_ok: bool,
10238 }
10239 #[no_mangle]
10240 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10241 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10242         CResult_ChannelConfigDecodeErrorZ {
10243                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10244                         result: Box::into_raw(Box::new(o)),
10245                 },
10246                 result_ok: true,
10247         }
10248 }
10249 #[no_mangle]
10250 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10251 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10252         CResult_ChannelConfigDecodeErrorZ {
10253                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10254                         err: Box::into_raw(Box::new(e)),
10255                 },
10256                 result_ok: false,
10257         }
10258 }
10259 /// Checks if the given object is currently in the success state
10260 #[no_mangle]
10261 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10262         o.result_ok
10263 }
10264 #[no_mangle]
10265 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10266 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10267 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10268         fn drop(&mut self) {
10269                 if self.result_ok {
10270                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10271                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10272                         }
10273                 } else {
10274                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10275                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10276                         }
10277                 }
10278         }
10279 }
10280 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10281         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10282                 let contents = if o.result_ok {
10283                         let result = unsafe { o.contents.result };
10284                         unsafe { o.contents.result = core::ptr::null_mut() };
10285                         CResult_ChannelConfigDecodeErrorZPtr { result }
10286                 } else {
10287                         let err = unsafe { o.contents.err };
10288                         unsafe { o.contents.err = core::ptr::null_mut(); }
10289                         CResult_ChannelConfigDecodeErrorZPtr { err }
10290                 };
10291                 Self {
10292                         contents,
10293                         result_ok: o.result_ok,
10294                 }
10295         }
10296 }
10297 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10298         fn clone(&self) -> Self {
10299                 if self.result_ok {
10300                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10301                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10302                         } }
10303                 } else {
10304                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10305                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10306                         } }
10307                 }
10308         }
10309 }
10310 #[no_mangle]
10311 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10312 /// but with all dynamically-allocated buffers duplicated in new buffers.
10313 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10314 #[repr(C)]
10315 #[derive(Clone)]
10316 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
10317 pub enum COption_MaxDustHTLCExposureZ {
10318         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
10319         Some(crate::lightning::util::config::MaxDustHTLCExposure),
10320         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
10321         None
10322 }
10323 impl COption_MaxDustHTLCExposureZ {
10324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10325                 if let Self::None = self { false } else { true }
10326         }
10327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10328                 !self.is_some()
10329         }
10330         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
10331                 if let Self::Some(v) = self { v } else { unreachable!() }
10332         }
10333 }
10334 #[no_mangle]
10335 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
10336 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
10337         COption_MaxDustHTLCExposureZ::Some(o)
10338 }
10339 #[no_mangle]
10340 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
10341 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
10342         COption_MaxDustHTLCExposureZ::None
10343 }
10344 #[no_mangle]
10345 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
10346 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
10347 #[no_mangle]
10348 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
10349 /// but with all dynamically-allocated buffers duplicated in new buffers.
10350 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
10351 #[repr(C)]
10352 #[derive(Clone)]
10353 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10354 pub enum COption_APIErrorZ {
10355         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10356         Some(crate::lightning::util::errors::APIError),
10357         /// When we're in this state, this COption_APIErrorZ contains nothing
10358         None
10359 }
10360 impl COption_APIErrorZ {
10361         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10362                 if let Self::None = self { false } else { true }
10363         }
10364         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10365                 !self.is_some()
10366         }
10367         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10368                 if let Self::Some(v) = self { v } else { unreachable!() }
10369         }
10370 }
10371 #[no_mangle]
10372 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10373 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10374         COption_APIErrorZ::Some(o)
10375 }
10376 #[no_mangle]
10377 /// Constructs a new COption_APIErrorZ containing nothing
10378 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10379         COption_APIErrorZ::None
10380 }
10381 #[no_mangle]
10382 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10383 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10384 #[no_mangle]
10385 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10386 /// but with all dynamically-allocated buffers duplicated in new buffers.
10387 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10388 #[repr(C)]
10389 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10390 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10391         /// A pointer to the contents in the success state.
10392         /// Reading from this pointer when `result_ok` is not set is undefined.
10393         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10394         /// A pointer to the contents in the error state.
10395         /// Reading from this pointer when `result_ok` is set is undefined.
10396         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10397 }
10398 #[repr(C)]
10399 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10400 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10402 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10403         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10404         /// `err` or `result` depending on the state of `result_ok`.
10405         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10406         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10407         pub result_ok: bool,
10408 }
10409 #[no_mangle]
10410 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10411 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10412         CResult_COption_APIErrorZDecodeErrorZ {
10413                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10414                         result: Box::into_raw(Box::new(o)),
10415                 },
10416                 result_ok: true,
10417         }
10418 }
10419 #[no_mangle]
10420 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10421 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10422         CResult_COption_APIErrorZDecodeErrorZ {
10423                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10424                         err: Box::into_raw(Box::new(e)),
10425                 },
10426                 result_ok: false,
10427         }
10428 }
10429 /// Checks if the given object is currently in the success state
10430 #[no_mangle]
10431 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10432         o.result_ok
10433 }
10434 #[no_mangle]
10435 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10436 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10437 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10438         fn drop(&mut self) {
10439                 if self.result_ok {
10440                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10441                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10442                         }
10443                 } else {
10444                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10445                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10446                         }
10447                 }
10448         }
10449 }
10450 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10451         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10452                 let contents = if o.result_ok {
10453                         let result = unsafe { o.contents.result };
10454                         unsafe { o.contents.result = core::ptr::null_mut() };
10455                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
10456                 } else {
10457                         let err = unsafe { o.contents.err };
10458                         unsafe { o.contents.err = core::ptr::null_mut(); }
10459                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
10460                 };
10461                 Self {
10462                         contents,
10463                         result_ok: o.result_ok,
10464                 }
10465         }
10466 }
10467 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10468         fn clone(&self) -> Self {
10469                 if self.result_ok {
10470                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10471                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10472                         } }
10473                 } else {
10474                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10475                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10476                         } }
10477                 }
10478         }
10479 }
10480 #[no_mangle]
10481 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10482 /// but with all dynamically-allocated buffers duplicated in new buffers.
10483 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10484 #[repr(C)]
10485 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10486 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10487         /// A pointer to the contents in the success state.
10488         /// Reading from this pointer when `result_ok` is not set is undefined.
10489         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10490         /// A pointer to the contents in the error state.
10491         /// Reading from this pointer when `result_ok` is set is undefined.
10492         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10493 }
10494 #[repr(C)]
10495 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10496 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10498 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10499         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10500         /// `err` or `result` depending on the state of `result_ok`.
10501         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10502         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10503         pub result_ok: bool,
10504 }
10505 #[no_mangle]
10506 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10507 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10508         CResult_ChannelMonitorUpdateDecodeErrorZ {
10509                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10510                         result: Box::into_raw(Box::new(o)),
10511                 },
10512                 result_ok: true,
10513         }
10514 }
10515 #[no_mangle]
10516 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10517 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10518         CResult_ChannelMonitorUpdateDecodeErrorZ {
10519                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10520                         err: Box::into_raw(Box::new(e)),
10521                 },
10522                 result_ok: false,
10523         }
10524 }
10525 /// Checks if the given object is currently in the success state
10526 #[no_mangle]
10527 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10528         o.result_ok
10529 }
10530 #[no_mangle]
10531 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10532 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10533 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10534         fn drop(&mut self) {
10535                 if self.result_ok {
10536                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10537                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10538                         }
10539                 } else {
10540                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10541                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10542                         }
10543                 }
10544         }
10545 }
10546 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10547         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10548                 let contents = if o.result_ok {
10549                         let result = unsafe { o.contents.result };
10550                         unsafe { o.contents.result = core::ptr::null_mut() };
10551                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10552                 } else {
10553                         let err = unsafe { o.contents.err };
10554                         unsafe { o.contents.err = core::ptr::null_mut(); }
10555                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10556                 };
10557                 Self {
10558                         contents,
10559                         result_ok: o.result_ok,
10560                 }
10561         }
10562 }
10563 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10564         fn clone(&self) -> Self {
10565                 if self.result_ok {
10566                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10567                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10568                         } }
10569                 } else {
10570                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10571                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10572                         } }
10573                 }
10574         }
10575 }
10576 #[no_mangle]
10577 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10578 /// but with all dynamically-allocated buffers duplicated in new buffers.
10579 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10580 #[repr(C)]
10581 #[derive(Clone)]
10582 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10583 pub enum COption_MonitorEventZ {
10584         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10585         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10586         /// When we're in this state, this COption_MonitorEventZ contains nothing
10587         None
10588 }
10589 impl COption_MonitorEventZ {
10590         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10591                 if let Self::None = self { false } else { true }
10592         }
10593         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10594                 !self.is_some()
10595         }
10596         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10597                 if let Self::Some(v) = self { v } else { unreachable!() }
10598         }
10599 }
10600 #[no_mangle]
10601 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10602 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10603         COption_MonitorEventZ::Some(o)
10604 }
10605 #[no_mangle]
10606 /// Constructs a new COption_MonitorEventZ containing nothing
10607 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10608         COption_MonitorEventZ::None
10609 }
10610 #[no_mangle]
10611 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10612 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10613 #[no_mangle]
10614 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10615 /// but with all dynamically-allocated buffers duplicated in new buffers.
10616 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10617 #[repr(C)]
10618 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10619 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10620         /// A pointer to the contents in the success state.
10621         /// Reading from this pointer when `result_ok` is not set is undefined.
10622         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10623         /// A pointer to the contents in the error state.
10624         /// Reading from this pointer when `result_ok` is set is undefined.
10625         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10626 }
10627 #[repr(C)]
10628 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10629 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10631 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10632         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10633         /// `err` or `result` depending on the state of `result_ok`.
10634         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10635         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10636         pub result_ok: bool,
10637 }
10638 #[no_mangle]
10639 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10640 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10641         CResult_COption_MonitorEventZDecodeErrorZ {
10642                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10643                         result: Box::into_raw(Box::new(o)),
10644                 },
10645                 result_ok: true,
10646         }
10647 }
10648 #[no_mangle]
10649 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10650 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10651         CResult_COption_MonitorEventZDecodeErrorZ {
10652                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10653                         err: Box::into_raw(Box::new(e)),
10654                 },
10655                 result_ok: false,
10656         }
10657 }
10658 /// Checks if the given object is currently in the success state
10659 #[no_mangle]
10660 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10661         o.result_ok
10662 }
10663 #[no_mangle]
10664 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10665 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10666 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10667         fn drop(&mut self) {
10668                 if self.result_ok {
10669                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10670                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10671                         }
10672                 } else {
10673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10675                         }
10676                 }
10677         }
10678 }
10679 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10680         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10681                 let contents = if o.result_ok {
10682                         let result = unsafe { o.contents.result };
10683                         unsafe { o.contents.result = core::ptr::null_mut() };
10684                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10685                 } else {
10686                         let err = unsafe { o.contents.err };
10687                         unsafe { o.contents.err = core::ptr::null_mut(); }
10688                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10689                 };
10690                 Self {
10691                         contents,
10692                         result_ok: o.result_ok,
10693                 }
10694         }
10695 }
10696 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10697         fn clone(&self) -> Self {
10698                 if self.result_ok {
10699                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10700                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10701                         } }
10702                 } else {
10703                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10704                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10705                         } }
10706                 }
10707         }
10708 }
10709 #[no_mangle]
10710 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10711 /// but with all dynamically-allocated buffers duplicated in new buffers.
10712 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10713 #[repr(C)]
10714 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10715 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10716         /// A pointer to the contents in the success state.
10717         /// Reading from this pointer when `result_ok` is not set is undefined.
10718         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10719         /// A pointer to the contents in the error state.
10720         /// Reading from this pointer when `result_ok` is set is undefined.
10721         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10722 }
10723 #[repr(C)]
10724 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10725 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10727 pub struct CResult_HTLCUpdateDecodeErrorZ {
10728         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10729         /// `err` or `result` depending on the state of `result_ok`.
10730         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10731         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10732         pub result_ok: bool,
10733 }
10734 #[no_mangle]
10735 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10736 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10737         CResult_HTLCUpdateDecodeErrorZ {
10738                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10739                         result: Box::into_raw(Box::new(o)),
10740                 },
10741                 result_ok: true,
10742         }
10743 }
10744 #[no_mangle]
10745 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10746 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10747         CResult_HTLCUpdateDecodeErrorZ {
10748                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10749                         err: Box::into_raw(Box::new(e)),
10750                 },
10751                 result_ok: false,
10752         }
10753 }
10754 /// Checks if the given object is currently in the success state
10755 #[no_mangle]
10756 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10757         o.result_ok
10758 }
10759 #[no_mangle]
10760 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10761 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10762 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10763         fn drop(&mut self) {
10764                 if self.result_ok {
10765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10767                         }
10768                 } else {
10769                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10770                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10771                         }
10772                 }
10773         }
10774 }
10775 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10776         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10777                 let contents = if o.result_ok {
10778                         let result = unsafe { o.contents.result };
10779                         unsafe { o.contents.result = core::ptr::null_mut() };
10780                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10781                 } else {
10782                         let err = unsafe { o.contents.err };
10783                         unsafe { o.contents.err = core::ptr::null_mut(); }
10784                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10785                 };
10786                 Self {
10787                         contents,
10788                         result_ok: o.result_ok,
10789                 }
10790         }
10791 }
10792 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10793         fn clone(&self) -> Self {
10794                 if self.result_ok {
10795                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10796                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10797                         } }
10798                 } else {
10799                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10800                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10801                         } }
10802                 }
10803         }
10804 }
10805 #[no_mangle]
10806 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10807 /// but with all dynamically-allocated buffers duplicated in new buffers.
10808 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10809 #[repr(C)]
10810 /// A tuple of 2 elements. See the individual fields for the types contained.
10811 pub struct C2Tuple_OutPointCVec_u8ZZ {
10812         /// The element at position 0
10813         pub a: crate::lightning::chain::transaction::OutPoint,
10814         /// The element at position 1
10815         pub b: crate::c_types::derived::CVec_u8Z,
10816 }
10817 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
10818         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10819                 Self {
10820                         a: tup.0,
10821                         b: tup.1,
10822                 }
10823         }
10824 }
10825 impl C2Tuple_OutPointCVec_u8ZZ {
10826         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10827                 (self.a, self.b)
10828         }
10829 }
10830 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
10831         fn clone(&self) -> Self {
10832                 Self {
10833                         a: Clone::clone(&self.a),
10834                         b: Clone::clone(&self.b),
10835                 }
10836         }
10837 }
10838 #[no_mangle]
10839 /// Creates a new tuple which has the same data as `orig`
10840 /// but with all dynamically-allocated buffers duplicated in new buffers.
10841 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
10842 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
10843 #[no_mangle]
10844 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
10845         C2Tuple_OutPointCVec_u8ZZ { a, b, }
10846 }
10847
10848 #[no_mangle]
10849 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
10850 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
10851 #[repr(C)]
10852 /// A tuple of 2 elements. See the individual fields for the types contained.
10853 pub struct C2Tuple_u32CVec_u8ZZ {
10854         /// The element at position 0
10855         pub a: u32,
10856         /// The element at position 1
10857         pub b: crate::c_types::derived::CVec_u8Z,
10858 }
10859 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
10860         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10861                 Self {
10862                         a: tup.0,
10863                         b: tup.1,
10864                 }
10865         }
10866 }
10867 impl C2Tuple_u32CVec_u8ZZ {
10868         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10869                 (self.a, self.b)
10870         }
10871 }
10872 impl Clone for C2Tuple_u32CVec_u8ZZ {
10873         fn clone(&self) -> Self {
10874                 Self {
10875                         a: Clone::clone(&self.a),
10876                         b: Clone::clone(&self.b),
10877                 }
10878         }
10879 }
10880 #[no_mangle]
10881 /// Creates a new tuple which has the same data as `orig`
10882 /// but with all dynamically-allocated buffers duplicated in new buffers.
10883 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
10884 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
10885 #[no_mangle]
10886 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
10887         C2Tuple_u32CVec_u8ZZ { a, b, }
10888 }
10889
10890 #[no_mangle]
10891 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
10892 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
10893 #[repr(C)]
10894 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
10895 /// This corresponds to std::vector in C++
10896 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
10897         /// The elements in the array.
10898         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10899         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
10900         /// The number of elements pointed to by `data`.
10901         pub datalen: usize
10902 }
10903 impl CVec_C2Tuple_u32CVec_u8ZZZ {
10904         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
10905                 if self.datalen == 0 { return Vec::new(); }
10906                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10907                 self.data = core::ptr::null_mut();
10908                 self.datalen = 0;
10909                 ret
10910         }
10911         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
10912                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10913         }
10914 }
10915 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
10916         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
10917                 let datalen = v.len();
10918                 let data = Box::into_raw(v.into_boxed_slice());
10919                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10920         }
10921 }
10922 #[no_mangle]
10923 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10924 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
10925 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
10926         fn drop(&mut self) {
10927                 if self.datalen == 0 { return; }
10928                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10929         }
10930 }
10931 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
10932         fn clone(&self) -> Self {
10933                 let mut res = Vec::new();
10934                 if self.datalen == 0 { return Self::from(res); }
10935                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10936                 Self::from(res)
10937         }
10938 }
10939 #[repr(C)]
10940 /// A tuple of 2 elements. See the individual fields for the types contained.
10941 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10942         /// The element at position 0
10943         pub a: crate::c_types::ThirtyTwoBytes,
10944         /// The element at position 1
10945         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
10946 }
10947 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10948         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
10949                 Self {
10950                         a: tup.0,
10951                         b: tup.1,
10952                 }
10953         }
10954 }
10955 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10956         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
10957                 (self.a, self.b)
10958         }
10959 }
10960 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10961         fn clone(&self) -> Self {
10962                 Self {
10963                         a: Clone::clone(&self.a),
10964                         b: Clone::clone(&self.b),
10965                 }
10966         }
10967 }
10968 #[no_mangle]
10969 /// Creates a new tuple which has the same data as `orig`
10970 /// but with all dynamically-allocated buffers duplicated in new buffers.
10971 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
10972 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
10973 #[no_mangle]
10974 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 {
10975         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
10976 }
10977
10978 #[no_mangle]
10979 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
10980 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
10981 #[repr(C)]
10982 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
10983 /// This corresponds to std::vector in C++
10984 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10985         /// The elements in the array.
10986         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10987         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
10988         /// The number of elements pointed to by `data`.
10989         pub datalen: usize
10990 }
10991 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10992         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
10993                 if self.datalen == 0 { return Vec::new(); }
10994                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10995                 self.data = core::ptr::null_mut();
10996                 self.datalen = 0;
10997                 ret
10998         }
10999         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
11000                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11001         }
11002 }
11003 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11004         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
11005                 let datalen = v.len();
11006                 let data = Box::into_raw(v.into_boxed_slice());
11007                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11008         }
11009 }
11010 #[no_mangle]
11011 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11012 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
11013 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11014         fn drop(&mut self) {
11015                 if self.datalen == 0 { return; }
11016                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11017         }
11018 }
11019 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11020         fn clone(&self) -> Self {
11021                 let mut res = Vec::new();
11022                 if self.datalen == 0 { return Self::from(res); }
11023                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11024                 Self::from(res)
11025         }
11026 }
11027 #[repr(C)]
11028 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
11029 /// This corresponds to std::vector in C++
11030 pub struct CVec_CommitmentTransactionZ {
11031         /// The elements in the array.
11032         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11033         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
11034         /// The number of elements pointed to by `data`.
11035         pub datalen: usize
11036 }
11037 impl CVec_CommitmentTransactionZ {
11038         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
11039                 if self.datalen == 0 { return Vec::new(); }
11040                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11041                 self.data = core::ptr::null_mut();
11042                 self.datalen = 0;
11043                 ret
11044         }
11045         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
11046                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11047         }
11048 }
11049 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
11050         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
11051                 let datalen = v.len();
11052                 let data = Box::into_raw(v.into_boxed_slice());
11053                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11054         }
11055 }
11056 #[no_mangle]
11057 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11058 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
11059 impl Drop for CVec_CommitmentTransactionZ {
11060         fn drop(&mut self) {
11061                 if self.datalen == 0 { return; }
11062                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11063         }
11064 }
11065 impl Clone for CVec_CommitmentTransactionZ {
11066         fn clone(&self) -> Self {
11067                 let mut res = Vec::new();
11068                 if self.datalen == 0 { return Self::from(res); }
11069                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11070                 Self::from(res)
11071         }
11072 }
11073 #[repr(C)]
11074 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11075 /// This corresponds to std::vector in C++
11076 pub struct CVec_TransactionZ {
11077         /// The elements in the array.
11078         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11079         pub data: *mut crate::c_types::Transaction,
11080         /// The number of elements pointed to by `data`.
11081         pub datalen: usize
11082 }
11083 impl CVec_TransactionZ {
11084         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11085                 if self.datalen == 0 { return Vec::new(); }
11086                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11087                 self.data = core::ptr::null_mut();
11088                 self.datalen = 0;
11089                 ret
11090         }
11091         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11092                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11093         }
11094 }
11095 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11096         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11097                 let datalen = v.len();
11098                 let data = Box::into_raw(v.into_boxed_slice());
11099                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11100         }
11101 }
11102 #[no_mangle]
11103 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11104 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11105 impl Drop for CVec_TransactionZ {
11106         fn drop(&mut self) {
11107                 if self.datalen == 0 { return; }
11108                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11109         }
11110 }
11111 impl Clone for CVec_TransactionZ {
11112         fn clone(&self) -> Self {
11113                 let mut res = Vec::new();
11114                 if self.datalen == 0 { return Self::from(res); }
11115                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11116                 Self::from(res)
11117         }
11118 }
11119 #[repr(C)]
11120 /// A tuple of 2 elements. See the individual fields for the types contained.
11121 pub struct C2Tuple_u32TxOutZ {
11122         /// The element at position 0
11123         pub a: u32,
11124         /// The element at position 1
11125         pub b: crate::c_types::TxOut,
11126 }
11127 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11128         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11129                 Self {
11130                         a: tup.0,
11131                         b: tup.1,
11132                 }
11133         }
11134 }
11135 impl C2Tuple_u32TxOutZ {
11136         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11137                 (self.a, self.b)
11138         }
11139 }
11140 impl Clone for C2Tuple_u32TxOutZ {
11141         fn clone(&self) -> Self {
11142                 Self {
11143                         a: Clone::clone(&self.a),
11144                         b: Clone::clone(&self.b),
11145                 }
11146         }
11147 }
11148 #[no_mangle]
11149 /// Creates a new tuple which has the same data as `orig`
11150 /// but with all dynamically-allocated buffers duplicated in new buffers.
11151 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11152 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11153 #[no_mangle]
11154 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11155         C2Tuple_u32TxOutZ { a, b, }
11156 }
11157
11158 #[no_mangle]
11159 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11160 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11161 #[repr(C)]
11162 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11163 /// This corresponds to std::vector in C++
11164 pub struct CVec_C2Tuple_u32TxOutZZ {
11165         /// The elements in the array.
11166         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11167         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11168         /// The number of elements pointed to by `data`.
11169         pub datalen: usize
11170 }
11171 impl CVec_C2Tuple_u32TxOutZZ {
11172         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11173                 if self.datalen == 0 { return Vec::new(); }
11174                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11175                 self.data = core::ptr::null_mut();
11176                 self.datalen = 0;
11177                 ret
11178         }
11179         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11180                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11181         }
11182 }
11183 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11184         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11185                 let datalen = v.len();
11186                 let data = Box::into_raw(v.into_boxed_slice());
11187                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11188         }
11189 }
11190 #[no_mangle]
11191 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11192 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11193 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11194         fn drop(&mut self) {
11195                 if self.datalen == 0 { return; }
11196                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11197         }
11198 }
11199 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11200         fn clone(&self) -> Self {
11201                 let mut res = Vec::new();
11202                 if self.datalen == 0 { return Self::from(res); }
11203                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11204                 Self::from(res)
11205         }
11206 }
11207 #[repr(C)]
11208 /// A tuple of 2 elements. See the individual fields for the types contained.
11209 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11210         /// The element at position 0
11211         pub a: crate::c_types::ThirtyTwoBytes,
11212         /// The element at position 1
11213         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11214 }
11215 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11216         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11217                 Self {
11218                         a: tup.0,
11219                         b: tup.1,
11220                 }
11221         }
11222 }
11223 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11224         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11225                 (self.a, self.b)
11226         }
11227 }
11228 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11229         fn clone(&self) -> Self {
11230                 Self {
11231                         a: Clone::clone(&self.a),
11232                         b: Clone::clone(&self.b),
11233                 }
11234         }
11235 }
11236 #[no_mangle]
11237 /// Creates a new tuple which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11240 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11241 #[no_mangle]
11242 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 {
11243         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
11244 }
11245
11246 #[no_mangle]
11247 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
11248 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
11249 #[repr(C)]
11250 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11251 /// This corresponds to std::vector in C++
11252 pub struct CVec_TransactionOutputsZ {
11253         /// The elements in the array.
11254         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11255         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
11256         /// The number of elements pointed to by `data`.
11257         pub datalen: usize
11258 }
11259 impl CVec_TransactionOutputsZ {
11260         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11261                 if self.datalen == 0 { return Vec::new(); }
11262                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11263                 self.data = core::ptr::null_mut();
11264                 self.datalen = 0;
11265                 ret
11266         }
11267         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11268                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11269         }
11270 }
11271 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11272         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11273                 let datalen = v.len();
11274                 let data = Box::into_raw(v.into_boxed_slice());
11275                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11276         }
11277 }
11278 #[no_mangle]
11279 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11280 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11281 impl Drop for CVec_TransactionOutputsZ {
11282         fn drop(&mut self) {
11283                 if self.datalen == 0 { return; }
11284                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11285         }
11286 }
11287 impl Clone for CVec_TransactionOutputsZ {
11288         fn clone(&self) -> Self {
11289                 let mut res = Vec::new();
11290                 if self.datalen == 0 { return Self::from(res); }
11291                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11292                 Self::from(res)
11293         }
11294 }
11295 #[repr(C)]
11296 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11297 /// This corresponds to std::vector in C++
11298 pub struct CVec_BalanceZ {
11299         /// The elements in the array.
11300         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11301         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11302         /// The number of elements pointed to by `data`.
11303         pub datalen: usize
11304 }
11305 impl CVec_BalanceZ {
11306         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11307                 if self.datalen == 0 { return Vec::new(); }
11308                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11309                 self.data = core::ptr::null_mut();
11310                 self.datalen = 0;
11311                 ret
11312         }
11313         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11314                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11315         }
11316 }
11317 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11318         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11319                 let datalen = v.len();
11320                 let data = Box::into_raw(v.into_boxed_slice());
11321                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11322         }
11323 }
11324 #[no_mangle]
11325 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11326 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11327 impl Drop for CVec_BalanceZ {
11328         fn drop(&mut self) {
11329                 if self.datalen == 0 { return; }
11330                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11331         }
11332 }
11333 impl Clone for CVec_BalanceZ {
11334         fn clone(&self) -> Self {
11335                 let mut res = Vec::new();
11336                 if self.datalen == 0 { return Self::from(res); }
11337                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11338                 Self::from(res)
11339         }
11340 }
11341 #[repr(C)]
11342 /// A tuple of 2 elements. See the individual fields for the types contained.
11343 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11344         /// The element at position 0
11345         pub a: crate::c_types::ThirtyTwoBytes,
11346         /// The element at position 1
11347         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
11348 }
11349 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11350         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
11351                 Self {
11352                         a: tup.0,
11353                         b: tup.1,
11354                 }
11355         }
11356 }
11357 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11358         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
11359                 (self.a, self.b)
11360         }
11361 }
11362 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11363         fn clone(&self) -> Self {
11364                 Self {
11365                         a: Clone::clone(&self.a),
11366                         b: Clone::clone(&self.b),
11367                 }
11368         }
11369 }
11370 #[no_mangle]
11371 /// Creates a new tuple which has the same data as `orig`
11372 /// but with all dynamically-allocated buffers duplicated in new buffers.
11373 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
11374 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
11375 #[no_mangle]
11376 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11377         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
11378 }
11379
11380 #[no_mangle]
11381 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
11382 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
11383 #[repr(C)]
11384 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
11385 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
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::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11398         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
11399         /// `err` or `result` depending on the state of `result_ok`.
11400         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
11401         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
11402         pub result_ok: bool,
11403 }
11404 #[no_mangle]
11405 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11407         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11408                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11409                         result: Box::into_raw(Box::new(o)),
11410                 },
11411                 result_ok: true,
11412         }
11413 }
11414 #[no_mangle]
11415 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11417         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11418                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
11427         o.result_ok
11428 }
11429 #[no_mangle]
11430 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
11431 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
11432 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
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::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11446         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
11451                 } else {
11452                         let err = unsafe { o.contents.err };
11453                         unsafe { o.contents.err = core::ptr::null_mut(); }
11454                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
11455                 };
11456                 Self {
11457                         contents,
11458                         result_ok: o.result_ok,
11459                 }
11460         }
11461 }
11462 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11463         fn clone(&self) -> Self {
11464                 if self.result_ok {
11465                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11466                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
11467                         } }
11468                 } else {
11469                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
11479 #[repr(C)]
11480 /// A tuple of 2 elements. See the individual fields for the types contained.
11481 pub struct C2Tuple_PublicKeyTypeZ {
11482         /// The element at position 0
11483         pub a: crate::c_types::PublicKey,
11484         /// The element at position 1
11485         pub b: crate::lightning::ln::wire::Type,
11486 }
11487 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11488         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11489                 Self {
11490                         a: tup.0,
11491                         b: tup.1,
11492                 }
11493         }
11494 }
11495 impl C2Tuple_PublicKeyTypeZ {
11496         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11497                 (self.a, self.b)
11498         }
11499 }
11500 impl Clone for C2Tuple_PublicKeyTypeZ {
11501         fn clone(&self) -> Self {
11502                 Self {
11503                         a: Clone::clone(&self.a),
11504                         b: Clone::clone(&self.b),
11505                 }
11506         }
11507 }
11508 #[no_mangle]
11509 /// Creates a new tuple which has the same data as `orig`
11510 /// but with all dynamically-allocated buffers duplicated in new buffers.
11511 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
11512 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11513 #[no_mangle]
11514 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11515         C2Tuple_PublicKeyTypeZ { a, b, }
11516 }
11517
11518 #[no_mangle]
11519 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11520 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11521 #[repr(C)]
11522 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11523 /// This corresponds to std::vector in C++
11524 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11525         /// The elements in the array.
11526         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11527         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11528         /// The number of elements pointed to by `data`.
11529         pub datalen: usize
11530 }
11531 impl CVec_C2Tuple_PublicKeyTypeZZ {
11532         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11533                 if self.datalen == 0 { return Vec::new(); }
11534                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11535                 self.data = core::ptr::null_mut();
11536                 self.datalen = 0;
11537                 ret
11538         }
11539         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11540                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11541         }
11542 }
11543 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11544         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11545                 let datalen = v.len();
11546                 let data = Box::into_raw(v.into_boxed_slice());
11547                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11548         }
11549 }
11550 #[no_mangle]
11551 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11552 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11553 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11554         fn drop(&mut self) {
11555                 if self.datalen == 0 { return; }
11556                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11557         }
11558 }
11559 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
11560         fn clone(&self) -> Self {
11561                 let mut res = Vec::new();
11562                 if self.datalen == 0 { return Self::from(res); }
11563                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11564                 Self::from(res)
11565         }
11566 }
11567 #[repr(C)]
11568 #[derive(Clone)]
11569 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
11570 pub enum COption_OnionMessageContentsZ {
11571         /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
11572         Some(crate::lightning::onion_message::packet::OnionMessageContents),
11573         /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
11574         None
11575 }
11576 impl COption_OnionMessageContentsZ {
11577         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11578                 if let Self::None = self { false } else { true }
11579         }
11580         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11581                 !self.is_some()
11582         }
11583         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
11584                 if let Self::Some(v) = self { v } else { unreachable!() }
11585         }
11586 }
11587 #[no_mangle]
11588 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
11589 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
11590         COption_OnionMessageContentsZ::Some(o)
11591 }
11592 #[no_mangle]
11593 /// Constructs a new COption_OnionMessageContentsZ containing nothing
11594 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
11595         COption_OnionMessageContentsZ::None
11596 }
11597 #[no_mangle]
11598 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
11599 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
11600 #[no_mangle]
11601 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
11604 #[repr(C)]
11605 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
11606 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11607         /// A pointer to the contents in the success state.
11608         /// Reading from this pointer when `result_ok` is not set is undefined.
11609         pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
11610         /// A pointer to the contents in the error state.
11611         /// Reading from this pointer when `result_ok` is set is undefined.
11612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11613 }
11614 #[repr(C)]
11615 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
11619         /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
11620         /// `err` or `result` depending on the state of `result_ok`.
11621         pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
11622         /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
11623         pub result_ok: bool,
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
11628         CResult_COption_OnionMessageContentsZDecodeErrorZ {
11629                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11630                         result: Box::into_raw(Box::new(o)),
11631                 },
11632                 result_ok: true,
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
11638         CResult_COption_OnionMessageContentsZDecodeErrorZ {
11639                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11640                         err: Box::into_raw(Box::new(e)),
11641                 },
11642                 result_ok: false,
11643         }
11644 }
11645 /// Checks if the given object is currently in the success state
11646 #[no_mangle]
11647 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
11648         o.result_ok
11649 }
11650 #[no_mangle]
11651 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
11652 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
11653 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11654         fn drop(&mut self) {
11655                 if self.result_ok {
11656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11658                         }
11659                 } else {
11660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11662                         }
11663                 }
11664         }
11665 }
11666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11667         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668                 let contents = if o.result_ok {
11669                         let result = unsafe { o.contents.result };
11670                         unsafe { o.contents.result = core::ptr::null_mut() };
11671                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
11672                 } else {
11673                         let err = unsafe { o.contents.err };
11674                         unsafe { o.contents.err = core::ptr::null_mut(); }
11675                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
11676                 };
11677                 Self {
11678                         contents,
11679                         result_ok: o.result_ok,
11680                 }
11681         }
11682 }
11683 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11684         fn clone(&self) -> Self {
11685                 if self.result_ok {
11686                         Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11687                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
11688                         } }
11689                 } else {
11690                         Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11692                         } }
11693                 }
11694         }
11695 }
11696 #[no_mangle]
11697 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
11698 /// but with all dynamically-allocated buffers duplicated in new buffers.
11699 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
11700 #[repr(C)]
11701 /// A tuple of 3 elements. See the individual fields for the types contained.
11702 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11703         /// The element at position 0
11704         pub a: crate::lightning::onion_message::packet::OnionMessageContents,
11705         /// The element at position 1
11706         pub b: crate::lightning::onion_message::messenger::Destination,
11707         /// The element at position 2
11708         pub c: crate::lightning::blinded_path::BlindedPath,
11709 }
11710 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11711         fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
11712                 Self {
11713                         a: tup.0,
11714                         b: tup.1,
11715                         c: tup.2,
11716                 }
11717         }
11718 }
11719 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11720         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
11721                 (self.a, self.b, self.c)
11722         }
11723 }
11724 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11725         fn clone(&self) -> Self {
11726                 Self {
11727                         a: Clone::clone(&self.a),
11728                         b: Clone::clone(&self.b),
11729                         c: Clone::clone(&self.c),
11730                 }
11731         }
11732 }
11733 #[no_mangle]
11734 /// Creates a new tuple which has the same data as `orig`
11735 /// but with all dynamically-allocated buffers duplicated in new buffers.
11736 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
11737 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
11738 #[no_mangle]
11739 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11740         C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
11741 }
11742
11743 #[no_mangle]
11744 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
11745 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
11746 #[repr(C)]
11747 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
11748 /// This corresponds to std::vector in C++
11749 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11750         /// The elements in the array.
11751         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11752         pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
11753         /// The number of elements pointed to by `data`.
11754         pub datalen: usize
11755 }
11756 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11757         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
11758                 if self.datalen == 0 { return Vec::new(); }
11759                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11760                 self.data = core::ptr::null_mut();
11761                 self.datalen = 0;
11762                 ret
11763         }
11764         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
11765                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11766         }
11767 }
11768 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11769         fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
11770                 let datalen = v.len();
11771                 let data = Box::into_raw(v.into_boxed_slice());
11772                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11773         }
11774 }
11775 #[no_mangle]
11776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11777 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
11778 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11779         fn drop(&mut self) {
11780                 if self.datalen == 0 { return; }
11781                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11782         }
11783 }
11784 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11785         fn clone(&self) -> Self {
11786                 let mut res = Vec::new();
11787                 if self.datalen == 0 { return Self::from(res); }
11788                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11789                 Self::from(res)
11790         }
11791 }
11792 #[repr(C)]
11793 #[derive(Clone)]
11794 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
11795 pub enum COption_TypeZ {
11796         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
11797         Some(crate::lightning::ln::wire::Type),
11798         /// When we're in this state, this COption_TypeZ contains nothing
11799         None
11800 }
11801 impl COption_TypeZ {
11802         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11803                 if let Self::None = self { false } else { true }
11804         }
11805         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11806                 !self.is_some()
11807         }
11808         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
11809                 if let Self::Some(v) = self { v } else { unreachable!() }
11810         }
11811 }
11812 #[no_mangle]
11813 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11814 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
11815         COption_TypeZ::Some(o)
11816 }
11817 #[no_mangle]
11818 /// Constructs a new COption_TypeZ containing nothing
11819 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
11820         COption_TypeZ::None
11821 }
11822 #[no_mangle]
11823 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11824 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
11825 #[no_mangle]
11826 /// Creates a new COption_TypeZ which has the same data as `orig`
11827 /// but with all dynamically-allocated buffers duplicated in new buffers.
11828 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
11829 #[repr(C)]
11830 /// The contents of CResult_COption_TypeZDecodeErrorZ
11831 pub union CResult_COption_TypeZDecodeErrorZPtr {
11832         /// A pointer to the contents in the success state.
11833         /// Reading from this pointer when `result_ok` is not set is undefined.
11834         pub result: *mut crate::c_types::derived::COption_TypeZ,
11835         /// A pointer to the contents in the error state.
11836         /// Reading from this pointer when `result_ok` is set is undefined.
11837         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11838 }
11839 #[repr(C)]
11840 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
11841 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11843 pub struct CResult_COption_TypeZDecodeErrorZ {
11844         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
11845         /// `err` or `result` depending on the state of `result_ok`.
11846         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
11847         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
11848         pub result_ok: bool,
11849 }
11850 #[no_mangle]
11851 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11852 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
11853         CResult_COption_TypeZDecodeErrorZ {
11854                 contents: CResult_COption_TypeZDecodeErrorZPtr {
11855                         result: Box::into_raw(Box::new(o)),
11856                 },
11857                 result_ok: true,
11858         }
11859 }
11860 #[no_mangle]
11861 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11862 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
11863         CResult_COption_TypeZDecodeErrorZ {
11864                 contents: CResult_COption_TypeZDecodeErrorZPtr {
11865                         err: Box::into_raw(Box::new(e)),
11866                 },
11867                 result_ok: false,
11868         }
11869 }
11870 /// Checks if the given object is currently in the success state
11871 #[no_mangle]
11872 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11873         o.result_ok
11874 }
11875 #[no_mangle]
11876 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11877 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11878 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11879         fn drop(&mut self) {
11880                 if self.result_ok {
11881                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11882                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11883                         }
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::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11892         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11893                 let contents = if o.result_ok {
11894                         let result = unsafe { o.contents.result };
11895                         unsafe { o.contents.result = core::ptr::null_mut() };
11896                         CResult_COption_TypeZDecodeErrorZPtr { result }
11897                 } else {
11898                         let err = unsafe { o.contents.err };
11899                         unsafe { o.contents.err = core::ptr::null_mut(); }
11900                         CResult_COption_TypeZDecodeErrorZPtr { err }
11901                 };
11902                 Self {
11903                         contents,
11904                         result_ok: o.result_ok,
11905                 }
11906         }
11907 }
11908 impl Clone for CResult_COption_TypeZDecodeErrorZ {
11909         fn clone(&self) -> Self {
11910                 if self.result_ok {
11911                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
11912                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
11913                         } }
11914                 } else {
11915                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
11916                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11917                         } }
11918                 }
11919         }
11920 }
11921 #[no_mangle]
11922 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
11923 /// but with all dynamically-allocated buffers duplicated in new buffers.
11924 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
11925 #[repr(C)]
11926 #[derive(Clone)]
11927 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
11928 pub enum COption_SocketAddressZ {
11929         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
11930         Some(crate::lightning::ln::msgs::SocketAddress),
11931         /// When we're in this state, this COption_SocketAddressZ contains nothing
11932         None
11933 }
11934 impl COption_SocketAddressZ {
11935         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11936                 if let Self::None = self { false } else { true }
11937         }
11938         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11939                 !self.is_some()
11940         }
11941         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
11942                 if let Self::Some(v) = self { v } else { unreachable!() }
11943         }
11944 }
11945 #[no_mangle]
11946 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
11947 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
11948         COption_SocketAddressZ::Some(o)
11949 }
11950 #[no_mangle]
11951 /// Constructs a new COption_SocketAddressZ containing nothing
11952 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
11953         COption_SocketAddressZ::None
11954 }
11955 #[no_mangle]
11956 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
11957 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
11958 #[no_mangle]
11959 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
11960 /// but with all dynamically-allocated buffers duplicated in new buffers.
11961 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
11962 #[repr(C)]
11963 /// A tuple of 2 elements. See the individual fields for the types contained.
11964 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
11965         /// The element at position 0
11966         pub a: crate::c_types::PublicKey,
11967         /// The element at position 1
11968         pub b: crate::c_types::derived::COption_SocketAddressZ,
11969 }
11970 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11971         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
11972                 Self {
11973                         a: tup.0,
11974                         b: tup.1,
11975                 }
11976         }
11977 }
11978 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
11979         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
11980                 (self.a, self.b)
11981         }
11982 }
11983 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11984         fn clone(&self) -> Self {
11985                 Self {
11986                         a: Clone::clone(&self.a),
11987                         b: Clone::clone(&self.b),
11988                 }
11989         }
11990 }
11991 #[no_mangle]
11992 /// Creates a new tuple which has the same data as `orig`
11993 /// but with all dynamically-allocated buffers duplicated in new buffers.
11994 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
11995 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
11996 #[no_mangle]
11997 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
11998         C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
11999 }
12000
12001 #[no_mangle]
12002 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
12003 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
12004 #[repr(C)]
12005 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
12006 /// This corresponds to std::vector in C++
12007 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12008         /// The elements in the array.
12009         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12010         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
12011         /// The number of elements pointed to by `data`.
12012         pub datalen: usize
12013 }
12014 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12015         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
12016                 if self.datalen == 0 { return Vec::new(); }
12017                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12018                 self.data = core::ptr::null_mut();
12019                 self.datalen = 0;
12020                 ret
12021         }
12022         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
12023                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12024         }
12025 }
12026 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12027         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
12028                 let datalen = v.len();
12029                 let data = Box::into_raw(v.into_boxed_slice());
12030                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12031         }
12032 }
12033 #[no_mangle]
12034 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12035 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
12036 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12037         fn drop(&mut self) {
12038                 if self.datalen == 0 { return; }
12039                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12040         }
12041 }
12042 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12043         fn clone(&self) -> Self {
12044                 let mut res = Vec::new();
12045                 if self.datalen == 0 { return Self::from(res); }
12046                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12047                 Self::from(res)
12048         }
12049 }
12050 #[repr(C)]
12051 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12052 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12053         /// A pointer to the contents in the success state.
12054         /// Reading from this pointer when `result_ok` is not set is undefined.
12055         pub result: *mut crate::c_types::derived::CVec_u8Z,
12056         /// A pointer to the contents in the error state.
12057         /// Reading from this pointer when `result_ok` is set is undefined.
12058         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12059 }
12060 #[repr(C)]
12061 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12062 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12064 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12065         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12066         /// `err` or `result` depending on the state of `result_ok`.
12067         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12068         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12069         pub result_ok: bool,
12070 }
12071 #[no_mangle]
12072 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12073 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12074         CResult_CVec_u8ZPeerHandleErrorZ {
12075                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12076                         result: Box::into_raw(Box::new(o)),
12077                 },
12078                 result_ok: true,
12079         }
12080 }
12081 #[no_mangle]
12082 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12083 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12084         CResult_CVec_u8ZPeerHandleErrorZ {
12085                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12086                         err: Box::into_raw(Box::new(e)),
12087                 },
12088                 result_ok: false,
12089         }
12090 }
12091 /// Checks if the given object is currently in the success state
12092 #[no_mangle]
12093 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12094         o.result_ok
12095 }
12096 #[no_mangle]
12097 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12098 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12099 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12100         fn drop(&mut self) {
12101                 if self.result_ok {
12102                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12103                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12104                         }
12105                 } else {
12106                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12107                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12108                         }
12109                 }
12110         }
12111 }
12112 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12113         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12114                 let contents = if o.result_ok {
12115                         let result = unsafe { o.contents.result };
12116                         unsafe { o.contents.result = core::ptr::null_mut() };
12117                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12118                 } else {
12119                         let err = unsafe { o.contents.err };
12120                         unsafe { o.contents.err = core::ptr::null_mut(); }
12121                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12122                 };
12123                 Self {
12124                         contents,
12125                         result_ok: o.result_ok,
12126                 }
12127         }
12128 }
12129 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12130         fn clone(&self) -> Self {
12131                 if self.result_ok {
12132                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12133                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12134                         } }
12135                 } else {
12136                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12137                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12138                         } }
12139                 }
12140         }
12141 }
12142 #[no_mangle]
12143 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12144 /// but with all dynamically-allocated buffers duplicated in new buffers.
12145 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12146 #[repr(C)]
12147 /// The contents of CResult_NonePeerHandleErrorZ
12148 pub union CResult_NonePeerHandleErrorZPtr {
12149         /// Note that this value is always NULL, as there are no contents in the OK variant
12150         pub result: *mut core::ffi::c_void,
12151         /// A pointer to the contents in the error state.
12152         /// Reading from this pointer when `result_ok` is set is undefined.
12153         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12154 }
12155 #[repr(C)]
12156 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12157 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12159 pub struct CResult_NonePeerHandleErrorZ {
12160         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12161         /// `err` or `result` depending on the state of `result_ok`.
12162         pub contents: CResult_NonePeerHandleErrorZPtr,
12163         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12164         pub result_ok: bool,
12165 }
12166 #[no_mangle]
12167 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12168 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12169         CResult_NonePeerHandleErrorZ {
12170                 contents: CResult_NonePeerHandleErrorZPtr {
12171                         result: core::ptr::null_mut(),
12172                 },
12173                 result_ok: true,
12174         }
12175 }
12176 #[no_mangle]
12177 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12178 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12179         CResult_NonePeerHandleErrorZ {
12180                 contents: CResult_NonePeerHandleErrorZPtr {
12181                         err: Box::into_raw(Box::new(e)),
12182                 },
12183                 result_ok: false,
12184         }
12185 }
12186 /// Checks if the given object is currently in the success state
12187 #[no_mangle]
12188 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12189         o.result_ok
12190 }
12191 #[no_mangle]
12192 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12193 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12194 impl Drop for CResult_NonePeerHandleErrorZ {
12195         fn drop(&mut self) {
12196                 if self.result_ok {
12197                 } else {
12198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12200                         }
12201                 }
12202         }
12203 }
12204 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12205         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12206                 let contents = if o.result_ok {
12207                         let _ = unsafe { Box::from_raw(o.contents.result) };
12208                         o.contents.result = core::ptr::null_mut();
12209                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12210                 } else {
12211                         let err = unsafe { o.contents.err };
12212                         unsafe { o.contents.err = core::ptr::null_mut(); }
12213                         CResult_NonePeerHandleErrorZPtr { err }
12214                 };
12215                 Self {
12216                         contents,
12217                         result_ok: o.result_ok,
12218                 }
12219         }
12220 }
12221 impl Clone for CResult_NonePeerHandleErrorZ {
12222         fn clone(&self) -> Self {
12223                 if self.result_ok {
12224                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12225                                 result: core::ptr::null_mut()
12226                         } }
12227                 } else {
12228                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12229                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12230                         } }
12231                 }
12232         }
12233 }
12234 #[no_mangle]
12235 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12236 /// but with all dynamically-allocated buffers duplicated in new buffers.
12237 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12238 #[repr(C)]
12239 /// The contents of CResult_boolPeerHandleErrorZ
12240 pub union CResult_boolPeerHandleErrorZPtr {
12241         /// A pointer to the contents in the success state.
12242         /// Reading from this pointer when `result_ok` is not set is undefined.
12243         pub result: *mut bool,
12244         /// A pointer to the contents in the error state.
12245         /// Reading from this pointer when `result_ok` is set is undefined.
12246         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12247 }
12248 #[repr(C)]
12249 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12250 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12252 pub struct CResult_boolPeerHandleErrorZ {
12253         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12254         /// `err` or `result` depending on the state of `result_ok`.
12255         pub contents: CResult_boolPeerHandleErrorZPtr,
12256         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12257         pub result_ok: bool,
12258 }
12259 #[no_mangle]
12260 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12261 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12262         CResult_boolPeerHandleErrorZ {
12263                 contents: CResult_boolPeerHandleErrorZPtr {
12264                         result: Box::into_raw(Box::new(o)),
12265                 },
12266                 result_ok: true,
12267         }
12268 }
12269 #[no_mangle]
12270 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12271 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12272         CResult_boolPeerHandleErrorZ {
12273                 contents: CResult_boolPeerHandleErrorZPtr {
12274                         err: Box::into_raw(Box::new(e)),
12275                 },
12276                 result_ok: false,
12277         }
12278 }
12279 /// Checks if the given object is currently in the success state
12280 #[no_mangle]
12281 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12282         o.result_ok
12283 }
12284 #[no_mangle]
12285 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12286 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12287 impl Drop for CResult_boolPeerHandleErrorZ {
12288         fn drop(&mut self) {
12289                 if self.result_ok {
12290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12292                         }
12293                 } else {
12294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12296                         }
12297                 }
12298         }
12299 }
12300 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12301         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12302                 let contents = if o.result_ok {
12303                         let result = unsafe { o.contents.result };
12304                         unsafe { o.contents.result = core::ptr::null_mut() };
12305                         CResult_boolPeerHandleErrorZPtr { result }
12306                 } else {
12307                         let err = unsafe { o.contents.err };
12308                         unsafe { o.contents.err = core::ptr::null_mut(); }
12309                         CResult_boolPeerHandleErrorZPtr { err }
12310                 };
12311                 Self {
12312                         contents,
12313                         result_ok: o.result_ok,
12314                 }
12315         }
12316 }
12317 impl Clone for CResult_boolPeerHandleErrorZ {
12318         fn clone(&self) -> Self {
12319                 if self.result_ok {
12320                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12321                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12322                         } }
12323                 } else {
12324                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12325                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12326                         } }
12327                 }
12328         }
12329 }
12330 #[no_mangle]
12331 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12332 /// but with all dynamically-allocated buffers duplicated in new buffers.
12333 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12334 #[repr(C)]
12335 /// The contents of CResult_u32GraphSyncErrorZ
12336 pub union CResult_u32GraphSyncErrorZPtr {
12337         /// A pointer to the contents in the success state.
12338         /// Reading from this pointer when `result_ok` is not set is undefined.
12339         pub result: *mut u32,
12340         /// A pointer to the contents in the error state.
12341         /// Reading from this pointer when `result_ok` is set is undefined.
12342         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12343 }
12344 #[repr(C)]
12345 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12346 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12348 pub struct CResult_u32GraphSyncErrorZ {
12349         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12350         /// `err` or `result` depending on the state of `result_ok`.
12351         pub contents: CResult_u32GraphSyncErrorZPtr,
12352         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12353         pub result_ok: bool,
12354 }
12355 #[no_mangle]
12356 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12357 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12358         CResult_u32GraphSyncErrorZ {
12359                 contents: CResult_u32GraphSyncErrorZPtr {
12360                         result: Box::into_raw(Box::new(o)),
12361                 },
12362                 result_ok: true,
12363         }
12364 }
12365 #[no_mangle]
12366 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12367 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12368         CResult_u32GraphSyncErrorZ {
12369                 contents: CResult_u32GraphSyncErrorZPtr {
12370                         err: Box::into_raw(Box::new(e)),
12371                 },
12372                 result_ok: false,
12373         }
12374 }
12375 /// Checks if the given object is currently in the success state
12376 #[no_mangle]
12377 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12378         o.result_ok
12379 }
12380 #[no_mangle]
12381 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12382 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12383 impl Drop for CResult_u32GraphSyncErrorZ {
12384         fn drop(&mut self) {
12385                 if self.result_ok {
12386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12388                         }
12389                 } else {
12390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12392                         }
12393                 }
12394         }
12395 }
12396 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12397         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12398                 let contents = if o.result_ok {
12399                         let result = unsafe { o.contents.result };
12400                         unsafe { o.contents.result = core::ptr::null_mut() };
12401                         CResult_u32GraphSyncErrorZPtr { result }
12402                 } else {
12403                         let err = unsafe { o.contents.err };
12404                         unsafe { o.contents.err = core::ptr::null_mut(); }
12405                         CResult_u32GraphSyncErrorZPtr { err }
12406                 };
12407                 Self {
12408                         contents,
12409                         result_ok: o.result_ok,
12410                 }
12411         }
12412 }
12413 #[repr(C)]
12414 /// The contents of CResult_CVec_u8ZIOErrorZ
12415 pub union CResult_CVec_u8ZIOErrorZPtr {
12416         /// A pointer to the contents in the success state.
12417         /// Reading from this pointer when `result_ok` is not set is undefined.
12418         pub result: *mut crate::c_types::derived::CVec_u8Z,
12419         /// A pointer to the contents in the error state.
12420         /// Reading from this pointer when `result_ok` is set is undefined.
12421         pub err: *mut crate::c_types::IOError,
12422 }
12423 #[repr(C)]
12424 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
12425 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
12426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12427 pub struct CResult_CVec_u8ZIOErrorZ {
12428         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
12429         /// `err` or `result` depending on the state of `result_ok`.
12430         pub contents: CResult_CVec_u8ZIOErrorZPtr,
12431         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
12432         pub result_ok: bool,
12433 }
12434 #[no_mangle]
12435 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
12436 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
12437         CResult_CVec_u8ZIOErrorZ {
12438                 contents: CResult_CVec_u8ZIOErrorZPtr {
12439                         result: Box::into_raw(Box::new(o)),
12440                 },
12441                 result_ok: true,
12442         }
12443 }
12444 #[no_mangle]
12445 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
12446 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
12447         CResult_CVec_u8ZIOErrorZ {
12448                 contents: CResult_CVec_u8ZIOErrorZPtr {
12449                         err: Box::into_raw(Box::new(e)),
12450                 },
12451                 result_ok: false,
12452         }
12453 }
12454 /// Checks if the given object is currently in the success state
12455 #[no_mangle]
12456 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
12457         o.result_ok
12458 }
12459 #[no_mangle]
12460 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
12461 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
12462 impl Drop for CResult_CVec_u8ZIOErrorZ {
12463         fn drop(&mut self) {
12464                 if self.result_ok {
12465                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12466                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12467                         }
12468                 } else {
12469                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12470                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12471                         }
12472                 }
12473         }
12474 }
12475 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
12476         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
12477                 let contents = if o.result_ok {
12478                         let result = unsafe { o.contents.result };
12479                         unsafe { o.contents.result = core::ptr::null_mut() };
12480                         CResult_CVec_u8ZIOErrorZPtr { result }
12481                 } else {
12482                         let err = unsafe { o.contents.err };
12483                         unsafe { o.contents.err = core::ptr::null_mut(); }
12484                         CResult_CVec_u8ZIOErrorZPtr { err }
12485                 };
12486                 Self {
12487                         contents,
12488                         result_ok: o.result_ok,
12489                 }
12490         }
12491 }
12492 impl Clone for CResult_CVec_u8ZIOErrorZ {
12493         fn clone(&self) -> Self {
12494                 if self.result_ok {
12495                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
12496                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12497                         } }
12498                 } else {
12499                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
12500                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12501                         } }
12502                 }
12503         }
12504 }
12505 #[no_mangle]
12506 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
12507 /// but with all dynamically-allocated buffers duplicated in new buffers.
12508 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
12509 #[repr(C)]
12510 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
12511 /// This corresponds to std::vector in C++
12512 pub struct CVec_StrZ {
12513         /// The elements in the array.
12514         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12515         pub data: *mut crate::c_types::Str,
12516         /// The number of elements pointed to by `data`.
12517         pub datalen: usize
12518 }
12519 impl CVec_StrZ {
12520         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
12521                 if self.datalen == 0 { return Vec::new(); }
12522                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12523                 self.data = core::ptr::null_mut();
12524                 self.datalen = 0;
12525                 ret
12526         }
12527         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
12528                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12529         }
12530 }
12531 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
12532         fn from(v: Vec<crate::c_types::Str>) -> Self {
12533                 let datalen = v.len();
12534                 let data = Box::into_raw(v.into_boxed_slice());
12535                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12536         }
12537 }
12538 #[no_mangle]
12539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12540 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
12541 impl Drop for CVec_StrZ {
12542         fn drop(&mut self) {
12543                 if self.datalen == 0 { return; }
12544                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12545         }
12546 }
12547 impl Clone for CVec_StrZ {
12548         fn clone(&self) -> Self {
12549                 let mut res = Vec::new();
12550                 if self.datalen == 0 { return Self::from(res); }
12551                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12552                 Self::from(res)
12553         }
12554 }
12555 #[repr(C)]
12556 /// The contents of CResult_CVec_StrZIOErrorZ
12557 pub union CResult_CVec_StrZIOErrorZPtr {
12558         /// A pointer to the contents in the success state.
12559         /// Reading from this pointer when `result_ok` is not set is undefined.
12560         pub result: *mut crate::c_types::derived::CVec_StrZ,
12561         /// A pointer to the contents in the error state.
12562         /// Reading from this pointer when `result_ok` is set is undefined.
12563         pub err: *mut crate::c_types::IOError,
12564 }
12565 #[repr(C)]
12566 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
12567 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
12568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12569 pub struct CResult_CVec_StrZIOErrorZ {
12570         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
12571         /// `err` or `result` depending on the state of `result_ok`.
12572         pub contents: CResult_CVec_StrZIOErrorZPtr,
12573         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
12574         pub result_ok: bool,
12575 }
12576 #[no_mangle]
12577 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
12578 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
12579         CResult_CVec_StrZIOErrorZ {
12580                 contents: CResult_CVec_StrZIOErrorZPtr {
12581                         result: Box::into_raw(Box::new(o)),
12582                 },
12583                 result_ok: true,
12584         }
12585 }
12586 #[no_mangle]
12587 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
12588 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
12589         CResult_CVec_StrZIOErrorZ {
12590                 contents: CResult_CVec_StrZIOErrorZPtr {
12591                         err: Box::into_raw(Box::new(e)),
12592                 },
12593                 result_ok: false,
12594         }
12595 }
12596 /// Checks if the given object is currently in the success state
12597 #[no_mangle]
12598 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
12599         o.result_ok
12600 }
12601 #[no_mangle]
12602 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
12603 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
12604 impl Drop for CResult_CVec_StrZIOErrorZ {
12605         fn drop(&mut self) {
12606                 if self.result_ok {
12607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12609                         }
12610                 } else {
12611                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12612                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12613                         }
12614                 }
12615         }
12616 }
12617 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
12618         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
12619                 let contents = if o.result_ok {
12620                         let result = unsafe { o.contents.result };
12621                         unsafe { o.contents.result = core::ptr::null_mut() };
12622                         CResult_CVec_StrZIOErrorZPtr { result }
12623                 } else {
12624                         let err = unsafe { o.contents.err };
12625                         unsafe { o.contents.err = core::ptr::null_mut(); }
12626                         CResult_CVec_StrZIOErrorZPtr { err }
12627                 };
12628                 Self {
12629                         contents,
12630                         result_ok: o.result_ok,
12631                 }
12632         }
12633 }
12634 impl Clone for CResult_CVec_StrZIOErrorZ {
12635         fn clone(&self) -> Self {
12636                 if self.result_ok {
12637                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
12638                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
12639                         } }
12640                 } else {
12641                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
12642                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12643                         } }
12644                 }
12645         }
12646 }
12647 #[no_mangle]
12648 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
12649 /// but with all dynamically-allocated buffers duplicated in new buffers.
12650 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
12651 #[repr(C)]
12652 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
12653 /// This corresponds to std::vector in C++
12654 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12655         /// The elements in the array.
12656         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12657         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12658         /// The number of elements pointed to by `data`.
12659         pub datalen: usize
12660 }
12661 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12662         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
12663                 if self.datalen == 0 { return Vec::new(); }
12664                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12665                 self.data = core::ptr::null_mut();
12666                 self.datalen = 0;
12667                 ret
12668         }
12669         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
12670                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12671         }
12672 }
12673 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12674         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
12675                 let datalen = v.len();
12676                 let data = Box::into_raw(v.into_boxed_slice());
12677                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12678         }
12679 }
12680 #[no_mangle]
12681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12682 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
12683 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12684         fn drop(&mut self) {
12685                 if self.datalen == 0 { return; }
12686                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12687         }
12688 }
12689 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12690         fn clone(&self) -> Self {
12691                 let mut res = Vec::new();
12692                 if self.datalen == 0 { return Self::from(res); }
12693                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12694                 Self::from(res)
12695         }
12696 }
12697 #[repr(C)]
12698 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
12699 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12700         /// A pointer to the contents in the success state.
12701         /// Reading from this pointer when `result_ok` is not set is undefined.
12702         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
12703         /// A pointer to the contents in the error state.
12704         /// Reading from this pointer when `result_ok` is set is undefined.
12705         pub err: *mut crate::c_types::IOError,
12706 }
12707 #[repr(C)]
12708 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
12709 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
12710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12711 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12712         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
12713         /// `err` or `result` depending on the state of `result_ok`.
12714         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
12715         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
12716         pub result_ok: bool,
12717 }
12718 #[no_mangle]
12719 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
12720 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12721         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12722                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12723                         result: Box::into_raw(Box::new(o)),
12724                 },
12725                 result_ok: true,
12726         }
12727 }
12728 #[no_mangle]
12729 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
12730 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12731         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12732                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12733                         err: Box::into_raw(Box::new(e)),
12734                 },
12735                 result_ok: false,
12736         }
12737 }
12738 /// Checks if the given object is currently in the success state
12739 #[no_mangle]
12740 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
12741         o.result_ok
12742 }
12743 #[no_mangle]
12744 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
12745 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
12746 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12747         fn drop(&mut self) {
12748                 if self.result_ok {
12749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12751                         }
12752                 } else {
12753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12755                         }
12756                 }
12757         }
12758 }
12759 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12760         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
12761                 let contents = if o.result_ok {
12762                         let result = unsafe { o.contents.result };
12763                         unsafe { o.contents.result = core::ptr::null_mut() };
12764                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
12765                 } else {
12766                         let err = unsafe { o.contents.err };
12767                         unsafe { o.contents.err = core::ptr::null_mut(); }
12768                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
12769                 };
12770                 Self {
12771                         contents,
12772                         result_ok: o.result_ok,
12773                 }
12774         }
12775 }
12776 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12777         fn clone(&self) -> Self {
12778                 if self.result_ok {
12779                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12780                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
12781                         } }
12782                 } else {
12783                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12784                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12785                         } }
12786                 }
12787         }
12788 }
12789 #[no_mangle]
12790 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
12791 /// but with all dynamically-allocated buffers duplicated in new buffers.
12792 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
12793 #[repr(C)]
12794 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
12795 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12796         /// A pointer to the contents in the success state.
12797         /// Reading from this pointer when `result_ok` is not set is undefined.
12798         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12799         /// A pointer to the contents in the error state.
12800         /// Reading from this pointer when `result_ok` is set is undefined.
12801         pub err: *mut crate::c_types::IOError,
12802 }
12803 #[repr(C)]
12804 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
12805 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
12806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12807 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12808         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
12809         /// `err` or `result` depending on the state of `result_ok`.
12810         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
12811         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
12812         pub result_ok: bool,
12813 }
12814 #[no_mangle]
12815 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
12816 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12817         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12818                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12819                         result: Box::into_raw(Box::new(o)),
12820                 },
12821                 result_ok: true,
12822         }
12823 }
12824 #[no_mangle]
12825 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
12826 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12827         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12828                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12829                         err: Box::into_raw(Box::new(e)),
12830                 },
12831                 result_ok: false,
12832         }
12833 }
12834 /// Checks if the given object is currently in the success state
12835 #[no_mangle]
12836 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
12837         o.result_ok
12838 }
12839 #[no_mangle]
12840 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
12841 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
12842 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12843         fn drop(&mut self) {
12844                 if self.result_ok {
12845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12847                         }
12848                 } else {
12849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12851                         }
12852                 }
12853         }
12854 }
12855 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12856         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
12857                 let contents = if o.result_ok {
12858                         let result = unsafe { o.contents.result };
12859                         unsafe { o.contents.result = core::ptr::null_mut() };
12860                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
12861                 } else {
12862                         let err = unsafe { o.contents.err };
12863                         unsafe { o.contents.err = core::ptr::null_mut(); }
12864                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
12865                 };
12866                 Self {
12867                         contents,
12868                         result_ok: o.result_ok,
12869                 }
12870         }
12871 }
12872 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12873         fn clone(&self) -> Self {
12874                 if self.result_ok {
12875                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12876                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12877                         } }
12878                 } else {
12879                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12880                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12881                         } }
12882                 }
12883         }
12884 }
12885 #[no_mangle]
12886 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
12887 /// but with all dynamically-allocated buffers duplicated in new buffers.
12888 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
12889 #[repr(C)]
12890 #[derive(Clone)]
12891 /// An enum which can either contain a crate::c_types::SecretKey or not
12892 pub enum COption_SecretKeyZ {
12893         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
12894         Some(crate::c_types::SecretKey),
12895         /// When we're in this state, this COption_SecretKeyZ contains nothing
12896         None
12897 }
12898 impl COption_SecretKeyZ {
12899         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12900                 if let Self::None = self { false } else { true }
12901         }
12902         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12903                 !self.is_some()
12904         }
12905         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
12906                 if let Self::Some(v) = self { v } else { unreachable!() }
12907         }
12908 }
12909 #[no_mangle]
12910 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
12911 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
12912         COption_SecretKeyZ::Some(o)
12913 }
12914 #[no_mangle]
12915 /// Constructs a new COption_SecretKeyZ containing nothing
12916 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
12917         COption_SecretKeyZ::None
12918 }
12919 #[no_mangle]
12920 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
12921 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
12922 #[no_mangle]
12923 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
12924 /// but with all dynamically-allocated buffers duplicated in new buffers.
12925 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
12926 #[repr(C)]
12927 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
12928 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
12929         /// A pointer to the contents in the success state.
12930         /// Reading from this pointer when `result_ok` is not set is undefined.
12931         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
12932         /// Note that this value is always NULL, as there are no contents in the Err variant
12933         pub err: *mut core::ffi::c_void,
12934 }
12935 #[repr(C)]
12936 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
12937 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
12938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12939 pub struct CResult_VerifiedInvoiceRequestNoneZ {
12940         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
12941         /// `err` or `result` depending on the state of `result_ok`.
12942         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
12943         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
12944         pub result_ok: bool,
12945 }
12946 #[no_mangle]
12947 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
12948 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
12949         CResult_VerifiedInvoiceRequestNoneZ {
12950                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12951                         result: Box::into_raw(Box::new(o)),
12952                 },
12953                 result_ok: true,
12954         }
12955 }
12956 #[no_mangle]
12957 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
12958 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
12959         CResult_VerifiedInvoiceRequestNoneZ {
12960                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12961                         err: core::ptr::null_mut(),
12962                 },
12963                 result_ok: false,
12964         }
12965 }
12966 /// Checks if the given object is currently in the success state
12967 #[no_mangle]
12968 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
12969         o.result_ok
12970 }
12971 #[no_mangle]
12972 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
12973 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
12974 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
12975         fn drop(&mut self) {
12976                 if self.result_ok {
12977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12979                         }
12980                 } else {
12981                 }
12982         }
12983 }
12984 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
12985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
12986                 let contents = if o.result_ok {
12987                         let result = unsafe { o.contents.result };
12988                         unsafe { o.contents.result = core::ptr::null_mut() };
12989                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
12990                 } else {
12991                         let _ = unsafe { Box::from_raw(o.contents.err) };
12992                         o.contents.err = core::ptr::null_mut();
12993                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
12994                 };
12995                 Self {
12996                         contents,
12997                         result_ok: o.result_ok,
12998                 }
12999         }
13000 }
13001 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
13002         fn clone(&self) -> Self {
13003                 if self.result_ok {
13004                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13005                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
13006                         } }
13007                 } else {
13008                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13009                                 err: core::ptr::null_mut()
13010                         } }
13011                 }
13012         }
13013 }
13014 #[no_mangle]
13015 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
13016 /// but with all dynamically-allocated buffers duplicated in new buffers.
13017 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
13018 #[repr(C)]
13019 /// An enum which can either contain a  or not
13020 pub enum COption_NoneZ {
13021         /// When we're in this state, this COption_NoneZ contains a 
13022         Some,
13023         /// When we're in this state, this COption_NoneZ contains nothing
13024         None
13025 }
13026 impl COption_NoneZ {
13027         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13028                 if let Self::None = self { false } else { true }
13029         }
13030         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13031                 !self.is_some()
13032         }
13033 }
13034 #[no_mangle]
13035 /// Constructs a new COption_NoneZ containing a 
13036 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
13037         COption_NoneZ::Some
13038 }
13039 #[no_mangle]
13040 /// Constructs a new COption_NoneZ containing nothing
13041 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
13042         COption_NoneZ::None
13043 }
13044 #[no_mangle]
13045 /// Frees any resources associated with the , if we are in the Some state
13046 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
13047 #[repr(C)]
13048 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
13049 /// This corresponds to std::vector in C++
13050 pub struct CVec_WitnessZ {
13051         /// The elements in the array.
13052         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13053         pub data: *mut crate::c_types::Witness,
13054         /// The number of elements pointed to by `data`.
13055         pub datalen: usize
13056 }
13057 impl CVec_WitnessZ {
13058         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
13059                 if self.datalen == 0 { return Vec::new(); }
13060                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13061                 self.data = core::ptr::null_mut();
13062                 self.datalen = 0;
13063                 ret
13064         }
13065         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
13066                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13067         }
13068 }
13069 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
13070         fn from(v: Vec<crate::c_types::Witness>) -> Self {
13071                 let datalen = v.len();
13072                 let data = Box::into_raw(v.into_boxed_slice());
13073                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13074         }
13075 }
13076 #[no_mangle]
13077 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13078 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
13079 impl Drop for CVec_WitnessZ {
13080         fn drop(&mut self) {
13081                 if self.datalen == 0 { return; }
13082                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13083         }
13084 }
13085 impl Clone for CVec_WitnessZ {
13086         fn clone(&self) -> Self {
13087                 let mut res = Vec::new();
13088                 if self.datalen == 0 { return Self::from(res); }
13089                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13090                 Self::from(res)
13091         }
13092 }
13093 #[repr(C)]
13094 #[derive(Clone)]
13095 /// An enum which can either contain a i64 or not
13096 pub enum COption_i64Z {
13097         /// When we're in this state, this COption_i64Z contains a i64
13098         Some(i64),
13099         /// When we're in this state, this COption_i64Z contains nothing
13100         None
13101 }
13102 impl COption_i64Z {
13103         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13104                 if let Self::None = self { false } else { true }
13105         }
13106         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13107                 !self.is_some()
13108         }
13109         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
13110                 if let Self::Some(v) = self { v } else { unreachable!() }
13111         }
13112 }
13113 #[no_mangle]
13114 /// Constructs a new COption_i64Z containing a i64
13115 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
13116         COption_i64Z::Some(o)
13117 }
13118 #[no_mangle]
13119 /// Constructs a new COption_i64Z containing nothing
13120 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
13121         COption_i64Z::None
13122 }
13123 #[no_mangle]
13124 /// Frees any resources associated with the i64, if we are in the Some state
13125 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
13126 #[no_mangle]
13127 /// Creates a new COption_i64Z which has the same data as `orig`
13128 /// but with all dynamically-allocated buffers duplicated in new buffers.
13129 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
13130 #[repr(C)]
13131 /// The contents of CResult_SocketAddressDecodeErrorZ
13132 pub union CResult_SocketAddressDecodeErrorZPtr {
13133         /// A pointer to the contents in the success state.
13134         /// Reading from this pointer when `result_ok` is not set is undefined.
13135         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13136         /// A pointer to the contents in the error state.
13137         /// Reading from this pointer when `result_ok` is set is undefined.
13138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13139 }
13140 #[repr(C)]
13141 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
13142 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13144 pub struct CResult_SocketAddressDecodeErrorZ {
13145         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
13146         /// `err` or `result` depending on the state of `result_ok`.
13147         pub contents: CResult_SocketAddressDecodeErrorZPtr,
13148         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
13149         pub result_ok: bool,
13150 }
13151 #[no_mangle]
13152 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
13153 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
13154         CResult_SocketAddressDecodeErrorZ {
13155                 contents: CResult_SocketAddressDecodeErrorZPtr {
13156                         result: Box::into_raw(Box::new(o)),
13157                 },
13158                 result_ok: true,
13159         }
13160 }
13161 #[no_mangle]
13162 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
13163 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
13164         CResult_SocketAddressDecodeErrorZ {
13165                 contents: CResult_SocketAddressDecodeErrorZPtr {
13166                         err: Box::into_raw(Box::new(e)),
13167                 },
13168                 result_ok: false,
13169         }
13170 }
13171 /// Checks if the given object is currently in the success state
13172 #[no_mangle]
13173 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
13174         o.result_ok
13175 }
13176 #[no_mangle]
13177 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
13178 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
13179 impl Drop for CResult_SocketAddressDecodeErrorZ {
13180         fn drop(&mut self) {
13181                 if self.result_ok {
13182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13184                         }
13185                 } else {
13186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13188                         }
13189                 }
13190         }
13191 }
13192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
13193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13194                 let contents = if o.result_ok {
13195                         let result = unsafe { o.contents.result };
13196                         unsafe { o.contents.result = core::ptr::null_mut() };
13197                         CResult_SocketAddressDecodeErrorZPtr { result }
13198                 } else {
13199                         let err = unsafe { o.contents.err };
13200                         unsafe { o.contents.err = core::ptr::null_mut(); }
13201                         CResult_SocketAddressDecodeErrorZPtr { err }
13202                 };
13203                 Self {
13204                         contents,
13205                         result_ok: o.result_ok,
13206                 }
13207         }
13208 }
13209 impl Clone for CResult_SocketAddressDecodeErrorZ {
13210         fn clone(&self) -> Self {
13211                 if self.result_ok {
13212                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
13213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
13214                         } }
13215                 } else {
13216                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
13217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13218                         } }
13219                 }
13220         }
13221 }
13222 #[no_mangle]
13223 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
13224 /// but with all dynamically-allocated buffers duplicated in new buffers.
13225 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
13226 #[repr(C)]
13227 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
13228 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
13229         /// A pointer to the contents in the success state.
13230         /// Reading from this pointer when `result_ok` is not set is undefined.
13231         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13232         /// A pointer to the contents in the error state.
13233         /// Reading from this pointer when `result_ok` is set is undefined.
13234         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
13235 }
13236 #[repr(C)]
13237 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
13238 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
13239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13240 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
13241         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
13242         /// `err` or `result` depending on the state of `result_ok`.
13243         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
13244         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
13245         pub result_ok: bool,
13246 }
13247 #[no_mangle]
13248 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
13249 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
13250         CResult_SocketAddressSocketAddressParseErrorZ {
13251                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13252                         result: Box::into_raw(Box::new(o)),
13253                 },
13254                 result_ok: true,
13255         }
13256 }
13257 #[no_mangle]
13258 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
13259 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
13260         CResult_SocketAddressSocketAddressParseErrorZ {
13261                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13262                         err: Box::into_raw(Box::new(e)),
13263                 },
13264                 result_ok: false,
13265         }
13266 }
13267 /// Checks if the given object is currently in the success state
13268 #[no_mangle]
13269 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
13270         o.result_ok
13271 }
13272 #[no_mangle]
13273 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
13274 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
13275 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
13276         fn drop(&mut self) {
13277                 if self.result_ok {
13278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13280                         }
13281                 } else {
13282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13284                         }
13285                 }
13286         }
13287 }
13288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
13289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
13290                 let contents = if o.result_ok {
13291                         let result = unsafe { o.contents.result };
13292                         unsafe { o.contents.result = core::ptr::null_mut() };
13293                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
13294                 } else {
13295                         let err = unsafe { o.contents.err };
13296                         unsafe { o.contents.err = core::ptr::null_mut(); }
13297                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
13298                 };
13299                 Self {
13300                         contents,
13301                         result_ok: o.result_ok,
13302                 }
13303         }
13304 }
13305 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
13306         fn clone(&self) -> Self {
13307                 if self.result_ok {
13308                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13309                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
13310                         } }
13311                 } else {
13312                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
13314                         } }
13315                 }
13316         }
13317 }
13318 #[no_mangle]
13319 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
13320 /// but with all dynamically-allocated buffers duplicated in new buffers.
13321 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
13322 #[repr(C)]
13323 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13324 /// This corresponds to std::vector in C++
13325 pub struct CVec_UpdateAddHTLCZ {
13326         /// The elements in the array.
13327         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13328         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13329         /// The number of elements pointed to by `data`.
13330         pub datalen: usize
13331 }
13332 impl CVec_UpdateAddHTLCZ {
13333         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13334                 if self.datalen == 0 { return Vec::new(); }
13335                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13336                 self.data = core::ptr::null_mut();
13337                 self.datalen = 0;
13338                 ret
13339         }
13340         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13341                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13342         }
13343 }
13344 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13345         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13346                 let datalen = v.len();
13347                 let data = Box::into_raw(v.into_boxed_slice());
13348                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13349         }
13350 }
13351 #[no_mangle]
13352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13353 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13354 impl Drop for CVec_UpdateAddHTLCZ {
13355         fn drop(&mut self) {
13356                 if self.datalen == 0 { return; }
13357                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13358         }
13359 }
13360 impl Clone for CVec_UpdateAddHTLCZ {
13361         fn clone(&self) -> Self {
13362                 let mut res = Vec::new();
13363                 if self.datalen == 0 { return Self::from(res); }
13364                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13365                 Self::from(res)
13366         }
13367 }
13368 #[repr(C)]
13369 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13370 /// This corresponds to std::vector in C++
13371 pub struct CVec_UpdateFulfillHTLCZ {
13372         /// The elements in the array.
13373         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13374         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13375         /// The number of elements pointed to by `data`.
13376         pub datalen: usize
13377 }
13378 impl CVec_UpdateFulfillHTLCZ {
13379         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13380                 if self.datalen == 0 { return Vec::new(); }
13381                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13382                 self.data = core::ptr::null_mut();
13383                 self.datalen = 0;
13384                 ret
13385         }
13386         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13387                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13388         }
13389 }
13390 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13391         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13392                 let datalen = v.len();
13393                 let data = Box::into_raw(v.into_boxed_slice());
13394                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13395         }
13396 }
13397 #[no_mangle]
13398 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13399 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13400 impl Drop for CVec_UpdateFulfillHTLCZ {
13401         fn drop(&mut self) {
13402                 if self.datalen == 0 { return; }
13403                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13404         }
13405 }
13406 impl Clone for CVec_UpdateFulfillHTLCZ {
13407         fn clone(&self) -> Self {
13408                 let mut res = Vec::new();
13409                 if self.datalen == 0 { return Self::from(res); }
13410                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13411                 Self::from(res)
13412         }
13413 }
13414 #[repr(C)]
13415 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13416 /// This corresponds to std::vector in C++
13417 pub struct CVec_UpdateFailHTLCZ {
13418         /// The elements in the array.
13419         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13420         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13421         /// The number of elements pointed to by `data`.
13422         pub datalen: usize
13423 }
13424 impl CVec_UpdateFailHTLCZ {
13425         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13426                 if self.datalen == 0 { return Vec::new(); }
13427                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13428                 self.data = core::ptr::null_mut();
13429                 self.datalen = 0;
13430                 ret
13431         }
13432         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13433                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13434         }
13435 }
13436 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13437         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13438                 let datalen = v.len();
13439                 let data = Box::into_raw(v.into_boxed_slice());
13440                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13441         }
13442 }
13443 #[no_mangle]
13444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13445 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13446 impl Drop for CVec_UpdateFailHTLCZ {
13447         fn drop(&mut self) {
13448                 if self.datalen == 0 { return; }
13449                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13450         }
13451 }
13452 impl Clone for CVec_UpdateFailHTLCZ {
13453         fn clone(&self) -> Self {
13454                 let mut res = Vec::new();
13455                 if self.datalen == 0 { return Self::from(res); }
13456                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13457                 Self::from(res)
13458         }
13459 }
13460 #[repr(C)]
13461 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13462 /// This corresponds to std::vector in C++
13463 pub struct CVec_UpdateFailMalformedHTLCZ {
13464         /// The elements in the array.
13465         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13466         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13467         /// The number of elements pointed to by `data`.
13468         pub datalen: usize
13469 }
13470 impl CVec_UpdateFailMalformedHTLCZ {
13471         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13472                 if self.datalen == 0 { return Vec::new(); }
13473                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13474                 self.data = core::ptr::null_mut();
13475                 self.datalen = 0;
13476                 ret
13477         }
13478         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13479                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13480         }
13481 }
13482 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13483         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13484                 let datalen = v.len();
13485                 let data = Box::into_raw(v.into_boxed_slice());
13486                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13487         }
13488 }
13489 #[no_mangle]
13490 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13491 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13492 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13493         fn drop(&mut self) {
13494                 if self.datalen == 0 { return; }
13495                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13496         }
13497 }
13498 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13499         fn clone(&self) -> Self {
13500                 let mut res = Vec::new();
13501                 if self.datalen == 0 { return Self::from(res); }
13502                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13503                 Self::from(res)
13504         }
13505 }
13506 #[repr(C)]
13507 /// The contents of CResult_AcceptChannelDecodeErrorZ
13508 pub union CResult_AcceptChannelDecodeErrorZPtr {
13509         /// A pointer to the contents in the success state.
13510         /// Reading from this pointer when `result_ok` is not set is undefined.
13511         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13512         /// A pointer to the contents in the error state.
13513         /// Reading from this pointer when `result_ok` is set is undefined.
13514         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13515 }
13516 #[repr(C)]
13517 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13518 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13520 pub struct CResult_AcceptChannelDecodeErrorZ {
13521         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13522         /// `err` or `result` depending on the state of `result_ok`.
13523         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13524         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13525         pub result_ok: bool,
13526 }
13527 #[no_mangle]
13528 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13529 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13530         CResult_AcceptChannelDecodeErrorZ {
13531                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13532                         result: Box::into_raw(Box::new(o)),
13533                 },
13534                 result_ok: true,
13535         }
13536 }
13537 #[no_mangle]
13538 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13539 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13540         CResult_AcceptChannelDecodeErrorZ {
13541                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13542                         err: Box::into_raw(Box::new(e)),
13543                 },
13544                 result_ok: false,
13545         }
13546 }
13547 /// Checks if the given object is currently in the success state
13548 #[no_mangle]
13549 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13550         o.result_ok
13551 }
13552 #[no_mangle]
13553 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13554 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13555 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13556         fn drop(&mut self) {
13557                 if self.result_ok {
13558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13560                         }
13561                 } else {
13562                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13563                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13564                         }
13565                 }
13566         }
13567 }
13568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13569         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13570                 let contents = if o.result_ok {
13571                         let result = unsafe { o.contents.result };
13572                         unsafe { o.contents.result = core::ptr::null_mut() };
13573                         CResult_AcceptChannelDecodeErrorZPtr { result }
13574                 } else {
13575                         let err = unsafe { o.contents.err };
13576                         unsafe { o.contents.err = core::ptr::null_mut(); }
13577                         CResult_AcceptChannelDecodeErrorZPtr { err }
13578                 };
13579                 Self {
13580                         contents,
13581                         result_ok: o.result_ok,
13582                 }
13583         }
13584 }
13585 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13586         fn clone(&self) -> Self {
13587                 if self.result_ok {
13588                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13589                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13590                         } }
13591                 } else {
13592                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13593                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13594                         } }
13595                 }
13596         }
13597 }
13598 #[no_mangle]
13599 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13600 /// but with all dynamically-allocated buffers duplicated in new buffers.
13601 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13602 #[repr(C)]
13603 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
13604 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
13605         /// A pointer to the contents in the success state.
13606         /// Reading from this pointer when `result_ok` is not set is undefined.
13607         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
13608         /// A pointer to the contents in the error state.
13609         /// Reading from this pointer when `result_ok` is set is undefined.
13610         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13611 }
13612 #[repr(C)]
13613 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
13614 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
13615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13616 pub struct CResult_AcceptChannelV2DecodeErrorZ {
13617         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
13618         /// `err` or `result` depending on the state of `result_ok`.
13619         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
13620         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
13621         pub result_ok: bool,
13622 }
13623 #[no_mangle]
13624 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
13625 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
13626         CResult_AcceptChannelV2DecodeErrorZ {
13627                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13628                         result: Box::into_raw(Box::new(o)),
13629                 },
13630                 result_ok: true,
13631         }
13632 }
13633 #[no_mangle]
13634 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
13635 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
13636         CResult_AcceptChannelV2DecodeErrorZ {
13637                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13638                         err: Box::into_raw(Box::new(e)),
13639                 },
13640                 result_ok: false,
13641         }
13642 }
13643 /// Checks if the given object is currently in the success state
13644 #[no_mangle]
13645 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
13646         o.result_ok
13647 }
13648 #[no_mangle]
13649 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
13650 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
13651 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
13652         fn drop(&mut self) {
13653                 if self.result_ok {
13654                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13655                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13656                         }
13657                 } else {
13658                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13659                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13660                         }
13661                 }
13662         }
13663 }
13664 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
13665         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
13666                 let contents = if o.result_ok {
13667                         let result = unsafe { o.contents.result };
13668                         unsafe { o.contents.result = core::ptr::null_mut() };
13669                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
13670                 } else {
13671                         let err = unsafe { o.contents.err };
13672                         unsafe { o.contents.err = core::ptr::null_mut(); }
13673                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
13674                 };
13675                 Self {
13676                         contents,
13677                         result_ok: o.result_ok,
13678                 }
13679         }
13680 }
13681 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
13682         fn clone(&self) -> Self {
13683                 if self.result_ok {
13684                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13685                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
13686                         } }
13687                 } else {
13688                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13689                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13690                         } }
13691                 }
13692         }
13693 }
13694 #[no_mangle]
13695 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
13696 /// but with all dynamically-allocated buffers duplicated in new buffers.
13697 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
13698 #[repr(C)]
13699 /// The contents of CResult_TxAddInputDecodeErrorZ
13700 pub union CResult_TxAddInputDecodeErrorZPtr {
13701         /// A pointer to the contents in the success state.
13702         /// Reading from this pointer when `result_ok` is not set is undefined.
13703         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
13704         /// A pointer to the contents in the error state.
13705         /// Reading from this pointer when `result_ok` is set is undefined.
13706         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13707 }
13708 #[repr(C)]
13709 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
13710 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13712 pub struct CResult_TxAddInputDecodeErrorZ {
13713         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
13714         /// `err` or `result` depending on the state of `result_ok`.
13715         pub contents: CResult_TxAddInputDecodeErrorZPtr,
13716         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
13717         pub result_ok: bool,
13718 }
13719 #[no_mangle]
13720 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
13721 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
13722         CResult_TxAddInputDecodeErrorZ {
13723                 contents: CResult_TxAddInputDecodeErrorZPtr {
13724                         result: Box::into_raw(Box::new(o)),
13725                 },
13726                 result_ok: true,
13727         }
13728 }
13729 #[no_mangle]
13730 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
13731 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
13732         CResult_TxAddInputDecodeErrorZ {
13733                 contents: CResult_TxAddInputDecodeErrorZPtr {
13734                         err: Box::into_raw(Box::new(e)),
13735                 },
13736                 result_ok: false,
13737         }
13738 }
13739 /// Checks if the given object is currently in the success state
13740 #[no_mangle]
13741 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
13742         o.result_ok
13743 }
13744 #[no_mangle]
13745 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
13746 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
13747 impl Drop for CResult_TxAddInputDecodeErrorZ {
13748         fn drop(&mut self) {
13749                 if self.result_ok {
13750                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13751                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13752                         }
13753                 } else {
13754                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13755                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13756                         }
13757                 }
13758         }
13759 }
13760 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
13761         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13762                 let contents = if o.result_ok {
13763                         let result = unsafe { o.contents.result };
13764                         unsafe { o.contents.result = core::ptr::null_mut() };
13765                         CResult_TxAddInputDecodeErrorZPtr { result }
13766                 } else {
13767                         let err = unsafe { o.contents.err };
13768                         unsafe { o.contents.err = core::ptr::null_mut(); }
13769                         CResult_TxAddInputDecodeErrorZPtr { err }
13770                 };
13771                 Self {
13772                         contents,
13773                         result_ok: o.result_ok,
13774                 }
13775         }
13776 }
13777 impl Clone for CResult_TxAddInputDecodeErrorZ {
13778         fn clone(&self) -> Self {
13779                 if self.result_ok {
13780                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
13781                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
13782                         } }
13783                 } else {
13784                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
13785                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13786                         } }
13787                 }
13788         }
13789 }
13790 #[no_mangle]
13791 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
13792 /// but with all dynamically-allocated buffers duplicated in new buffers.
13793 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
13794 #[repr(C)]
13795 /// The contents of CResult_TxAddOutputDecodeErrorZ
13796 pub union CResult_TxAddOutputDecodeErrorZPtr {
13797         /// A pointer to the contents in the success state.
13798         /// Reading from this pointer when `result_ok` is not set is undefined.
13799         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
13800         /// A pointer to the contents in the error state.
13801         /// Reading from this pointer when `result_ok` is set is undefined.
13802         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13803 }
13804 #[repr(C)]
13805 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
13806 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13808 pub struct CResult_TxAddOutputDecodeErrorZ {
13809         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
13810         /// `err` or `result` depending on the state of `result_ok`.
13811         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
13812         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
13813         pub result_ok: bool,
13814 }
13815 #[no_mangle]
13816 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
13817 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
13818         CResult_TxAddOutputDecodeErrorZ {
13819                 contents: CResult_TxAddOutputDecodeErrorZPtr {
13820                         result: Box::into_raw(Box::new(o)),
13821                 },
13822                 result_ok: true,
13823         }
13824 }
13825 #[no_mangle]
13826 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
13827 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
13828         CResult_TxAddOutputDecodeErrorZ {
13829                 contents: CResult_TxAddOutputDecodeErrorZPtr {
13830                         err: Box::into_raw(Box::new(e)),
13831                 },
13832                 result_ok: false,
13833         }
13834 }
13835 /// Checks if the given object is currently in the success state
13836 #[no_mangle]
13837 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
13838         o.result_ok
13839 }
13840 #[no_mangle]
13841 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
13842 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
13843 impl Drop for CResult_TxAddOutputDecodeErrorZ {
13844         fn drop(&mut self) {
13845                 if self.result_ok {
13846                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13847                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13848                         }
13849                 } else {
13850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13852                         }
13853                 }
13854         }
13855 }
13856 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
13857         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13858                 let contents = if o.result_ok {
13859                         let result = unsafe { o.contents.result };
13860                         unsafe { o.contents.result = core::ptr::null_mut() };
13861                         CResult_TxAddOutputDecodeErrorZPtr { result }
13862                 } else {
13863                         let err = unsafe { o.contents.err };
13864                         unsafe { o.contents.err = core::ptr::null_mut(); }
13865                         CResult_TxAddOutputDecodeErrorZPtr { err }
13866                 };
13867                 Self {
13868                         contents,
13869                         result_ok: o.result_ok,
13870                 }
13871         }
13872 }
13873 impl Clone for CResult_TxAddOutputDecodeErrorZ {
13874         fn clone(&self) -> Self {
13875                 if self.result_ok {
13876                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
13877                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
13878                         } }
13879                 } else {
13880                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
13881                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13882                         } }
13883                 }
13884         }
13885 }
13886 #[no_mangle]
13887 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
13888 /// but with all dynamically-allocated buffers duplicated in new buffers.
13889 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
13890 #[repr(C)]
13891 /// The contents of CResult_TxRemoveInputDecodeErrorZ
13892 pub union CResult_TxRemoveInputDecodeErrorZPtr {
13893         /// A pointer to the contents in the success state.
13894         /// Reading from this pointer when `result_ok` is not set is undefined.
13895         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
13896         /// A pointer to the contents in the error state.
13897         /// Reading from this pointer when `result_ok` is set is undefined.
13898         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13899 }
13900 #[repr(C)]
13901 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
13902 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13904 pub struct CResult_TxRemoveInputDecodeErrorZ {
13905         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
13906         /// `err` or `result` depending on the state of `result_ok`.
13907         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
13908         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
13909         pub result_ok: bool,
13910 }
13911 #[no_mangle]
13912 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
13913 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
13914         CResult_TxRemoveInputDecodeErrorZ {
13915                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13916                         result: Box::into_raw(Box::new(o)),
13917                 },
13918                 result_ok: true,
13919         }
13920 }
13921 #[no_mangle]
13922 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
13923 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
13924         CResult_TxRemoveInputDecodeErrorZ {
13925                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13926                         err: Box::into_raw(Box::new(e)),
13927                 },
13928                 result_ok: false,
13929         }
13930 }
13931 /// Checks if the given object is currently in the success state
13932 #[no_mangle]
13933 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
13934         o.result_ok
13935 }
13936 #[no_mangle]
13937 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
13938 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
13939 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
13940         fn drop(&mut self) {
13941                 if self.result_ok {
13942                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13943                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13944                         }
13945                 } else {
13946                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13947                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13948                         }
13949                 }
13950         }
13951 }
13952 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
13953         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13954                 let contents = if o.result_ok {
13955                         let result = unsafe { o.contents.result };
13956                         unsafe { o.contents.result = core::ptr::null_mut() };
13957                         CResult_TxRemoveInputDecodeErrorZPtr { result }
13958                 } else {
13959                         let err = unsafe { o.contents.err };
13960                         unsafe { o.contents.err = core::ptr::null_mut(); }
13961                         CResult_TxRemoveInputDecodeErrorZPtr { err }
13962                 };
13963                 Self {
13964                         contents,
13965                         result_ok: o.result_ok,
13966                 }
13967         }
13968 }
13969 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
13970         fn clone(&self) -> Self {
13971                 if self.result_ok {
13972                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13973                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
13974                         } }
13975                 } else {
13976                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13977                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13978                         } }
13979                 }
13980         }
13981 }
13982 #[no_mangle]
13983 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
13984 /// but with all dynamically-allocated buffers duplicated in new buffers.
13985 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
13986 #[repr(C)]
13987 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
13988 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
13989         /// A pointer to the contents in the success state.
13990         /// Reading from this pointer when `result_ok` is not set is undefined.
13991         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
13992         /// A pointer to the contents in the error state.
13993         /// Reading from this pointer when `result_ok` is set is undefined.
13994         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13995 }
13996 #[repr(C)]
13997 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
13998 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14000 pub struct CResult_TxRemoveOutputDecodeErrorZ {
14001         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
14002         /// `err` or `result` depending on the state of `result_ok`.
14003         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
14004         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
14005         pub result_ok: bool,
14006 }
14007 #[no_mangle]
14008 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
14009 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
14010         CResult_TxRemoveOutputDecodeErrorZ {
14011                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14012                         result: Box::into_raw(Box::new(o)),
14013                 },
14014                 result_ok: true,
14015         }
14016 }
14017 #[no_mangle]
14018 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
14019 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
14020         CResult_TxRemoveOutputDecodeErrorZ {
14021                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14022                         err: Box::into_raw(Box::new(e)),
14023                 },
14024                 result_ok: false,
14025         }
14026 }
14027 /// Checks if the given object is currently in the success state
14028 #[no_mangle]
14029 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
14030         o.result_ok
14031 }
14032 #[no_mangle]
14033 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
14034 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
14035 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
14036         fn drop(&mut self) {
14037                 if self.result_ok {
14038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14040                         }
14041                 } else {
14042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14044                         }
14045                 }
14046         }
14047 }
14048 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
14049         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
14050                 let contents = if o.result_ok {
14051                         let result = unsafe { o.contents.result };
14052                         unsafe { o.contents.result = core::ptr::null_mut() };
14053                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
14054                 } else {
14055                         let err = unsafe { o.contents.err };
14056                         unsafe { o.contents.err = core::ptr::null_mut(); }
14057                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
14058                 };
14059                 Self {
14060                         contents,
14061                         result_ok: o.result_ok,
14062                 }
14063         }
14064 }
14065 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
14066         fn clone(&self) -> Self {
14067                 if self.result_ok {
14068                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14069                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
14070                         } }
14071                 } else {
14072                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14074                         } }
14075                 }
14076         }
14077 }
14078 #[no_mangle]
14079 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
14080 /// but with all dynamically-allocated buffers duplicated in new buffers.
14081 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
14082 #[repr(C)]
14083 /// The contents of CResult_TxCompleteDecodeErrorZ
14084 pub union CResult_TxCompleteDecodeErrorZPtr {
14085         /// A pointer to the contents in the success state.
14086         /// Reading from this pointer when `result_ok` is not set is undefined.
14087         pub result: *mut crate::lightning::ln::msgs::TxComplete,
14088         /// A pointer to the contents in the error state.
14089         /// Reading from this pointer when `result_ok` is set is undefined.
14090         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14091 }
14092 #[repr(C)]
14093 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
14094 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
14095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14096 pub struct CResult_TxCompleteDecodeErrorZ {
14097         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
14098         /// `err` or `result` depending on the state of `result_ok`.
14099         pub contents: CResult_TxCompleteDecodeErrorZPtr,
14100         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
14101         pub result_ok: bool,
14102 }
14103 #[no_mangle]
14104 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
14105 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
14106         CResult_TxCompleteDecodeErrorZ {
14107                 contents: CResult_TxCompleteDecodeErrorZPtr {
14108                         result: Box::into_raw(Box::new(o)),
14109                 },
14110                 result_ok: true,
14111         }
14112 }
14113 #[no_mangle]
14114 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
14115 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
14116         CResult_TxCompleteDecodeErrorZ {
14117                 contents: CResult_TxCompleteDecodeErrorZPtr {
14118                         err: Box::into_raw(Box::new(e)),
14119                 },
14120                 result_ok: false,
14121         }
14122 }
14123 /// Checks if the given object is currently in the success state
14124 #[no_mangle]
14125 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
14126         o.result_ok
14127 }
14128 #[no_mangle]
14129 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
14130 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
14131 impl Drop for CResult_TxCompleteDecodeErrorZ {
14132         fn drop(&mut self) {
14133                 if self.result_ok {
14134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14136                         }
14137                 } else {
14138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14140                         }
14141                 }
14142         }
14143 }
14144 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
14145         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
14146                 let contents = if o.result_ok {
14147                         let result = unsafe { o.contents.result };
14148                         unsafe { o.contents.result = core::ptr::null_mut() };
14149                         CResult_TxCompleteDecodeErrorZPtr { result }
14150                 } else {
14151                         let err = unsafe { o.contents.err };
14152                         unsafe { o.contents.err = core::ptr::null_mut(); }
14153                         CResult_TxCompleteDecodeErrorZPtr { err }
14154                 };
14155                 Self {
14156                         contents,
14157                         result_ok: o.result_ok,
14158                 }
14159         }
14160 }
14161 impl Clone for CResult_TxCompleteDecodeErrorZ {
14162         fn clone(&self) -> Self {
14163                 if self.result_ok {
14164                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
14165                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
14166                         } }
14167                 } else {
14168                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
14169                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14170                         } }
14171                 }
14172         }
14173 }
14174 #[no_mangle]
14175 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
14176 /// but with all dynamically-allocated buffers duplicated in new buffers.
14177 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
14178 #[repr(C)]
14179 /// The contents of CResult_TxSignaturesDecodeErrorZ
14180 pub union CResult_TxSignaturesDecodeErrorZPtr {
14181         /// A pointer to the contents in the success state.
14182         /// Reading from this pointer when `result_ok` is not set is undefined.
14183         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
14184         /// A pointer to the contents in the error state.
14185         /// Reading from this pointer when `result_ok` is set is undefined.
14186         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14187 }
14188 #[repr(C)]
14189 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
14190 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14192 pub struct CResult_TxSignaturesDecodeErrorZ {
14193         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
14194         /// `err` or `result` depending on the state of `result_ok`.
14195         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
14196         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
14197         pub result_ok: bool,
14198 }
14199 #[no_mangle]
14200 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
14201 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
14202         CResult_TxSignaturesDecodeErrorZ {
14203                 contents: CResult_TxSignaturesDecodeErrorZPtr {
14204                         result: Box::into_raw(Box::new(o)),
14205                 },
14206                 result_ok: true,
14207         }
14208 }
14209 #[no_mangle]
14210 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
14211 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
14212         CResult_TxSignaturesDecodeErrorZ {
14213                 contents: CResult_TxSignaturesDecodeErrorZPtr {
14214                         err: Box::into_raw(Box::new(e)),
14215                 },
14216                 result_ok: false,
14217         }
14218 }
14219 /// Checks if the given object is currently in the success state
14220 #[no_mangle]
14221 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
14222         o.result_ok
14223 }
14224 #[no_mangle]
14225 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
14226 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
14227 impl Drop for CResult_TxSignaturesDecodeErrorZ {
14228         fn drop(&mut self) {
14229                 if self.result_ok {
14230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14232                         }
14233                 } else {
14234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14236                         }
14237                 }
14238         }
14239 }
14240 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
14241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14242                 let contents = if o.result_ok {
14243                         let result = unsafe { o.contents.result };
14244                         unsafe { o.contents.result = core::ptr::null_mut() };
14245                         CResult_TxSignaturesDecodeErrorZPtr { result }
14246                 } else {
14247                         let err = unsafe { o.contents.err };
14248                         unsafe { o.contents.err = core::ptr::null_mut(); }
14249                         CResult_TxSignaturesDecodeErrorZPtr { err }
14250                 };
14251                 Self {
14252                         contents,
14253                         result_ok: o.result_ok,
14254                 }
14255         }
14256 }
14257 impl Clone for CResult_TxSignaturesDecodeErrorZ {
14258         fn clone(&self) -> Self {
14259                 if self.result_ok {
14260                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
14261                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
14262                         } }
14263                 } else {
14264                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
14265                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14266                         } }
14267                 }
14268         }
14269 }
14270 #[no_mangle]
14271 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
14272 /// but with all dynamically-allocated buffers duplicated in new buffers.
14273 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
14274 #[repr(C)]
14275 /// The contents of CResult_TxInitRbfDecodeErrorZ
14276 pub union CResult_TxInitRbfDecodeErrorZPtr {
14277         /// A pointer to the contents in the success state.
14278         /// Reading from this pointer when `result_ok` is not set is undefined.
14279         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
14280         /// A pointer to the contents in the error state.
14281         /// Reading from this pointer when `result_ok` is set is undefined.
14282         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14283 }
14284 #[repr(C)]
14285 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
14286 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14288 pub struct CResult_TxInitRbfDecodeErrorZ {
14289         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
14290         /// `err` or `result` depending on the state of `result_ok`.
14291         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
14292         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
14293         pub result_ok: bool,
14294 }
14295 #[no_mangle]
14296 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
14297 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
14298         CResult_TxInitRbfDecodeErrorZ {
14299                 contents: CResult_TxInitRbfDecodeErrorZPtr {
14300                         result: Box::into_raw(Box::new(o)),
14301                 },
14302                 result_ok: true,
14303         }
14304 }
14305 #[no_mangle]
14306 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
14307 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
14308         CResult_TxInitRbfDecodeErrorZ {
14309                 contents: CResult_TxInitRbfDecodeErrorZPtr {
14310                         err: Box::into_raw(Box::new(e)),
14311                 },
14312                 result_ok: false,
14313         }
14314 }
14315 /// Checks if the given object is currently in the success state
14316 #[no_mangle]
14317 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
14318         o.result_ok
14319 }
14320 #[no_mangle]
14321 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
14322 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
14323 impl Drop for CResult_TxInitRbfDecodeErrorZ {
14324         fn drop(&mut self) {
14325                 if self.result_ok {
14326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14328                         }
14329                 } else {
14330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14332                         }
14333                 }
14334         }
14335 }
14336 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
14337         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14338                 let contents = if o.result_ok {
14339                         let result = unsafe { o.contents.result };
14340                         unsafe { o.contents.result = core::ptr::null_mut() };
14341                         CResult_TxInitRbfDecodeErrorZPtr { result }
14342                 } else {
14343                         let err = unsafe { o.contents.err };
14344                         unsafe { o.contents.err = core::ptr::null_mut(); }
14345                         CResult_TxInitRbfDecodeErrorZPtr { err }
14346                 };
14347                 Self {
14348                         contents,
14349                         result_ok: o.result_ok,
14350                 }
14351         }
14352 }
14353 impl Clone for CResult_TxInitRbfDecodeErrorZ {
14354         fn clone(&self) -> Self {
14355                 if self.result_ok {
14356                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
14357                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
14358                         } }
14359                 } else {
14360                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
14361                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14362                         } }
14363                 }
14364         }
14365 }
14366 #[no_mangle]
14367 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
14368 /// but with all dynamically-allocated buffers duplicated in new buffers.
14369 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
14370 #[repr(C)]
14371 /// The contents of CResult_TxAckRbfDecodeErrorZ
14372 pub union CResult_TxAckRbfDecodeErrorZPtr {
14373         /// A pointer to the contents in the success state.
14374         /// Reading from this pointer when `result_ok` is not set is undefined.
14375         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
14376         /// A pointer to the contents in the error state.
14377         /// Reading from this pointer when `result_ok` is set is undefined.
14378         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14379 }
14380 #[repr(C)]
14381 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
14382 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14384 pub struct CResult_TxAckRbfDecodeErrorZ {
14385         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
14386         /// `err` or `result` depending on the state of `result_ok`.
14387         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
14388         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
14389         pub result_ok: bool,
14390 }
14391 #[no_mangle]
14392 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
14393 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
14394         CResult_TxAckRbfDecodeErrorZ {
14395                 contents: CResult_TxAckRbfDecodeErrorZPtr {
14396                         result: Box::into_raw(Box::new(o)),
14397                 },
14398                 result_ok: true,
14399         }
14400 }
14401 #[no_mangle]
14402 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
14403 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
14404         CResult_TxAckRbfDecodeErrorZ {
14405                 contents: CResult_TxAckRbfDecodeErrorZPtr {
14406                         err: Box::into_raw(Box::new(e)),
14407                 },
14408                 result_ok: false,
14409         }
14410 }
14411 /// Checks if the given object is currently in the success state
14412 #[no_mangle]
14413 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
14414         o.result_ok
14415 }
14416 #[no_mangle]
14417 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
14418 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
14419 impl Drop for CResult_TxAckRbfDecodeErrorZ {
14420         fn drop(&mut self) {
14421                 if self.result_ok {
14422                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14423                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14424                         }
14425                 } else {
14426                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14427                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14428                         }
14429                 }
14430         }
14431 }
14432 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
14433         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14434                 let contents = if o.result_ok {
14435                         let result = unsafe { o.contents.result };
14436                         unsafe { o.contents.result = core::ptr::null_mut() };
14437                         CResult_TxAckRbfDecodeErrorZPtr { result }
14438                 } else {
14439                         let err = unsafe { o.contents.err };
14440                         unsafe { o.contents.err = core::ptr::null_mut(); }
14441                         CResult_TxAckRbfDecodeErrorZPtr { err }
14442                 };
14443                 Self {
14444                         contents,
14445                         result_ok: o.result_ok,
14446                 }
14447         }
14448 }
14449 impl Clone for CResult_TxAckRbfDecodeErrorZ {
14450         fn clone(&self) -> Self {
14451                 if self.result_ok {
14452                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
14453                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
14454                         } }
14455                 } else {
14456                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
14457                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14458                         } }
14459                 }
14460         }
14461 }
14462 #[no_mangle]
14463 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
14464 /// but with all dynamically-allocated buffers duplicated in new buffers.
14465 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
14466 #[repr(C)]
14467 /// The contents of CResult_TxAbortDecodeErrorZ
14468 pub union CResult_TxAbortDecodeErrorZPtr {
14469         /// A pointer to the contents in the success state.
14470         /// Reading from this pointer when `result_ok` is not set is undefined.
14471         pub result: *mut crate::lightning::ln::msgs::TxAbort,
14472         /// A pointer to the contents in the error state.
14473         /// Reading from this pointer when `result_ok` is set is undefined.
14474         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14475 }
14476 #[repr(C)]
14477 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
14478 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
14479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14480 pub struct CResult_TxAbortDecodeErrorZ {
14481         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
14482         /// `err` or `result` depending on the state of `result_ok`.
14483         pub contents: CResult_TxAbortDecodeErrorZPtr,
14484         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
14485         pub result_ok: bool,
14486 }
14487 #[no_mangle]
14488 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
14489 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
14490         CResult_TxAbortDecodeErrorZ {
14491                 contents: CResult_TxAbortDecodeErrorZPtr {
14492                         result: Box::into_raw(Box::new(o)),
14493                 },
14494                 result_ok: true,
14495         }
14496 }
14497 #[no_mangle]
14498 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
14499 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
14500         CResult_TxAbortDecodeErrorZ {
14501                 contents: CResult_TxAbortDecodeErrorZPtr {
14502                         err: Box::into_raw(Box::new(e)),
14503                 },
14504                 result_ok: false,
14505         }
14506 }
14507 /// Checks if the given object is currently in the success state
14508 #[no_mangle]
14509 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
14510         o.result_ok
14511 }
14512 #[no_mangle]
14513 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
14514 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
14515 impl Drop for CResult_TxAbortDecodeErrorZ {
14516         fn drop(&mut self) {
14517                 if self.result_ok {
14518                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14519                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14520                         }
14521                 } else {
14522                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14523                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14524                         }
14525                 }
14526         }
14527 }
14528 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
14529         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
14530                 let contents = if o.result_ok {
14531                         let result = unsafe { o.contents.result };
14532                         unsafe { o.contents.result = core::ptr::null_mut() };
14533                         CResult_TxAbortDecodeErrorZPtr { result }
14534                 } else {
14535                         let err = unsafe { o.contents.err };
14536                         unsafe { o.contents.err = core::ptr::null_mut(); }
14537                         CResult_TxAbortDecodeErrorZPtr { err }
14538                 };
14539                 Self {
14540                         contents,
14541                         result_ok: o.result_ok,
14542                 }
14543         }
14544 }
14545 impl Clone for CResult_TxAbortDecodeErrorZ {
14546         fn clone(&self) -> Self {
14547                 if self.result_ok {
14548                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
14549                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
14550                         } }
14551                 } else {
14552                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
14553                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14554                         } }
14555                 }
14556         }
14557 }
14558 #[no_mangle]
14559 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
14560 /// but with all dynamically-allocated buffers duplicated in new buffers.
14561 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
14562 #[repr(C)]
14563 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14564 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14565         /// A pointer to the contents in the success state.
14566         /// Reading from this pointer when `result_ok` is not set is undefined.
14567         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14568         /// A pointer to the contents in the error state.
14569         /// Reading from this pointer when `result_ok` is set is undefined.
14570         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14571 }
14572 #[repr(C)]
14573 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14574 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14576 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14577         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14578         /// `err` or `result` depending on the state of `result_ok`.
14579         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14580         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14581         pub result_ok: bool,
14582 }
14583 #[no_mangle]
14584 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14585 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14586         CResult_AnnouncementSignaturesDecodeErrorZ {
14587                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14588                         result: Box::into_raw(Box::new(o)),
14589                 },
14590                 result_ok: true,
14591         }
14592 }
14593 #[no_mangle]
14594 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14595 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14596         CResult_AnnouncementSignaturesDecodeErrorZ {
14597                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14598                         err: Box::into_raw(Box::new(e)),
14599                 },
14600                 result_ok: false,
14601         }
14602 }
14603 /// Checks if the given object is currently in the success state
14604 #[no_mangle]
14605 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14606         o.result_ok
14607 }
14608 #[no_mangle]
14609 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14610 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14611 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14612         fn drop(&mut self) {
14613                 if self.result_ok {
14614                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14615                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14616                         }
14617                 } else {
14618                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14619                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14620                         }
14621                 }
14622         }
14623 }
14624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14625         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14626                 let contents = if o.result_ok {
14627                         let result = unsafe { o.contents.result };
14628                         unsafe { o.contents.result = core::ptr::null_mut() };
14629                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14630                 } else {
14631                         let err = unsafe { o.contents.err };
14632                         unsafe { o.contents.err = core::ptr::null_mut(); }
14633                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14634                 };
14635                 Self {
14636                         contents,
14637                         result_ok: o.result_ok,
14638                 }
14639         }
14640 }
14641 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14642         fn clone(&self) -> Self {
14643                 if self.result_ok {
14644                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14645                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14646                         } }
14647                 } else {
14648                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14649                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14650                         } }
14651                 }
14652         }
14653 }
14654 #[no_mangle]
14655 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14656 /// but with all dynamically-allocated buffers duplicated in new buffers.
14657 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14658 #[repr(C)]
14659 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14660 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14661         /// A pointer to the contents in the success state.
14662         /// Reading from this pointer when `result_ok` is not set is undefined.
14663         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14664         /// A pointer to the contents in the error state.
14665         /// Reading from this pointer when `result_ok` is set is undefined.
14666         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14667 }
14668 #[repr(C)]
14669 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14670 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14672 pub struct CResult_ChannelReestablishDecodeErrorZ {
14673         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14674         /// `err` or `result` depending on the state of `result_ok`.
14675         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14676         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14677         pub result_ok: bool,
14678 }
14679 #[no_mangle]
14680 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14681 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14682         CResult_ChannelReestablishDecodeErrorZ {
14683                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14684                         result: Box::into_raw(Box::new(o)),
14685                 },
14686                 result_ok: true,
14687         }
14688 }
14689 #[no_mangle]
14690 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14691 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14692         CResult_ChannelReestablishDecodeErrorZ {
14693                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14694                         err: Box::into_raw(Box::new(e)),
14695                 },
14696                 result_ok: false,
14697         }
14698 }
14699 /// Checks if the given object is currently in the success state
14700 #[no_mangle]
14701 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14702         o.result_ok
14703 }
14704 #[no_mangle]
14705 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14706 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14707 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14708         fn drop(&mut self) {
14709                 if self.result_ok {
14710                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14711                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14712                         }
14713                 } else {
14714                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14715                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14716                         }
14717                 }
14718         }
14719 }
14720 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14721         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14722                 let contents = if o.result_ok {
14723                         let result = unsafe { o.contents.result };
14724                         unsafe { o.contents.result = core::ptr::null_mut() };
14725                         CResult_ChannelReestablishDecodeErrorZPtr { result }
14726                 } else {
14727                         let err = unsafe { o.contents.err };
14728                         unsafe { o.contents.err = core::ptr::null_mut(); }
14729                         CResult_ChannelReestablishDecodeErrorZPtr { err }
14730                 };
14731                 Self {
14732                         contents,
14733                         result_ok: o.result_ok,
14734                 }
14735         }
14736 }
14737 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14738         fn clone(&self) -> Self {
14739                 if self.result_ok {
14740                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14741                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14742                         } }
14743                 } else {
14744                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14745                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14746                         } }
14747                 }
14748         }
14749 }
14750 #[no_mangle]
14751 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14752 /// but with all dynamically-allocated buffers duplicated in new buffers.
14753 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14754 #[repr(C)]
14755 /// The contents of CResult_ClosingSignedDecodeErrorZ
14756 pub union CResult_ClosingSignedDecodeErrorZPtr {
14757         /// A pointer to the contents in the success state.
14758         /// Reading from this pointer when `result_ok` is not set is undefined.
14759         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14760         /// A pointer to the contents in the error state.
14761         /// Reading from this pointer when `result_ok` is set is undefined.
14762         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14763 }
14764 #[repr(C)]
14765 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14766 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14768 pub struct CResult_ClosingSignedDecodeErrorZ {
14769         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14770         /// `err` or `result` depending on the state of `result_ok`.
14771         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14772         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14773         pub result_ok: bool,
14774 }
14775 #[no_mangle]
14776 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14777 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14778         CResult_ClosingSignedDecodeErrorZ {
14779                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14780                         result: Box::into_raw(Box::new(o)),
14781                 },
14782                 result_ok: true,
14783         }
14784 }
14785 #[no_mangle]
14786 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14787 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14788         CResult_ClosingSignedDecodeErrorZ {
14789                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14790                         err: Box::into_raw(Box::new(e)),
14791                 },
14792                 result_ok: false,
14793         }
14794 }
14795 /// Checks if the given object is currently in the success state
14796 #[no_mangle]
14797 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14798         o.result_ok
14799 }
14800 #[no_mangle]
14801 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14802 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14803 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14804         fn drop(&mut self) {
14805                 if self.result_ok {
14806                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14807                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14808                         }
14809                 } else {
14810                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14811                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14812                         }
14813                 }
14814         }
14815 }
14816 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14818                 let contents = if o.result_ok {
14819                         let result = unsafe { o.contents.result };
14820                         unsafe { o.contents.result = core::ptr::null_mut() };
14821                         CResult_ClosingSignedDecodeErrorZPtr { result }
14822                 } else {
14823                         let err = unsafe { o.contents.err };
14824                         unsafe { o.contents.err = core::ptr::null_mut(); }
14825                         CResult_ClosingSignedDecodeErrorZPtr { err }
14826                 };
14827                 Self {
14828                         contents,
14829                         result_ok: o.result_ok,
14830                 }
14831         }
14832 }
14833 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14834         fn clone(&self) -> Self {
14835                 if self.result_ok {
14836                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14837                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14838                         } }
14839                 } else {
14840                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14841                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14842                         } }
14843                 }
14844         }
14845 }
14846 #[no_mangle]
14847 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14848 /// but with all dynamically-allocated buffers duplicated in new buffers.
14849 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14850 #[repr(C)]
14851 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14852 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14853         /// A pointer to the contents in the success state.
14854         /// Reading from this pointer when `result_ok` is not set is undefined.
14855         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14856         /// A pointer to the contents in the error state.
14857         /// Reading from this pointer when `result_ok` is set is undefined.
14858         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14859 }
14860 #[repr(C)]
14861 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14862 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14864 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14865         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14866         /// `err` or `result` depending on the state of `result_ok`.
14867         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14868         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14869         pub result_ok: bool,
14870 }
14871 #[no_mangle]
14872 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14873 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14874         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14875                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14876                         result: Box::into_raw(Box::new(o)),
14877                 },
14878                 result_ok: true,
14879         }
14880 }
14881 #[no_mangle]
14882 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14883 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14884         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14885                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14886                         err: Box::into_raw(Box::new(e)),
14887                 },
14888                 result_ok: false,
14889         }
14890 }
14891 /// Checks if the given object is currently in the success state
14892 #[no_mangle]
14893 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14894         o.result_ok
14895 }
14896 #[no_mangle]
14897 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14898 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14899 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14900         fn drop(&mut self) {
14901                 if self.result_ok {
14902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14904                         }
14905                 } else {
14906                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14907                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14908                         }
14909                 }
14910         }
14911 }
14912 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14913         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14914                 let contents = if o.result_ok {
14915                         let result = unsafe { o.contents.result };
14916                         unsafe { o.contents.result = core::ptr::null_mut() };
14917                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14918                 } else {
14919                         let err = unsafe { o.contents.err };
14920                         unsafe { o.contents.err = core::ptr::null_mut(); }
14921                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14922                 };
14923                 Self {
14924                         contents,
14925                         result_ok: o.result_ok,
14926                 }
14927         }
14928 }
14929 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14930         fn clone(&self) -> Self {
14931                 if self.result_ok {
14932                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14933                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14934                         } }
14935                 } else {
14936                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14937                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14938                         } }
14939                 }
14940         }
14941 }
14942 #[no_mangle]
14943 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14944 /// but with all dynamically-allocated buffers duplicated in new buffers.
14945 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14946 #[repr(C)]
14947 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14948 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14949         /// A pointer to the contents in the success state.
14950         /// Reading from this pointer when `result_ok` is not set is undefined.
14951         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14952         /// A pointer to the contents in the error state.
14953         /// Reading from this pointer when `result_ok` is set is undefined.
14954         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14955 }
14956 #[repr(C)]
14957 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14958 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14960 pub struct CResult_CommitmentSignedDecodeErrorZ {
14961         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14962         /// `err` or `result` depending on the state of `result_ok`.
14963         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14964         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14965         pub result_ok: bool,
14966 }
14967 #[no_mangle]
14968 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14969 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14970         CResult_CommitmentSignedDecodeErrorZ {
14971                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14972                         result: Box::into_raw(Box::new(o)),
14973                 },
14974                 result_ok: true,
14975         }
14976 }
14977 #[no_mangle]
14978 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14979 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14980         CResult_CommitmentSignedDecodeErrorZ {
14981                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14982                         err: Box::into_raw(Box::new(e)),
14983                 },
14984                 result_ok: false,
14985         }
14986 }
14987 /// Checks if the given object is currently in the success state
14988 #[no_mangle]
14989 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14990         o.result_ok
14991 }
14992 #[no_mangle]
14993 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14994 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14995 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14996         fn drop(&mut self) {
14997                 if self.result_ok {
14998                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14999                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15000                         }
15001                 } else {
15002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15004                         }
15005                 }
15006         }
15007 }
15008 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15009         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15010                 let contents = if o.result_ok {
15011                         let result = unsafe { o.contents.result };
15012                         unsafe { o.contents.result = core::ptr::null_mut() };
15013                         CResult_CommitmentSignedDecodeErrorZPtr { result }
15014                 } else {
15015                         let err = unsafe { o.contents.err };
15016                         unsafe { o.contents.err = core::ptr::null_mut(); }
15017                         CResult_CommitmentSignedDecodeErrorZPtr { err }
15018                 };
15019                 Self {
15020                         contents,
15021                         result_ok: o.result_ok,
15022                 }
15023         }
15024 }
15025 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15026         fn clone(&self) -> Self {
15027                 if self.result_ok {
15028                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15029                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15030                         } }
15031                 } else {
15032                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15033                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15034                         } }
15035                 }
15036         }
15037 }
15038 #[no_mangle]
15039 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15040 /// but with all dynamically-allocated buffers duplicated in new buffers.
15041 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15042 #[repr(C)]
15043 /// The contents of CResult_FundingCreatedDecodeErrorZ
15044 pub union CResult_FundingCreatedDecodeErrorZPtr {
15045         /// A pointer to the contents in the success state.
15046         /// Reading from this pointer when `result_ok` is not set is undefined.
15047         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15048         /// A pointer to the contents in the error state.
15049         /// Reading from this pointer when `result_ok` is set is undefined.
15050         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15051 }
15052 #[repr(C)]
15053 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15054 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15056 pub struct CResult_FundingCreatedDecodeErrorZ {
15057         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15058         /// `err` or `result` depending on the state of `result_ok`.
15059         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15060         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15061         pub result_ok: bool,
15062 }
15063 #[no_mangle]
15064 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15065 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15066         CResult_FundingCreatedDecodeErrorZ {
15067                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15068                         result: Box::into_raw(Box::new(o)),
15069                 },
15070                 result_ok: true,
15071         }
15072 }
15073 #[no_mangle]
15074 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15075 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15076         CResult_FundingCreatedDecodeErrorZ {
15077                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15078                         err: Box::into_raw(Box::new(e)),
15079                 },
15080                 result_ok: false,
15081         }
15082 }
15083 /// Checks if the given object is currently in the success state
15084 #[no_mangle]
15085 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15086         o.result_ok
15087 }
15088 #[no_mangle]
15089 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15090 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15091 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15092         fn drop(&mut self) {
15093                 if self.result_ok {
15094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15096                         }
15097                 } else {
15098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15100                         }
15101                 }
15102         }
15103 }
15104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15106                 let contents = if o.result_ok {
15107                         let result = unsafe { o.contents.result };
15108                         unsafe { o.contents.result = core::ptr::null_mut() };
15109                         CResult_FundingCreatedDecodeErrorZPtr { result }
15110                 } else {
15111                         let err = unsafe { o.contents.err };
15112                         unsafe { o.contents.err = core::ptr::null_mut(); }
15113                         CResult_FundingCreatedDecodeErrorZPtr { err }
15114                 };
15115                 Self {
15116                         contents,
15117                         result_ok: o.result_ok,
15118                 }
15119         }
15120 }
15121 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15122         fn clone(&self) -> Self {
15123                 if self.result_ok {
15124                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15125                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15126                         } }
15127                 } else {
15128                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15130                         } }
15131                 }
15132         }
15133 }
15134 #[no_mangle]
15135 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15136 /// but with all dynamically-allocated buffers duplicated in new buffers.
15137 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15138 #[repr(C)]
15139 /// The contents of CResult_FundingSignedDecodeErrorZ
15140 pub union CResult_FundingSignedDecodeErrorZPtr {
15141         /// A pointer to the contents in the success state.
15142         /// Reading from this pointer when `result_ok` is not set is undefined.
15143         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15144         /// A pointer to the contents in the error state.
15145         /// Reading from this pointer when `result_ok` is set is undefined.
15146         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15147 }
15148 #[repr(C)]
15149 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15150 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15152 pub struct CResult_FundingSignedDecodeErrorZ {
15153         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15154         /// `err` or `result` depending on the state of `result_ok`.
15155         pub contents: CResult_FundingSignedDecodeErrorZPtr,
15156         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15157         pub result_ok: bool,
15158 }
15159 #[no_mangle]
15160 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15161 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15162         CResult_FundingSignedDecodeErrorZ {
15163                 contents: CResult_FundingSignedDecodeErrorZPtr {
15164                         result: Box::into_raw(Box::new(o)),
15165                 },
15166                 result_ok: true,
15167         }
15168 }
15169 #[no_mangle]
15170 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15171 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15172         CResult_FundingSignedDecodeErrorZ {
15173                 contents: CResult_FundingSignedDecodeErrorZPtr {
15174                         err: Box::into_raw(Box::new(e)),
15175                 },
15176                 result_ok: false,
15177         }
15178 }
15179 /// Checks if the given object is currently in the success state
15180 #[no_mangle]
15181 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15182         o.result_ok
15183 }
15184 #[no_mangle]
15185 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15186 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15187 impl Drop for CResult_FundingSignedDecodeErrorZ {
15188         fn drop(&mut self) {
15189                 if self.result_ok {
15190                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15191                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15192                         }
15193                 } else {
15194                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15195                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15196                         }
15197                 }
15198         }
15199 }
15200 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15201         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15202                 let contents = if o.result_ok {
15203                         let result = unsafe { o.contents.result };
15204                         unsafe { o.contents.result = core::ptr::null_mut() };
15205                         CResult_FundingSignedDecodeErrorZPtr { result }
15206                 } else {
15207                         let err = unsafe { o.contents.err };
15208                         unsafe { o.contents.err = core::ptr::null_mut(); }
15209                         CResult_FundingSignedDecodeErrorZPtr { err }
15210                 };
15211                 Self {
15212                         contents,
15213                         result_ok: o.result_ok,
15214                 }
15215         }
15216 }
15217 impl Clone for CResult_FundingSignedDecodeErrorZ {
15218         fn clone(&self) -> Self {
15219                 if self.result_ok {
15220                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15221                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15222                         } }
15223                 } else {
15224                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15225                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15226                         } }
15227                 }
15228         }
15229 }
15230 #[no_mangle]
15231 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15232 /// but with all dynamically-allocated buffers duplicated in new buffers.
15233 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15234 #[repr(C)]
15235 /// The contents of CResult_ChannelReadyDecodeErrorZ
15236 pub union CResult_ChannelReadyDecodeErrorZPtr {
15237         /// A pointer to the contents in the success state.
15238         /// Reading from this pointer when `result_ok` is not set is undefined.
15239         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15240         /// A pointer to the contents in the error state.
15241         /// Reading from this pointer when `result_ok` is set is undefined.
15242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15243 }
15244 #[repr(C)]
15245 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15246 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15248 pub struct CResult_ChannelReadyDecodeErrorZ {
15249         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15250         /// `err` or `result` depending on the state of `result_ok`.
15251         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15252         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15253         pub result_ok: bool,
15254 }
15255 #[no_mangle]
15256 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15257 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15258         CResult_ChannelReadyDecodeErrorZ {
15259                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15260                         result: Box::into_raw(Box::new(o)),
15261                 },
15262                 result_ok: true,
15263         }
15264 }
15265 #[no_mangle]
15266 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15267 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15268         CResult_ChannelReadyDecodeErrorZ {
15269                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15270                         err: Box::into_raw(Box::new(e)),
15271                 },
15272                 result_ok: false,
15273         }
15274 }
15275 /// Checks if the given object is currently in the success state
15276 #[no_mangle]
15277 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15278         o.result_ok
15279 }
15280 #[no_mangle]
15281 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15282 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15283 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15284         fn drop(&mut self) {
15285                 if self.result_ok {
15286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15288                         }
15289                 } else {
15290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15292                         }
15293                 }
15294         }
15295 }
15296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15298                 let contents = if o.result_ok {
15299                         let result = unsafe { o.contents.result };
15300                         unsafe { o.contents.result = core::ptr::null_mut() };
15301                         CResult_ChannelReadyDecodeErrorZPtr { result }
15302                 } else {
15303                         let err = unsafe { o.contents.err };
15304                         unsafe { o.contents.err = core::ptr::null_mut(); }
15305                         CResult_ChannelReadyDecodeErrorZPtr { err }
15306                 };
15307                 Self {
15308                         contents,
15309                         result_ok: o.result_ok,
15310                 }
15311         }
15312 }
15313 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15314         fn clone(&self) -> Self {
15315                 if self.result_ok {
15316                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15317                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15318                         } }
15319                 } else {
15320                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15322                         } }
15323                 }
15324         }
15325 }
15326 #[no_mangle]
15327 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15328 /// but with all dynamically-allocated buffers duplicated in new buffers.
15329 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15330 #[repr(C)]
15331 /// The contents of CResult_InitDecodeErrorZ
15332 pub union CResult_InitDecodeErrorZPtr {
15333         /// A pointer to the contents in the success state.
15334         /// Reading from this pointer when `result_ok` is not set is undefined.
15335         pub result: *mut crate::lightning::ln::msgs::Init,
15336         /// A pointer to the contents in the error state.
15337         /// Reading from this pointer when `result_ok` is set is undefined.
15338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15339 }
15340 #[repr(C)]
15341 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15342 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15344 pub struct CResult_InitDecodeErrorZ {
15345         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15346         /// `err` or `result` depending on the state of `result_ok`.
15347         pub contents: CResult_InitDecodeErrorZPtr,
15348         /// Whether this CResult_InitDecodeErrorZ represents a success state.
15349         pub result_ok: bool,
15350 }
15351 #[no_mangle]
15352 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15353 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15354         CResult_InitDecodeErrorZ {
15355                 contents: CResult_InitDecodeErrorZPtr {
15356                         result: Box::into_raw(Box::new(o)),
15357                 },
15358                 result_ok: true,
15359         }
15360 }
15361 #[no_mangle]
15362 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15363 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15364         CResult_InitDecodeErrorZ {
15365                 contents: CResult_InitDecodeErrorZPtr {
15366                         err: Box::into_raw(Box::new(e)),
15367                 },
15368                 result_ok: false,
15369         }
15370 }
15371 /// Checks if the given object is currently in the success state
15372 #[no_mangle]
15373 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15374         o.result_ok
15375 }
15376 #[no_mangle]
15377 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15378 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15379 impl Drop for CResult_InitDecodeErrorZ {
15380         fn drop(&mut self) {
15381                 if self.result_ok {
15382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15384                         }
15385                 } else {
15386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15388                         }
15389                 }
15390         }
15391 }
15392 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15393         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15394                 let contents = if o.result_ok {
15395                         let result = unsafe { o.contents.result };
15396                         unsafe { o.contents.result = core::ptr::null_mut() };
15397                         CResult_InitDecodeErrorZPtr { result }
15398                 } else {
15399                         let err = unsafe { o.contents.err };
15400                         unsafe { o.contents.err = core::ptr::null_mut(); }
15401                         CResult_InitDecodeErrorZPtr { err }
15402                 };
15403                 Self {
15404                         contents,
15405                         result_ok: o.result_ok,
15406                 }
15407         }
15408 }
15409 impl Clone for CResult_InitDecodeErrorZ {
15410         fn clone(&self) -> Self {
15411                 if self.result_ok {
15412                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15413                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15414                         } }
15415                 } else {
15416                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15417                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15418                         } }
15419                 }
15420         }
15421 }
15422 #[no_mangle]
15423 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15424 /// but with all dynamically-allocated buffers duplicated in new buffers.
15425 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15426 #[repr(C)]
15427 /// The contents of CResult_OpenChannelDecodeErrorZ
15428 pub union CResult_OpenChannelDecodeErrorZPtr {
15429         /// A pointer to the contents in the success state.
15430         /// Reading from this pointer when `result_ok` is not set is undefined.
15431         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15432         /// A pointer to the contents in the error state.
15433         /// Reading from this pointer when `result_ok` is set is undefined.
15434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15435 }
15436 #[repr(C)]
15437 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15438 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15440 pub struct CResult_OpenChannelDecodeErrorZ {
15441         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15442         /// `err` or `result` depending on the state of `result_ok`.
15443         pub contents: CResult_OpenChannelDecodeErrorZPtr,
15444         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15445         pub result_ok: bool,
15446 }
15447 #[no_mangle]
15448 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15449 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15450         CResult_OpenChannelDecodeErrorZ {
15451                 contents: CResult_OpenChannelDecodeErrorZPtr {
15452                         result: Box::into_raw(Box::new(o)),
15453                 },
15454                 result_ok: true,
15455         }
15456 }
15457 #[no_mangle]
15458 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15459 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15460         CResult_OpenChannelDecodeErrorZ {
15461                 contents: CResult_OpenChannelDecodeErrorZPtr {
15462                         err: Box::into_raw(Box::new(e)),
15463                 },
15464                 result_ok: false,
15465         }
15466 }
15467 /// Checks if the given object is currently in the success state
15468 #[no_mangle]
15469 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15470         o.result_ok
15471 }
15472 #[no_mangle]
15473 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15474 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15475 impl Drop for CResult_OpenChannelDecodeErrorZ {
15476         fn drop(&mut self) {
15477                 if self.result_ok {
15478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15480                         }
15481                 } else {
15482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15484                         }
15485                 }
15486         }
15487 }
15488 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15489         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15490                 let contents = if o.result_ok {
15491                         let result = unsafe { o.contents.result };
15492                         unsafe { o.contents.result = core::ptr::null_mut() };
15493                         CResult_OpenChannelDecodeErrorZPtr { result }
15494                 } else {
15495                         let err = unsafe { o.contents.err };
15496                         unsafe { o.contents.err = core::ptr::null_mut(); }
15497                         CResult_OpenChannelDecodeErrorZPtr { err }
15498                 };
15499                 Self {
15500                         contents,
15501                         result_ok: o.result_ok,
15502                 }
15503         }
15504 }
15505 impl Clone for CResult_OpenChannelDecodeErrorZ {
15506         fn clone(&self) -> Self {
15507                 if self.result_ok {
15508                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15509                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15510                         } }
15511                 } else {
15512                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15513                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15514                         } }
15515                 }
15516         }
15517 }
15518 #[no_mangle]
15519 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15520 /// but with all dynamically-allocated buffers duplicated in new buffers.
15521 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15522 #[repr(C)]
15523 /// The contents of CResult_OpenChannelV2DecodeErrorZ
15524 pub union CResult_OpenChannelV2DecodeErrorZPtr {
15525         /// A pointer to the contents in the success state.
15526         /// Reading from this pointer when `result_ok` is not set is undefined.
15527         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
15528         /// A pointer to the contents in the error state.
15529         /// Reading from this pointer when `result_ok` is set is undefined.
15530         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15531 }
15532 #[repr(C)]
15533 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
15534 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15535 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15536 pub struct CResult_OpenChannelV2DecodeErrorZ {
15537         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
15538         /// `err` or `result` depending on the state of `result_ok`.
15539         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
15540         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
15541         pub result_ok: bool,
15542 }
15543 #[no_mangle]
15544 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
15545 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
15546         CResult_OpenChannelV2DecodeErrorZ {
15547                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15548                         result: Box::into_raw(Box::new(o)),
15549                 },
15550                 result_ok: true,
15551         }
15552 }
15553 #[no_mangle]
15554 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
15555 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
15556         CResult_OpenChannelV2DecodeErrorZ {
15557                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15558                         err: Box::into_raw(Box::new(e)),
15559                 },
15560                 result_ok: false,
15561         }
15562 }
15563 /// Checks if the given object is currently in the success state
15564 #[no_mangle]
15565 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
15566         o.result_ok
15567 }
15568 #[no_mangle]
15569 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
15570 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
15571 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
15572         fn drop(&mut self) {
15573                 if self.result_ok {
15574                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15575                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15576                         }
15577                 } else {
15578                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15579                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15580                         }
15581                 }
15582         }
15583 }
15584 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
15585         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15586                 let contents = if o.result_ok {
15587                         let result = unsafe { o.contents.result };
15588                         unsafe { o.contents.result = core::ptr::null_mut() };
15589                         CResult_OpenChannelV2DecodeErrorZPtr { result }
15590                 } else {
15591                         let err = unsafe { o.contents.err };
15592                         unsafe { o.contents.err = core::ptr::null_mut(); }
15593                         CResult_OpenChannelV2DecodeErrorZPtr { err }
15594                 };
15595                 Self {
15596                         contents,
15597                         result_ok: o.result_ok,
15598                 }
15599         }
15600 }
15601 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
15602         fn clone(&self) -> Self {
15603                 if self.result_ok {
15604                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15605                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
15606                         } }
15607                 } else {
15608                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15609                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15610                         } }
15611                 }
15612         }
15613 }
15614 #[no_mangle]
15615 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
15616 /// but with all dynamically-allocated buffers duplicated in new buffers.
15617 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
15618 #[repr(C)]
15619 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15620 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15621         /// A pointer to the contents in the success state.
15622         /// Reading from this pointer when `result_ok` is not set is undefined.
15623         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15624         /// A pointer to the contents in the error state.
15625         /// Reading from this pointer when `result_ok` is set is undefined.
15626         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15627 }
15628 #[repr(C)]
15629 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15630 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15631 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15632 pub struct CResult_RevokeAndACKDecodeErrorZ {
15633         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15634         /// `err` or `result` depending on the state of `result_ok`.
15635         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15636         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15637         pub result_ok: bool,
15638 }
15639 #[no_mangle]
15640 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15642         CResult_RevokeAndACKDecodeErrorZ {
15643                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15644                         result: Box::into_raw(Box::new(o)),
15645                 },
15646                 result_ok: true,
15647         }
15648 }
15649 #[no_mangle]
15650 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15651 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15652         CResult_RevokeAndACKDecodeErrorZ {
15653                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15654                         err: Box::into_raw(Box::new(e)),
15655                 },
15656                 result_ok: false,
15657         }
15658 }
15659 /// Checks if the given object is currently in the success state
15660 #[no_mangle]
15661 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15662         o.result_ok
15663 }
15664 #[no_mangle]
15665 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15666 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15667 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15668         fn drop(&mut self) {
15669                 if self.result_ok {
15670                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15671                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15672                         }
15673                 } else {
15674                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15675                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15676                         }
15677                 }
15678         }
15679 }
15680 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15681         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15682                 let contents = if o.result_ok {
15683                         let result = unsafe { o.contents.result };
15684                         unsafe { o.contents.result = core::ptr::null_mut() };
15685                         CResult_RevokeAndACKDecodeErrorZPtr { result }
15686                 } else {
15687                         let err = unsafe { o.contents.err };
15688                         unsafe { o.contents.err = core::ptr::null_mut(); }
15689                         CResult_RevokeAndACKDecodeErrorZPtr { err }
15690                 };
15691                 Self {
15692                         contents,
15693                         result_ok: o.result_ok,
15694                 }
15695         }
15696 }
15697 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15698         fn clone(&self) -> Self {
15699                 if self.result_ok {
15700                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15701                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15702                         } }
15703                 } else {
15704                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15705                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15706                         } }
15707                 }
15708         }
15709 }
15710 #[no_mangle]
15711 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15712 /// but with all dynamically-allocated buffers duplicated in new buffers.
15713 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15714 #[repr(C)]
15715 /// The contents of CResult_ShutdownDecodeErrorZ
15716 pub union CResult_ShutdownDecodeErrorZPtr {
15717         /// A pointer to the contents in the success state.
15718         /// Reading from this pointer when `result_ok` is not set is undefined.
15719         pub result: *mut crate::lightning::ln::msgs::Shutdown,
15720         /// A pointer to the contents in the error state.
15721         /// Reading from this pointer when `result_ok` is set is undefined.
15722         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15723 }
15724 #[repr(C)]
15725 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15726 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15727 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15728 pub struct CResult_ShutdownDecodeErrorZ {
15729         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15730         /// `err` or `result` depending on the state of `result_ok`.
15731         pub contents: CResult_ShutdownDecodeErrorZPtr,
15732         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15733         pub result_ok: bool,
15734 }
15735 #[no_mangle]
15736 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15738         CResult_ShutdownDecodeErrorZ {
15739                 contents: CResult_ShutdownDecodeErrorZPtr {
15740                         result: Box::into_raw(Box::new(o)),
15741                 },
15742                 result_ok: true,
15743         }
15744 }
15745 #[no_mangle]
15746 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15747 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15748         CResult_ShutdownDecodeErrorZ {
15749                 contents: CResult_ShutdownDecodeErrorZPtr {
15750                         err: Box::into_raw(Box::new(e)),
15751                 },
15752                 result_ok: false,
15753         }
15754 }
15755 /// Checks if the given object is currently in the success state
15756 #[no_mangle]
15757 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15758         o.result_ok
15759 }
15760 #[no_mangle]
15761 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15762 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15763 impl Drop for CResult_ShutdownDecodeErrorZ {
15764         fn drop(&mut self) {
15765                 if self.result_ok {
15766                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15767                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15768                         }
15769                 } else {
15770                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15771                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15772                         }
15773                 }
15774         }
15775 }
15776 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15777         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15778                 let contents = if o.result_ok {
15779                         let result = unsafe { o.contents.result };
15780                         unsafe { o.contents.result = core::ptr::null_mut() };
15781                         CResult_ShutdownDecodeErrorZPtr { result }
15782                 } else {
15783                         let err = unsafe { o.contents.err };
15784                         unsafe { o.contents.err = core::ptr::null_mut(); }
15785                         CResult_ShutdownDecodeErrorZPtr { err }
15786                 };
15787                 Self {
15788                         contents,
15789                         result_ok: o.result_ok,
15790                 }
15791         }
15792 }
15793 impl Clone for CResult_ShutdownDecodeErrorZ {
15794         fn clone(&self) -> Self {
15795                 if self.result_ok {
15796                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15797                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15798                         } }
15799                 } else {
15800                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15801                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15802                         } }
15803                 }
15804         }
15805 }
15806 #[no_mangle]
15807 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15808 /// but with all dynamically-allocated buffers duplicated in new buffers.
15809 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15810 #[repr(C)]
15811 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15812 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15813         /// A pointer to the contents in the success state.
15814         /// Reading from this pointer when `result_ok` is not set is undefined.
15815         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15816         /// A pointer to the contents in the error state.
15817         /// Reading from this pointer when `result_ok` is set is undefined.
15818         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15819 }
15820 #[repr(C)]
15821 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15822 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15823 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15824 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15825         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15826         /// `err` or `result` depending on the state of `result_ok`.
15827         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15828         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15829         pub result_ok: bool,
15830 }
15831 #[no_mangle]
15832 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15834         CResult_UpdateFailHTLCDecodeErrorZ {
15835                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15836                         result: Box::into_raw(Box::new(o)),
15837                 },
15838                 result_ok: true,
15839         }
15840 }
15841 #[no_mangle]
15842 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15843 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15844         CResult_UpdateFailHTLCDecodeErrorZ {
15845                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15846                         err: Box::into_raw(Box::new(e)),
15847                 },
15848                 result_ok: false,
15849         }
15850 }
15851 /// Checks if the given object is currently in the success state
15852 #[no_mangle]
15853 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15854         o.result_ok
15855 }
15856 #[no_mangle]
15857 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15858 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15859 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15860         fn drop(&mut self) {
15861                 if self.result_ok {
15862                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15863                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15864                         }
15865                 } else {
15866                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15867                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15868                         }
15869                 }
15870         }
15871 }
15872 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15873         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15874                 let contents = if o.result_ok {
15875                         let result = unsafe { o.contents.result };
15876                         unsafe { o.contents.result = core::ptr::null_mut() };
15877                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15878                 } else {
15879                         let err = unsafe { o.contents.err };
15880                         unsafe { o.contents.err = core::ptr::null_mut(); }
15881                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15882                 };
15883                 Self {
15884                         contents,
15885                         result_ok: o.result_ok,
15886                 }
15887         }
15888 }
15889 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15890         fn clone(&self) -> Self {
15891                 if self.result_ok {
15892                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15893                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15894                         } }
15895                 } else {
15896                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15897                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15898                         } }
15899                 }
15900         }
15901 }
15902 #[no_mangle]
15903 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15904 /// but with all dynamically-allocated buffers duplicated in new buffers.
15905 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15906 #[repr(C)]
15907 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15908 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15909         /// A pointer to the contents in the success state.
15910         /// Reading from this pointer when `result_ok` is not set is undefined.
15911         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15912         /// A pointer to the contents in the error state.
15913         /// Reading from this pointer when `result_ok` is set is undefined.
15914         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15915 }
15916 #[repr(C)]
15917 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15918 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15919 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15920 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15921         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15922         /// `err` or `result` depending on the state of `result_ok`.
15923         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15924         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15925         pub result_ok: bool,
15926 }
15927 #[no_mangle]
15928 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15930         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15931                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15932                         result: Box::into_raw(Box::new(o)),
15933                 },
15934                 result_ok: true,
15935         }
15936 }
15937 #[no_mangle]
15938 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15939 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15940         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15941                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15942                         err: Box::into_raw(Box::new(e)),
15943                 },
15944                 result_ok: false,
15945         }
15946 }
15947 /// Checks if the given object is currently in the success state
15948 #[no_mangle]
15949 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15950         o.result_ok
15951 }
15952 #[no_mangle]
15953 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15954 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15955 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15956         fn drop(&mut self) {
15957                 if self.result_ok {
15958                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15959                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15960                         }
15961                 } else {
15962                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15963                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15964                         }
15965                 }
15966         }
15967 }
15968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15969         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15970                 let contents = if o.result_ok {
15971                         let result = unsafe { o.contents.result };
15972                         unsafe { o.contents.result = core::ptr::null_mut() };
15973                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15974                 } else {
15975                         let err = unsafe { o.contents.err };
15976                         unsafe { o.contents.err = core::ptr::null_mut(); }
15977                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15978                 };
15979                 Self {
15980                         contents,
15981                         result_ok: o.result_ok,
15982                 }
15983         }
15984 }
15985 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15986         fn clone(&self) -> Self {
15987                 if self.result_ok {
15988                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15989                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15990                         } }
15991                 } else {
15992                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15993                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15994                         } }
15995                 }
15996         }
15997 }
15998 #[no_mangle]
15999 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16000 /// but with all dynamically-allocated buffers duplicated in new buffers.
16001 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
16002 #[repr(C)]
16003 /// The contents of CResult_UpdateFeeDecodeErrorZ
16004 pub union CResult_UpdateFeeDecodeErrorZPtr {
16005         /// A pointer to the contents in the success state.
16006         /// Reading from this pointer when `result_ok` is not set is undefined.
16007         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
16008         /// A pointer to the contents in the error state.
16009         /// Reading from this pointer when `result_ok` is set is undefined.
16010         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16011 }
16012 #[repr(C)]
16013 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
16014 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
16015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16016 pub struct CResult_UpdateFeeDecodeErrorZ {
16017         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
16018         /// `err` or `result` depending on the state of `result_ok`.
16019         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
16020         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
16021         pub result_ok: bool,
16022 }
16023 #[no_mangle]
16024 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16026         CResult_UpdateFeeDecodeErrorZ {
16027                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16028                         result: Box::into_raw(Box::new(o)),
16029                 },
16030                 result_ok: true,
16031         }
16032 }
16033 #[no_mangle]
16034 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16035 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16036         CResult_UpdateFeeDecodeErrorZ {
16037                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16038                         err: Box::into_raw(Box::new(e)),
16039                 },
16040                 result_ok: false,
16041         }
16042 }
16043 /// Checks if the given object is currently in the success state
16044 #[no_mangle]
16045 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16046         o.result_ok
16047 }
16048 #[no_mangle]
16049 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16050 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16051 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16052         fn drop(&mut self) {
16053                 if self.result_ok {
16054                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16055                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16056                         }
16057                 } else {
16058                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16059                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16060                         }
16061                 }
16062         }
16063 }
16064 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16065         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16066                 let contents = if o.result_ok {
16067                         let result = unsafe { o.contents.result };
16068                         unsafe { o.contents.result = core::ptr::null_mut() };
16069                         CResult_UpdateFeeDecodeErrorZPtr { result }
16070                 } else {
16071                         let err = unsafe { o.contents.err };
16072                         unsafe { o.contents.err = core::ptr::null_mut(); }
16073                         CResult_UpdateFeeDecodeErrorZPtr { err }
16074                 };
16075                 Self {
16076                         contents,
16077                         result_ok: o.result_ok,
16078                 }
16079         }
16080 }
16081 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16082         fn clone(&self) -> Self {
16083                 if self.result_ok {
16084                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16085                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16086                         } }
16087                 } else {
16088                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16089                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16090                         } }
16091                 }
16092         }
16093 }
16094 #[no_mangle]
16095 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16096 /// but with all dynamically-allocated buffers duplicated in new buffers.
16097 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16098 #[repr(C)]
16099 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16100 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16101         /// A pointer to the contents in the success state.
16102         /// Reading from this pointer when `result_ok` is not set is undefined.
16103         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16104         /// A pointer to the contents in the error state.
16105         /// Reading from this pointer when `result_ok` is set is undefined.
16106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16107 }
16108 #[repr(C)]
16109 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16110 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16112 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16113         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16114         /// `err` or `result` depending on the state of `result_ok`.
16115         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16116         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16117         pub result_ok: bool,
16118 }
16119 #[no_mangle]
16120 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16122         CResult_UpdateFulfillHTLCDecodeErrorZ {
16123                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16124                         result: Box::into_raw(Box::new(o)),
16125                 },
16126                 result_ok: true,
16127         }
16128 }
16129 #[no_mangle]
16130 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16131 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16132         CResult_UpdateFulfillHTLCDecodeErrorZ {
16133                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16134                         err: Box::into_raw(Box::new(e)),
16135                 },
16136                 result_ok: false,
16137         }
16138 }
16139 /// Checks if the given object is currently in the success state
16140 #[no_mangle]
16141 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16142         o.result_ok
16143 }
16144 #[no_mangle]
16145 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16146 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16147 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16148         fn drop(&mut self) {
16149                 if self.result_ok {
16150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16152                         }
16153                 } else {
16154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16156                         }
16157                 }
16158         }
16159 }
16160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16162                 let contents = if o.result_ok {
16163                         let result = unsafe { o.contents.result };
16164                         unsafe { o.contents.result = core::ptr::null_mut() };
16165                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16166                 } else {
16167                         let err = unsafe { o.contents.err };
16168                         unsafe { o.contents.err = core::ptr::null_mut(); }
16169                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16170                 };
16171                 Self {
16172                         contents,
16173                         result_ok: o.result_ok,
16174                 }
16175         }
16176 }
16177 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16178         fn clone(&self) -> Self {
16179                 if self.result_ok {
16180                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16182                         } }
16183                 } else {
16184                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16186                         } }
16187                 }
16188         }
16189 }
16190 #[no_mangle]
16191 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16192 /// but with all dynamically-allocated buffers duplicated in new buffers.
16193 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16194 #[repr(C)]
16195 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16196 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16197         /// A pointer to the contents in the success state.
16198         /// Reading from this pointer when `result_ok` is not set is undefined.
16199         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16200         /// A pointer to the contents in the error state.
16201         /// Reading from this pointer when `result_ok` is set is undefined.
16202         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16203 }
16204 #[repr(C)]
16205 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16206 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16208 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16209         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16210         /// `err` or `result` depending on the state of `result_ok`.
16211         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16212         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16213         pub result_ok: bool,
16214 }
16215 #[no_mangle]
16216 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16218         CResult_UpdateAddHTLCDecodeErrorZ {
16219                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16220                         result: Box::into_raw(Box::new(o)),
16221                 },
16222                 result_ok: true,
16223         }
16224 }
16225 #[no_mangle]
16226 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16227 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16228         CResult_UpdateAddHTLCDecodeErrorZ {
16229                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16230                         err: Box::into_raw(Box::new(e)),
16231                 },
16232                 result_ok: false,
16233         }
16234 }
16235 /// Checks if the given object is currently in the success state
16236 #[no_mangle]
16237 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16238         o.result_ok
16239 }
16240 #[no_mangle]
16241 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16242 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16243 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16244         fn drop(&mut self) {
16245                 if self.result_ok {
16246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16248                         }
16249                 } else {
16250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16252                         }
16253                 }
16254         }
16255 }
16256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16258                 let contents = if o.result_ok {
16259                         let result = unsafe { o.contents.result };
16260                         unsafe { o.contents.result = core::ptr::null_mut() };
16261                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16262                 } else {
16263                         let err = unsafe { o.contents.err };
16264                         unsafe { o.contents.err = core::ptr::null_mut(); }
16265                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16266                 };
16267                 Self {
16268                         contents,
16269                         result_ok: o.result_ok,
16270                 }
16271         }
16272 }
16273 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16274         fn clone(&self) -> Self {
16275                 if self.result_ok {
16276                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16277                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16278                         } }
16279                 } else {
16280                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16281                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16282                         } }
16283                 }
16284         }
16285 }
16286 #[no_mangle]
16287 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16288 /// but with all dynamically-allocated buffers duplicated in new buffers.
16289 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16290 #[repr(C)]
16291 /// The contents of CResult_OnionMessageDecodeErrorZ
16292 pub union CResult_OnionMessageDecodeErrorZPtr {
16293         /// A pointer to the contents in the success state.
16294         /// Reading from this pointer when `result_ok` is not set is undefined.
16295         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16296         /// A pointer to the contents in the error state.
16297         /// Reading from this pointer when `result_ok` is set is undefined.
16298         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16299 }
16300 #[repr(C)]
16301 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16302 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16304 pub struct CResult_OnionMessageDecodeErrorZ {
16305         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16306         /// `err` or `result` depending on the state of `result_ok`.
16307         pub contents: CResult_OnionMessageDecodeErrorZPtr,
16308         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16309         pub result_ok: bool,
16310 }
16311 #[no_mangle]
16312 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16314         CResult_OnionMessageDecodeErrorZ {
16315                 contents: CResult_OnionMessageDecodeErrorZPtr {
16316                         result: Box::into_raw(Box::new(o)),
16317                 },
16318                 result_ok: true,
16319         }
16320 }
16321 #[no_mangle]
16322 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16323 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16324         CResult_OnionMessageDecodeErrorZ {
16325                 contents: CResult_OnionMessageDecodeErrorZPtr {
16326                         err: Box::into_raw(Box::new(e)),
16327                 },
16328                 result_ok: false,
16329         }
16330 }
16331 /// Checks if the given object is currently in the success state
16332 #[no_mangle]
16333 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16334         o.result_ok
16335 }
16336 #[no_mangle]
16337 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16338 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16339 impl Drop for CResult_OnionMessageDecodeErrorZ {
16340         fn drop(&mut self) {
16341                 if self.result_ok {
16342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16344                         }
16345                 } else {
16346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16348                         }
16349                 }
16350         }
16351 }
16352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16354                 let contents = if o.result_ok {
16355                         let result = unsafe { o.contents.result };
16356                         unsafe { o.contents.result = core::ptr::null_mut() };
16357                         CResult_OnionMessageDecodeErrorZPtr { result }
16358                 } else {
16359                         let err = unsafe { o.contents.err };
16360                         unsafe { o.contents.err = core::ptr::null_mut(); }
16361                         CResult_OnionMessageDecodeErrorZPtr { err }
16362                 };
16363                 Self {
16364                         contents,
16365                         result_ok: o.result_ok,
16366                 }
16367         }
16368 }
16369 impl Clone for CResult_OnionMessageDecodeErrorZ {
16370         fn clone(&self) -> Self {
16371                 if self.result_ok {
16372                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16373                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16374                         } }
16375                 } else {
16376                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16377                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16378                         } }
16379                 }
16380         }
16381 }
16382 #[no_mangle]
16383 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16384 /// but with all dynamically-allocated buffers duplicated in new buffers.
16385 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16386 #[repr(C)]
16387 /// The contents of CResult_PingDecodeErrorZ
16388 pub union CResult_PingDecodeErrorZPtr {
16389         /// A pointer to the contents in the success state.
16390         /// Reading from this pointer when `result_ok` is not set is undefined.
16391         pub result: *mut crate::lightning::ln::msgs::Ping,
16392         /// A pointer to the contents in the error state.
16393         /// Reading from this pointer when `result_ok` is set is undefined.
16394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16395 }
16396 #[repr(C)]
16397 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16398 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16400 pub struct CResult_PingDecodeErrorZ {
16401         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16402         /// `err` or `result` depending on the state of `result_ok`.
16403         pub contents: CResult_PingDecodeErrorZPtr,
16404         /// Whether this CResult_PingDecodeErrorZ represents a success state.
16405         pub result_ok: bool,
16406 }
16407 #[no_mangle]
16408 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16409 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16410         CResult_PingDecodeErrorZ {
16411                 contents: CResult_PingDecodeErrorZPtr {
16412                         result: Box::into_raw(Box::new(o)),
16413                 },
16414                 result_ok: true,
16415         }
16416 }
16417 #[no_mangle]
16418 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16419 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16420         CResult_PingDecodeErrorZ {
16421                 contents: CResult_PingDecodeErrorZPtr {
16422                         err: Box::into_raw(Box::new(e)),
16423                 },
16424                 result_ok: false,
16425         }
16426 }
16427 /// Checks if the given object is currently in the success state
16428 #[no_mangle]
16429 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16430         o.result_ok
16431 }
16432 #[no_mangle]
16433 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16434 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16435 impl Drop for CResult_PingDecodeErrorZ {
16436         fn drop(&mut self) {
16437                 if self.result_ok {
16438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16440                         }
16441                 } else {
16442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16444                         }
16445                 }
16446         }
16447 }
16448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16450                 let contents = if o.result_ok {
16451                         let result = unsafe { o.contents.result };
16452                         unsafe { o.contents.result = core::ptr::null_mut() };
16453                         CResult_PingDecodeErrorZPtr { result }
16454                 } else {
16455                         let err = unsafe { o.contents.err };
16456                         unsafe { o.contents.err = core::ptr::null_mut(); }
16457                         CResult_PingDecodeErrorZPtr { err }
16458                 };
16459                 Self {
16460                         contents,
16461                         result_ok: o.result_ok,
16462                 }
16463         }
16464 }
16465 impl Clone for CResult_PingDecodeErrorZ {
16466         fn clone(&self) -> Self {
16467                 if self.result_ok {
16468                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16470                         } }
16471                 } else {
16472                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16474                         } }
16475                 }
16476         }
16477 }
16478 #[no_mangle]
16479 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16480 /// but with all dynamically-allocated buffers duplicated in new buffers.
16481 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16482 #[repr(C)]
16483 /// The contents of CResult_PongDecodeErrorZ
16484 pub union CResult_PongDecodeErrorZPtr {
16485         /// A pointer to the contents in the success state.
16486         /// Reading from this pointer when `result_ok` is not set is undefined.
16487         pub result: *mut crate::lightning::ln::msgs::Pong,
16488         /// A pointer to the contents in the error state.
16489         /// Reading from this pointer when `result_ok` is set is undefined.
16490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16491 }
16492 #[repr(C)]
16493 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16494 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16496 pub struct CResult_PongDecodeErrorZ {
16497         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16498         /// `err` or `result` depending on the state of `result_ok`.
16499         pub contents: CResult_PongDecodeErrorZPtr,
16500         /// Whether this CResult_PongDecodeErrorZ represents a success state.
16501         pub result_ok: bool,
16502 }
16503 #[no_mangle]
16504 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16505 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16506         CResult_PongDecodeErrorZ {
16507                 contents: CResult_PongDecodeErrorZPtr {
16508                         result: Box::into_raw(Box::new(o)),
16509                 },
16510                 result_ok: true,
16511         }
16512 }
16513 #[no_mangle]
16514 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16515 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16516         CResult_PongDecodeErrorZ {
16517                 contents: CResult_PongDecodeErrorZPtr {
16518                         err: Box::into_raw(Box::new(e)),
16519                 },
16520                 result_ok: false,
16521         }
16522 }
16523 /// Checks if the given object is currently in the success state
16524 #[no_mangle]
16525 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16526         o.result_ok
16527 }
16528 #[no_mangle]
16529 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16530 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16531 impl Drop for CResult_PongDecodeErrorZ {
16532         fn drop(&mut self) {
16533                 if self.result_ok {
16534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16536                         }
16537                 } else {
16538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16540                         }
16541                 }
16542         }
16543 }
16544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16546                 let contents = if o.result_ok {
16547                         let result = unsafe { o.contents.result };
16548                         unsafe { o.contents.result = core::ptr::null_mut() };
16549                         CResult_PongDecodeErrorZPtr { result }
16550                 } else {
16551                         let err = unsafe { o.contents.err };
16552                         unsafe { o.contents.err = core::ptr::null_mut(); }
16553                         CResult_PongDecodeErrorZPtr { err }
16554                 };
16555                 Self {
16556                         contents,
16557                         result_ok: o.result_ok,
16558                 }
16559         }
16560 }
16561 impl Clone for CResult_PongDecodeErrorZ {
16562         fn clone(&self) -> Self {
16563                 if self.result_ok {
16564                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16566                         } }
16567                 } else {
16568                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16570                         } }
16571                 }
16572         }
16573 }
16574 #[no_mangle]
16575 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16576 /// but with all dynamically-allocated buffers duplicated in new buffers.
16577 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16578 #[repr(C)]
16579 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16580 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16581         /// A pointer to the contents in the success state.
16582         /// Reading from this pointer when `result_ok` is not set is undefined.
16583         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16584         /// A pointer to the contents in the error state.
16585         /// Reading from this pointer when `result_ok` is set is undefined.
16586         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16587 }
16588 #[repr(C)]
16589 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16590 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16592 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16593         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16594         /// `err` or `result` depending on the state of `result_ok`.
16595         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16596         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16597         pub result_ok: bool,
16598 }
16599 #[no_mangle]
16600 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16602         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16603                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16604                         result: Box::into_raw(Box::new(o)),
16605                 },
16606                 result_ok: true,
16607         }
16608 }
16609 #[no_mangle]
16610 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16611 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16612         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16613                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16614                         err: Box::into_raw(Box::new(e)),
16615                 },
16616                 result_ok: false,
16617         }
16618 }
16619 /// Checks if the given object is currently in the success state
16620 #[no_mangle]
16621 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16622         o.result_ok
16623 }
16624 #[no_mangle]
16625 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16626 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16627 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16628         fn drop(&mut self) {
16629                 if self.result_ok {
16630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16632                         }
16633                 } else {
16634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16636                         }
16637                 }
16638         }
16639 }
16640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16642                 let contents = if o.result_ok {
16643                         let result = unsafe { o.contents.result };
16644                         unsafe { o.contents.result = core::ptr::null_mut() };
16645                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16646                 } else {
16647                         let err = unsafe { o.contents.err };
16648                         unsafe { o.contents.err = core::ptr::null_mut(); }
16649                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16650                 };
16651                 Self {
16652                         contents,
16653                         result_ok: o.result_ok,
16654                 }
16655         }
16656 }
16657 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16658         fn clone(&self) -> Self {
16659                 if self.result_ok {
16660                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16662                         } }
16663                 } else {
16664                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16665                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16666                         } }
16667                 }
16668         }
16669 }
16670 #[no_mangle]
16671 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16672 /// but with all dynamically-allocated buffers duplicated in new buffers.
16673 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16674 #[repr(C)]
16675 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16676 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16677         /// A pointer to the contents in the success state.
16678         /// Reading from this pointer when `result_ok` is not set is undefined.
16679         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16680         /// A pointer to the contents in the error state.
16681         /// Reading from this pointer when `result_ok` is set is undefined.
16682         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16683 }
16684 #[repr(C)]
16685 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16686 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16688 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16689         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16690         /// `err` or `result` depending on the state of `result_ok`.
16691         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16692         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16693         pub result_ok: bool,
16694 }
16695 #[no_mangle]
16696 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16698         CResult_ChannelAnnouncementDecodeErrorZ {
16699                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16700                         result: Box::into_raw(Box::new(o)),
16701                 },
16702                 result_ok: true,
16703         }
16704 }
16705 #[no_mangle]
16706 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16707 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16708         CResult_ChannelAnnouncementDecodeErrorZ {
16709                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16710                         err: Box::into_raw(Box::new(e)),
16711                 },
16712                 result_ok: false,
16713         }
16714 }
16715 /// Checks if the given object is currently in the success state
16716 #[no_mangle]
16717 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16718         o.result_ok
16719 }
16720 #[no_mangle]
16721 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16722 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16723 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16724         fn drop(&mut self) {
16725                 if self.result_ok {
16726                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16727                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16728                         }
16729                 } else {
16730                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16731                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16732                         }
16733                 }
16734         }
16735 }
16736 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16737         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16738                 let contents = if o.result_ok {
16739                         let result = unsafe { o.contents.result };
16740                         unsafe { o.contents.result = core::ptr::null_mut() };
16741                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16742                 } else {
16743                         let err = unsafe { o.contents.err };
16744                         unsafe { o.contents.err = core::ptr::null_mut(); }
16745                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16746                 };
16747                 Self {
16748                         contents,
16749                         result_ok: o.result_ok,
16750                 }
16751         }
16752 }
16753 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16754         fn clone(&self) -> Self {
16755                 if self.result_ok {
16756                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16757                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16758                         } }
16759                 } else {
16760                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16761                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16762                         } }
16763                 }
16764         }
16765 }
16766 #[no_mangle]
16767 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16768 /// but with all dynamically-allocated buffers duplicated in new buffers.
16769 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16770 #[repr(C)]
16771 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16772 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16773         /// A pointer to the contents in the success state.
16774         /// Reading from this pointer when `result_ok` is not set is undefined.
16775         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16776         /// A pointer to the contents in the error state.
16777         /// Reading from this pointer when `result_ok` is set is undefined.
16778         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16779 }
16780 #[repr(C)]
16781 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16782 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16784 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16785         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16786         /// `err` or `result` depending on the state of `result_ok`.
16787         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16788         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16789         pub result_ok: bool,
16790 }
16791 #[no_mangle]
16792 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16794         CResult_UnsignedChannelUpdateDecodeErrorZ {
16795                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16796                         result: Box::into_raw(Box::new(o)),
16797                 },
16798                 result_ok: true,
16799         }
16800 }
16801 #[no_mangle]
16802 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16803 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16804         CResult_UnsignedChannelUpdateDecodeErrorZ {
16805                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16806                         err: Box::into_raw(Box::new(e)),
16807                 },
16808                 result_ok: false,
16809         }
16810 }
16811 /// Checks if the given object is currently in the success state
16812 #[no_mangle]
16813 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16814         o.result_ok
16815 }
16816 #[no_mangle]
16817 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16818 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16819 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16820         fn drop(&mut self) {
16821                 if self.result_ok {
16822                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16823                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16824                         }
16825                 } else {
16826                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16827                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16828                         }
16829                 }
16830         }
16831 }
16832 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16833         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16834                 let contents = if o.result_ok {
16835                         let result = unsafe { o.contents.result };
16836                         unsafe { o.contents.result = core::ptr::null_mut() };
16837                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16838                 } else {
16839                         let err = unsafe { o.contents.err };
16840                         unsafe { o.contents.err = core::ptr::null_mut(); }
16841                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16842                 };
16843                 Self {
16844                         contents,
16845                         result_ok: o.result_ok,
16846                 }
16847         }
16848 }
16849 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16850         fn clone(&self) -> Self {
16851                 if self.result_ok {
16852                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16853                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16854                         } }
16855                 } else {
16856                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16857                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16858                         } }
16859                 }
16860         }
16861 }
16862 #[no_mangle]
16863 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16864 /// but with all dynamically-allocated buffers duplicated in new buffers.
16865 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16866 #[repr(C)]
16867 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16868 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16869         /// A pointer to the contents in the success state.
16870         /// Reading from this pointer when `result_ok` is not set is undefined.
16871         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16872         /// A pointer to the contents in the error state.
16873         /// Reading from this pointer when `result_ok` is set is undefined.
16874         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16875 }
16876 #[repr(C)]
16877 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16878 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16880 pub struct CResult_ChannelUpdateDecodeErrorZ {
16881         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16882         /// `err` or `result` depending on the state of `result_ok`.
16883         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16884         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16885         pub result_ok: bool,
16886 }
16887 #[no_mangle]
16888 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16890         CResult_ChannelUpdateDecodeErrorZ {
16891                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16892                         result: Box::into_raw(Box::new(o)),
16893                 },
16894                 result_ok: true,
16895         }
16896 }
16897 #[no_mangle]
16898 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16899 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16900         CResult_ChannelUpdateDecodeErrorZ {
16901                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16902                         err: Box::into_raw(Box::new(e)),
16903                 },
16904                 result_ok: false,
16905         }
16906 }
16907 /// Checks if the given object is currently in the success state
16908 #[no_mangle]
16909 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16910         o.result_ok
16911 }
16912 #[no_mangle]
16913 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16914 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16915 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16916         fn drop(&mut self) {
16917                 if self.result_ok {
16918                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16919                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16920                         }
16921                 } else {
16922                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16923                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16924                         }
16925                 }
16926         }
16927 }
16928 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16929         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16930                 let contents = if o.result_ok {
16931                         let result = unsafe { o.contents.result };
16932                         unsafe { o.contents.result = core::ptr::null_mut() };
16933                         CResult_ChannelUpdateDecodeErrorZPtr { result }
16934                 } else {
16935                         let err = unsafe { o.contents.err };
16936                         unsafe { o.contents.err = core::ptr::null_mut(); }
16937                         CResult_ChannelUpdateDecodeErrorZPtr { err }
16938                 };
16939                 Self {
16940                         contents,
16941                         result_ok: o.result_ok,
16942                 }
16943         }
16944 }
16945 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16946         fn clone(&self) -> Self {
16947                 if self.result_ok {
16948                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16949                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16950                         } }
16951                 } else {
16952                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16953                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16954                         } }
16955                 }
16956         }
16957 }
16958 #[no_mangle]
16959 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16960 /// but with all dynamically-allocated buffers duplicated in new buffers.
16961 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16962 #[repr(C)]
16963 /// The contents of CResult_ErrorMessageDecodeErrorZ
16964 pub union CResult_ErrorMessageDecodeErrorZPtr {
16965         /// A pointer to the contents in the success state.
16966         /// Reading from this pointer when `result_ok` is not set is undefined.
16967         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16968         /// A pointer to the contents in the error state.
16969         /// Reading from this pointer when `result_ok` is set is undefined.
16970         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16971 }
16972 #[repr(C)]
16973 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16974 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16976 pub struct CResult_ErrorMessageDecodeErrorZ {
16977         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16978         /// `err` or `result` depending on the state of `result_ok`.
16979         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16980         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16981         pub result_ok: bool,
16982 }
16983 #[no_mangle]
16984 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16986         CResult_ErrorMessageDecodeErrorZ {
16987                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16988                         result: Box::into_raw(Box::new(o)),
16989                 },
16990                 result_ok: true,
16991         }
16992 }
16993 #[no_mangle]
16994 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16995 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16996         CResult_ErrorMessageDecodeErrorZ {
16997                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16998                         err: Box::into_raw(Box::new(e)),
16999                 },
17000                 result_ok: false,
17001         }
17002 }
17003 /// Checks if the given object is currently in the success state
17004 #[no_mangle]
17005 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
17006         o.result_ok
17007 }
17008 #[no_mangle]
17009 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
17010 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
17011 impl Drop for CResult_ErrorMessageDecodeErrorZ {
17012         fn drop(&mut self) {
17013                 if self.result_ok {
17014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17016                         }
17017                 } else {
17018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17020                         }
17021                 }
17022         }
17023 }
17024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17026                 let contents = if o.result_ok {
17027                         let result = unsafe { o.contents.result };
17028                         unsafe { o.contents.result = core::ptr::null_mut() };
17029                         CResult_ErrorMessageDecodeErrorZPtr { result }
17030                 } else {
17031                         let err = unsafe { o.contents.err };
17032                         unsafe { o.contents.err = core::ptr::null_mut(); }
17033                         CResult_ErrorMessageDecodeErrorZPtr { err }
17034                 };
17035                 Self {
17036                         contents,
17037                         result_ok: o.result_ok,
17038                 }
17039         }
17040 }
17041 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17042         fn clone(&self) -> Self {
17043                 if self.result_ok {
17044                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17045                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17046                         } }
17047                 } else {
17048                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17050                         } }
17051                 }
17052         }
17053 }
17054 #[no_mangle]
17055 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17056 /// but with all dynamically-allocated buffers duplicated in new buffers.
17057 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17058 #[repr(C)]
17059 /// The contents of CResult_WarningMessageDecodeErrorZ
17060 pub union CResult_WarningMessageDecodeErrorZPtr {
17061         /// A pointer to the contents in the success state.
17062         /// Reading from this pointer when `result_ok` is not set is undefined.
17063         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17064         /// A pointer to the contents in the error state.
17065         /// Reading from this pointer when `result_ok` is set is undefined.
17066         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17067 }
17068 #[repr(C)]
17069 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17070 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17072 pub struct CResult_WarningMessageDecodeErrorZ {
17073         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17074         /// `err` or `result` depending on the state of `result_ok`.
17075         pub contents: CResult_WarningMessageDecodeErrorZPtr,
17076         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17077         pub result_ok: bool,
17078 }
17079 #[no_mangle]
17080 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17082         CResult_WarningMessageDecodeErrorZ {
17083                 contents: CResult_WarningMessageDecodeErrorZPtr {
17084                         result: Box::into_raw(Box::new(o)),
17085                 },
17086                 result_ok: true,
17087         }
17088 }
17089 #[no_mangle]
17090 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17091 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17092         CResult_WarningMessageDecodeErrorZ {
17093                 contents: CResult_WarningMessageDecodeErrorZPtr {
17094                         err: Box::into_raw(Box::new(e)),
17095                 },
17096                 result_ok: false,
17097         }
17098 }
17099 /// Checks if the given object is currently in the success state
17100 #[no_mangle]
17101 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17102         o.result_ok
17103 }
17104 #[no_mangle]
17105 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17106 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17107 impl Drop for CResult_WarningMessageDecodeErrorZ {
17108         fn drop(&mut self) {
17109                 if self.result_ok {
17110                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17111                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17112                         }
17113                 } else {
17114                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17115                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17116                         }
17117                 }
17118         }
17119 }
17120 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17121         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17122                 let contents = if o.result_ok {
17123                         let result = unsafe { o.contents.result };
17124                         unsafe { o.contents.result = core::ptr::null_mut() };
17125                         CResult_WarningMessageDecodeErrorZPtr { result }
17126                 } else {
17127                         let err = unsafe { o.contents.err };
17128                         unsafe { o.contents.err = core::ptr::null_mut(); }
17129                         CResult_WarningMessageDecodeErrorZPtr { err }
17130                 };
17131                 Self {
17132                         contents,
17133                         result_ok: o.result_ok,
17134                 }
17135         }
17136 }
17137 impl Clone for CResult_WarningMessageDecodeErrorZ {
17138         fn clone(&self) -> Self {
17139                 if self.result_ok {
17140                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17141                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17142                         } }
17143                 } else {
17144                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17145                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17146                         } }
17147                 }
17148         }
17149 }
17150 #[no_mangle]
17151 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17152 /// but with all dynamically-allocated buffers duplicated in new buffers.
17153 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17154 #[repr(C)]
17155 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17156 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17157         /// A pointer to the contents in the success state.
17158         /// Reading from this pointer when `result_ok` is not set is undefined.
17159         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17160         /// A pointer to the contents in the error state.
17161         /// Reading from this pointer when `result_ok` is set is undefined.
17162         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17163 }
17164 #[repr(C)]
17165 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17166 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17168 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17169         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17170         /// `err` or `result` depending on the state of `result_ok`.
17171         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17172         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17173         pub result_ok: bool,
17174 }
17175 #[no_mangle]
17176 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17178         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17179                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17180                         result: Box::into_raw(Box::new(o)),
17181                 },
17182                 result_ok: true,
17183         }
17184 }
17185 #[no_mangle]
17186 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17187 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17188         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17189                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17190                         err: Box::into_raw(Box::new(e)),
17191                 },
17192                 result_ok: false,
17193         }
17194 }
17195 /// Checks if the given object is currently in the success state
17196 #[no_mangle]
17197 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17198         o.result_ok
17199 }
17200 #[no_mangle]
17201 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17202 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17203 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17204         fn drop(&mut self) {
17205                 if self.result_ok {
17206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17208                         }
17209                 } else {
17210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17212                         }
17213                 }
17214         }
17215 }
17216 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17217         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17218                 let contents = if o.result_ok {
17219                         let result = unsafe { o.contents.result };
17220                         unsafe { o.contents.result = core::ptr::null_mut() };
17221                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17222                 } else {
17223                         let err = unsafe { o.contents.err };
17224                         unsafe { o.contents.err = core::ptr::null_mut(); }
17225                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17226                 };
17227                 Self {
17228                         contents,
17229                         result_ok: o.result_ok,
17230                 }
17231         }
17232 }
17233 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17234         fn clone(&self) -> Self {
17235                 if self.result_ok {
17236                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17237                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17238                         } }
17239                 } else {
17240                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17241                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17242                         } }
17243                 }
17244         }
17245 }
17246 #[no_mangle]
17247 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17248 /// but with all dynamically-allocated buffers duplicated in new buffers.
17249 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17250 #[repr(C)]
17251 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17252 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17253         /// A pointer to the contents in the success state.
17254         /// Reading from this pointer when `result_ok` is not set is undefined.
17255         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17256         /// A pointer to the contents in the error state.
17257         /// Reading from this pointer when `result_ok` is set is undefined.
17258         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17259 }
17260 #[repr(C)]
17261 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17262 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17264 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17265         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17266         /// `err` or `result` depending on the state of `result_ok`.
17267         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17268         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17269         pub result_ok: bool,
17270 }
17271 #[no_mangle]
17272 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17274         CResult_NodeAnnouncementDecodeErrorZ {
17275                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17276                         result: Box::into_raw(Box::new(o)),
17277                 },
17278                 result_ok: true,
17279         }
17280 }
17281 #[no_mangle]
17282 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17283 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17284         CResult_NodeAnnouncementDecodeErrorZ {
17285                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17286                         err: Box::into_raw(Box::new(e)),
17287                 },
17288                 result_ok: false,
17289         }
17290 }
17291 /// Checks if the given object is currently in the success state
17292 #[no_mangle]
17293 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17294         o.result_ok
17295 }
17296 #[no_mangle]
17297 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17298 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17299 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17300         fn drop(&mut self) {
17301                 if self.result_ok {
17302                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17303                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17304                         }
17305                 } else {
17306                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17307                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17308                         }
17309                 }
17310         }
17311 }
17312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17313         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17314                 let contents = if o.result_ok {
17315                         let result = unsafe { o.contents.result };
17316                         unsafe { o.contents.result = core::ptr::null_mut() };
17317                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
17318                 } else {
17319                         let err = unsafe { o.contents.err };
17320                         unsafe { o.contents.err = core::ptr::null_mut(); }
17321                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
17322                 };
17323                 Self {
17324                         contents,
17325                         result_ok: o.result_ok,
17326                 }
17327         }
17328 }
17329 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17330         fn clone(&self) -> Self {
17331                 if self.result_ok {
17332                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17333                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17334                         } }
17335                 } else {
17336                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17337                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17338                         } }
17339                 }
17340         }
17341 }
17342 #[no_mangle]
17343 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17344 /// but with all dynamically-allocated buffers duplicated in new buffers.
17345 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17346 #[repr(C)]
17347 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17348 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17349         /// A pointer to the contents in the success state.
17350         /// Reading from this pointer when `result_ok` is not set is undefined.
17351         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17352         /// A pointer to the contents in the error state.
17353         /// Reading from this pointer when `result_ok` is set is undefined.
17354         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17355 }
17356 #[repr(C)]
17357 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17358 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17360 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17361         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17362         /// `err` or `result` depending on the state of `result_ok`.
17363         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17364         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17365         pub result_ok: bool,
17366 }
17367 #[no_mangle]
17368 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17370         CResult_QueryShortChannelIdsDecodeErrorZ {
17371                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17372                         result: Box::into_raw(Box::new(o)),
17373                 },
17374                 result_ok: true,
17375         }
17376 }
17377 #[no_mangle]
17378 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17379 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17380         CResult_QueryShortChannelIdsDecodeErrorZ {
17381                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17382                         err: Box::into_raw(Box::new(e)),
17383                 },
17384                 result_ok: false,
17385         }
17386 }
17387 /// Checks if the given object is currently in the success state
17388 #[no_mangle]
17389 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17390         o.result_ok
17391 }
17392 #[no_mangle]
17393 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17394 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17395 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17396         fn drop(&mut self) {
17397                 if self.result_ok {
17398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17400                         }
17401                 } else {
17402                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17403                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17404                         }
17405                 }
17406         }
17407 }
17408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17409         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17410                 let contents = if o.result_ok {
17411                         let result = unsafe { o.contents.result };
17412                         unsafe { o.contents.result = core::ptr::null_mut() };
17413                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17414                 } else {
17415                         let err = unsafe { o.contents.err };
17416                         unsafe { o.contents.err = core::ptr::null_mut(); }
17417                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17418                 };
17419                 Self {
17420                         contents,
17421                         result_ok: o.result_ok,
17422                 }
17423         }
17424 }
17425 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17426         fn clone(&self) -> Self {
17427                 if self.result_ok {
17428                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17429                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17430                         } }
17431                 } else {
17432                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17433                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17434                         } }
17435                 }
17436         }
17437 }
17438 #[no_mangle]
17439 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17440 /// but with all dynamically-allocated buffers duplicated in new buffers.
17441 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17442 #[repr(C)]
17443 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17444 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17445         /// A pointer to the contents in the success state.
17446         /// Reading from this pointer when `result_ok` is not set is undefined.
17447         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17448         /// A pointer to the contents in the error state.
17449         /// Reading from this pointer when `result_ok` is set is undefined.
17450         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17451 }
17452 #[repr(C)]
17453 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17454 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17456 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17457         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17458         /// `err` or `result` depending on the state of `result_ok`.
17459         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17460         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17461         pub result_ok: bool,
17462 }
17463 #[no_mangle]
17464 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17466         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17467                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17468                         result: Box::into_raw(Box::new(o)),
17469                 },
17470                 result_ok: true,
17471         }
17472 }
17473 #[no_mangle]
17474 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17475 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17476         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17477                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17478                         err: Box::into_raw(Box::new(e)),
17479                 },
17480                 result_ok: false,
17481         }
17482 }
17483 /// Checks if the given object is currently in the success state
17484 #[no_mangle]
17485 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17486         o.result_ok
17487 }
17488 #[no_mangle]
17489 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17490 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17491 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17492         fn drop(&mut self) {
17493                 if self.result_ok {
17494                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17495                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17496                         }
17497                 } else {
17498                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17499                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17500                         }
17501                 }
17502         }
17503 }
17504 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17505         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17506                 let contents = if o.result_ok {
17507                         let result = unsafe { o.contents.result };
17508                         unsafe { o.contents.result = core::ptr::null_mut() };
17509                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17510                 } else {
17511                         let err = unsafe { o.contents.err };
17512                         unsafe { o.contents.err = core::ptr::null_mut(); }
17513                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17514                 };
17515                 Self {
17516                         contents,
17517                         result_ok: o.result_ok,
17518                 }
17519         }
17520 }
17521 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17522         fn clone(&self) -> Self {
17523                 if self.result_ok {
17524                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17525                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17526                         } }
17527                 } else {
17528                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17529                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17530                         } }
17531                 }
17532         }
17533 }
17534 #[no_mangle]
17535 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17536 /// but with all dynamically-allocated buffers duplicated in new buffers.
17537 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17538 #[repr(C)]
17539 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17540 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17541         /// A pointer to the contents in the success state.
17542         /// Reading from this pointer when `result_ok` is not set is undefined.
17543         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17544         /// A pointer to the contents in the error state.
17545         /// Reading from this pointer when `result_ok` is set is undefined.
17546         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17547 }
17548 #[repr(C)]
17549 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17550 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17552 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17553         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17554         /// `err` or `result` depending on the state of `result_ok`.
17555         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17556         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17557         pub result_ok: bool,
17558 }
17559 #[no_mangle]
17560 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17562         CResult_QueryChannelRangeDecodeErrorZ {
17563                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17564                         result: Box::into_raw(Box::new(o)),
17565                 },
17566                 result_ok: true,
17567         }
17568 }
17569 #[no_mangle]
17570 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17571 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17572         CResult_QueryChannelRangeDecodeErrorZ {
17573                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17574                         err: Box::into_raw(Box::new(e)),
17575                 },
17576                 result_ok: false,
17577         }
17578 }
17579 /// Checks if the given object is currently in the success state
17580 #[no_mangle]
17581 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17582         o.result_ok
17583 }
17584 #[no_mangle]
17585 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17586 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17587 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17588         fn drop(&mut self) {
17589                 if self.result_ok {
17590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17592                         }
17593                 } else {
17594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17596                         }
17597                 }
17598         }
17599 }
17600 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17602                 let contents = if o.result_ok {
17603                         let result = unsafe { o.contents.result };
17604                         unsafe { o.contents.result = core::ptr::null_mut() };
17605                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
17606                 } else {
17607                         let err = unsafe { o.contents.err };
17608                         unsafe { o.contents.err = core::ptr::null_mut(); }
17609                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
17610                 };
17611                 Self {
17612                         contents,
17613                         result_ok: o.result_ok,
17614                 }
17615         }
17616 }
17617 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17618         fn clone(&self) -> Self {
17619                 if self.result_ok {
17620                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17621                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17622                         } }
17623                 } else {
17624                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17625                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17626                         } }
17627                 }
17628         }
17629 }
17630 #[no_mangle]
17631 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17632 /// but with all dynamically-allocated buffers duplicated in new buffers.
17633 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17634 #[repr(C)]
17635 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17636 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17637         /// A pointer to the contents in the success state.
17638         /// Reading from this pointer when `result_ok` is not set is undefined.
17639         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17640         /// A pointer to the contents in the error state.
17641         /// Reading from this pointer when `result_ok` is set is undefined.
17642         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17643 }
17644 #[repr(C)]
17645 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17646 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17648 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17649         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17650         /// `err` or `result` depending on the state of `result_ok`.
17651         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17652         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17653         pub result_ok: bool,
17654 }
17655 #[no_mangle]
17656 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17658         CResult_ReplyChannelRangeDecodeErrorZ {
17659                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17660                         result: Box::into_raw(Box::new(o)),
17661                 },
17662                 result_ok: true,
17663         }
17664 }
17665 #[no_mangle]
17666 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17667 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17668         CResult_ReplyChannelRangeDecodeErrorZ {
17669                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17670                         err: Box::into_raw(Box::new(e)),
17671                 },
17672                 result_ok: false,
17673         }
17674 }
17675 /// Checks if the given object is currently in the success state
17676 #[no_mangle]
17677 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17678         o.result_ok
17679 }
17680 #[no_mangle]
17681 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17682 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17683 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17684         fn drop(&mut self) {
17685                 if self.result_ok {
17686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17688                         }
17689                 } else {
17690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17692                         }
17693                 }
17694         }
17695 }
17696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17698                 let contents = if o.result_ok {
17699                         let result = unsafe { o.contents.result };
17700                         unsafe { o.contents.result = core::ptr::null_mut() };
17701                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17702                 } else {
17703                         let err = unsafe { o.contents.err };
17704                         unsafe { o.contents.err = core::ptr::null_mut(); }
17705                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17706                 };
17707                 Self {
17708                         contents,
17709                         result_ok: o.result_ok,
17710                 }
17711         }
17712 }
17713 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17714         fn clone(&self) -> Self {
17715                 if self.result_ok {
17716                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17717                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17718                         } }
17719                 } else {
17720                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17721                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17722                         } }
17723                 }
17724         }
17725 }
17726 #[no_mangle]
17727 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17728 /// but with all dynamically-allocated buffers duplicated in new buffers.
17729 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17730 #[repr(C)]
17731 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17732 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17733         /// A pointer to the contents in the success state.
17734         /// Reading from this pointer when `result_ok` is not set is undefined.
17735         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17736         /// A pointer to the contents in the error state.
17737         /// Reading from this pointer when `result_ok` is set is undefined.
17738         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17739 }
17740 #[repr(C)]
17741 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17742 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17744 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17745         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17746         /// `err` or `result` depending on the state of `result_ok`.
17747         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17748         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17749         pub result_ok: bool,
17750 }
17751 #[no_mangle]
17752 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17754         CResult_GossipTimestampFilterDecodeErrorZ {
17755                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17756                         result: Box::into_raw(Box::new(o)),
17757                 },
17758                 result_ok: true,
17759         }
17760 }
17761 #[no_mangle]
17762 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17763 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17764         CResult_GossipTimestampFilterDecodeErrorZ {
17765                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17766                         err: Box::into_raw(Box::new(e)),
17767                 },
17768                 result_ok: false,
17769         }
17770 }
17771 /// Checks if the given object is currently in the success state
17772 #[no_mangle]
17773 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17774         o.result_ok
17775 }
17776 #[no_mangle]
17777 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17778 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17779 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17780         fn drop(&mut self) {
17781                 if self.result_ok {
17782                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17783                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17784                         }
17785                 } else {
17786                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17787                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17788                         }
17789                 }
17790         }
17791 }
17792 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17793         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17794                 let contents = if o.result_ok {
17795                         let result = unsafe { o.contents.result };
17796                         unsafe { o.contents.result = core::ptr::null_mut() };
17797                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17798                 } else {
17799                         let err = unsafe { o.contents.err };
17800                         unsafe { o.contents.err = core::ptr::null_mut(); }
17801                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17802                 };
17803                 Self {
17804                         contents,
17805                         result_ok: o.result_ok,
17806                 }
17807         }
17808 }
17809 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17810         fn clone(&self) -> Self {
17811                 if self.result_ok {
17812                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17813                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17814                         } }
17815                 } else {
17816                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17817                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17818                         } }
17819                 }
17820         }
17821 }
17822 #[no_mangle]
17823 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17824 /// but with all dynamically-allocated buffers duplicated in new buffers.
17825 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17826 #[repr(C)]
17827 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17828 /// This corresponds to std::vector in C++
17829 pub struct CVec_PhantomRouteHintsZ {
17830         /// The elements in the array.
17831         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17832         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17833         /// The number of elements pointed to by `data`.
17834         pub datalen: usize
17835 }
17836 impl CVec_PhantomRouteHintsZ {
17837         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17838                 if self.datalen == 0 { return Vec::new(); }
17839                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17840                 self.data = core::ptr::null_mut();
17841                 self.datalen = 0;
17842                 ret
17843         }
17844         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17845                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17846         }
17847 }
17848 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17849         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17850                 let datalen = v.len();
17851                 let data = Box::into_raw(v.into_boxed_slice());
17852                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17853         }
17854 }
17855 #[no_mangle]
17856 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17857 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17858 impl Drop for CVec_PhantomRouteHintsZ {
17859         fn drop(&mut self) {
17860                 if self.datalen == 0 { return; }
17861                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17862         }
17863 }
17864 impl Clone for CVec_PhantomRouteHintsZ {
17865         fn clone(&self) -> Self {
17866                 let mut res = Vec::new();
17867                 if self.datalen == 0 { return Self::from(res); }
17868                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17869                 Self::from(res)
17870         }
17871 }
17872 #[repr(C)]
17873 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
17874 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17875         /// A pointer to the contents in the success state.
17876         /// Reading from this pointer when `result_ok` is not set is undefined.
17877         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
17878         /// A pointer to the contents in the error state.
17879         /// Reading from this pointer when `result_ok` is set is undefined.
17880         pub err: *mut crate::lightning_invoice::SignOrCreationError,
17881 }
17882 #[repr(C)]
17883 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17884 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17886 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
17887         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
17888         /// `err` or `result` depending on the state of `result_ok`.
17889         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
17890         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
17891         pub result_ok: bool,
17892 }
17893 #[no_mangle]
17894 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
17895 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17896         CResult_Bolt11InvoiceSignOrCreationErrorZ {
17897                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17898                         result: Box::into_raw(Box::new(o)),
17899                 },
17900                 result_ok: true,
17901         }
17902 }
17903 #[no_mangle]
17904 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
17905 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17906         CResult_Bolt11InvoiceSignOrCreationErrorZ {
17907                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17908                         err: Box::into_raw(Box::new(e)),
17909                 },
17910                 result_ok: false,
17911         }
17912 }
17913 /// Checks if the given object is currently in the success state
17914 #[no_mangle]
17915 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
17916         o.result_ok
17917 }
17918 #[no_mangle]
17919 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
17920 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
17921 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17922         fn drop(&mut self) {
17923                 if self.result_ok {
17924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17926                         }
17927                 } else {
17928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17930                         }
17931                 }
17932         }
17933 }
17934 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17935         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17936                 let contents = if o.result_ok {
17937                         let result = unsafe { o.contents.result };
17938                         unsafe { o.contents.result = core::ptr::null_mut() };
17939                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
17940                 } else {
17941                         let err = unsafe { o.contents.err };
17942                         unsafe { o.contents.err = core::ptr::null_mut(); }
17943                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
17944                 };
17945                 Self {
17946                         contents,
17947                         result_ok: o.result_ok,
17948                 }
17949         }
17950 }
17951 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17952         fn clone(&self) -> Self {
17953                 if self.result_ok {
17954                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17955                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
17956                         } }
17957                 } else {
17958                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17959                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17960                         } }
17961                 }
17962         }
17963 }
17964 #[no_mangle]
17965 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
17966 /// but with all dynamically-allocated buffers duplicated in new buffers.
17967 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17968 #[repr(C)]
17969 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17970 /// This corresponds to std::vector in C++
17971 pub struct CVec_FutureZ {
17972         /// The elements in the array.
17973         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17974         pub data: *mut crate::lightning::util::wakers::Future,
17975         /// The number of elements pointed to by `data`.
17976         pub datalen: usize
17977 }
17978 impl CVec_FutureZ {
17979         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17980                 if self.datalen == 0 { return Vec::new(); }
17981                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17982                 self.data = core::ptr::null_mut();
17983                 self.datalen = 0;
17984                 ret
17985         }
17986         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17987                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17988         }
17989 }
17990 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17991         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17992                 let datalen = v.len();
17993                 let data = Box::into_raw(v.into_boxed_slice());
17994                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17995         }
17996 }
17997 #[no_mangle]
17998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17999 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
18000 impl Drop for CVec_FutureZ {
18001         fn drop(&mut self) {
18002                 if self.datalen == 0 { return; }
18003                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18004         }
18005 }
18006 impl Clone for CVec_FutureZ {
18007         fn clone(&self) -> Self {
18008                 let mut res = Vec::new();
18009                 if self.datalen == 0 { return Self::from(res); }
18010                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18011                 Self::from(res)
18012         }
18013 }
18014 #[repr(C)]
18015 /// The contents of CResult_OffersMessageDecodeErrorZ
18016 pub union CResult_OffersMessageDecodeErrorZPtr {
18017         /// A pointer to the contents in the success state.
18018         /// Reading from this pointer when `result_ok` is not set is undefined.
18019         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
18020         /// A pointer to the contents in the error state.
18021         /// Reading from this pointer when `result_ok` is set is undefined.
18022         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18023 }
18024 #[repr(C)]
18025 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
18026 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18027 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18028 pub struct CResult_OffersMessageDecodeErrorZ {
18029         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
18030         /// `err` or `result` depending on the state of `result_ok`.
18031         pub contents: CResult_OffersMessageDecodeErrorZPtr,
18032         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
18033         pub result_ok: bool,
18034 }
18035 #[no_mangle]
18036 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
18037 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
18038         CResult_OffersMessageDecodeErrorZ {
18039                 contents: CResult_OffersMessageDecodeErrorZPtr {
18040                         result: Box::into_raw(Box::new(o)),
18041                 },
18042                 result_ok: true,
18043         }
18044 }
18045 #[no_mangle]
18046 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
18047 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
18048         CResult_OffersMessageDecodeErrorZ {
18049                 contents: CResult_OffersMessageDecodeErrorZPtr {
18050                         err: Box::into_raw(Box::new(e)),
18051                 },
18052                 result_ok: false,
18053         }
18054 }
18055 /// Checks if the given object is currently in the success state
18056 #[no_mangle]
18057 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
18058         o.result_ok
18059 }
18060 #[no_mangle]
18061 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
18062 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
18063 impl Drop for CResult_OffersMessageDecodeErrorZ {
18064         fn drop(&mut self) {
18065                 if self.result_ok {
18066                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18067                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18068                         }
18069                 } else {
18070                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18071                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18072                         }
18073                 }
18074         }
18075 }
18076 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
18077         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18078                 let contents = if o.result_ok {
18079                         let result = unsafe { o.contents.result };
18080                         unsafe { o.contents.result = core::ptr::null_mut() };
18081                         CResult_OffersMessageDecodeErrorZPtr { result }
18082                 } else {
18083                         let err = unsafe { o.contents.err };
18084                         unsafe { o.contents.err = core::ptr::null_mut(); }
18085                         CResult_OffersMessageDecodeErrorZPtr { err }
18086                 };
18087                 Self {
18088                         contents,
18089                         result_ok: o.result_ok,
18090                 }
18091         }
18092 }
18093 impl Clone for CResult_OffersMessageDecodeErrorZ {
18094         fn clone(&self) -> Self {
18095                 if self.result_ok {
18096                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
18097                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
18098                         } }
18099                 } else {
18100                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
18101                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18102                         } }
18103                 }
18104         }
18105 }
18106 #[no_mangle]
18107 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
18108 /// but with all dynamically-allocated buffers duplicated in new buffers.
18109 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
18110 #[repr(C)]
18111 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
18112 pub enum COption_HTLCClaimZ {
18113         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
18114         Some(crate::lightning::ln::chan_utils::HTLCClaim),
18115         /// When we're in this state, this COption_HTLCClaimZ contains nothing
18116         None
18117 }
18118 impl COption_HTLCClaimZ {
18119         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18120                 if let Self::None = self { false } else { true }
18121         }
18122         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18123                 !self.is_some()
18124         }
18125         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
18126                 if let Self::Some(v) = self { v } else { unreachable!() }
18127         }
18128 }
18129 #[no_mangle]
18130 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
18131 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
18132         COption_HTLCClaimZ::Some(o)
18133 }
18134 #[no_mangle]
18135 /// Constructs a new COption_HTLCClaimZ containing nothing
18136 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
18137         COption_HTLCClaimZ::None
18138 }
18139 #[no_mangle]
18140 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
18141 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
18142 #[repr(C)]
18143 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
18144 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18145         /// A pointer to the contents in the success state.
18146         /// Reading from this pointer when `result_ok` is not set is undefined.
18147         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
18148         /// A pointer to the contents in the error state.
18149         /// Reading from this pointer when `result_ok` is set is undefined.
18150         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18151 }
18152 #[repr(C)]
18153 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
18154 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
18155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18156 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18157         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
18158         /// `err` or `result` depending on the state of `result_ok`.
18159         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
18160         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
18161         pub result_ok: bool,
18162 }
18163 #[no_mangle]
18164 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
18165 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18166         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18167                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18168                         result: Box::into_raw(Box::new(o)),
18169                 },
18170                 result_ok: true,
18171         }
18172 }
18173 #[no_mangle]
18174 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
18175 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18176         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18177                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18178                         err: Box::into_raw(Box::new(e)),
18179                 },
18180                 result_ok: false,
18181         }
18182 }
18183 /// Checks if the given object is currently in the success state
18184 #[no_mangle]
18185 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
18186         o.result_ok
18187 }
18188 #[no_mangle]
18189 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
18190 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
18191 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18192         fn drop(&mut self) {
18193                 if self.result_ok {
18194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18196                         }
18197                 } else {
18198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18200                         }
18201                 }
18202         }
18203 }
18204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18205         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
18206                 let contents = if o.result_ok {
18207                         let result = unsafe { o.contents.result };
18208                         unsafe { o.contents.result = core::ptr::null_mut() };
18209                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
18210                 } else {
18211                         let err = unsafe { o.contents.err };
18212                         unsafe { o.contents.err = core::ptr::null_mut(); }
18213                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
18214                 };
18215                 Self {
18216                         contents,
18217                         result_ok: o.result_ok,
18218                 }
18219         }
18220 }
18221 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18222         fn clone(&self) -> Self {
18223                 if self.result_ok {
18224                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18225                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
18226                         } }
18227                 } else {
18228                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18229                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18230                         } }
18231                 }
18232         }
18233 }
18234 #[no_mangle]
18235 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
18236 /// but with all dynamically-allocated buffers duplicated in new buffers.
18237 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
18238 #[repr(C)]
18239 /// The contents of CResult_TxCreationKeysDecodeErrorZ
18240 pub union CResult_TxCreationKeysDecodeErrorZPtr {
18241         /// A pointer to the contents in the success state.
18242         /// Reading from this pointer when `result_ok` is not set is undefined.
18243         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
18244         /// A pointer to the contents in the error state.
18245         /// Reading from this pointer when `result_ok` is set is undefined.
18246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18247 }
18248 #[repr(C)]
18249 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
18250 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18252 pub struct CResult_TxCreationKeysDecodeErrorZ {
18253         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
18254         /// `err` or `result` depending on the state of `result_ok`.
18255         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
18256         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
18257         pub result_ok: bool,
18258 }
18259 #[no_mangle]
18260 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
18261 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
18262         CResult_TxCreationKeysDecodeErrorZ {
18263                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
18264                         result: Box::into_raw(Box::new(o)),
18265                 },
18266                 result_ok: true,
18267         }
18268 }
18269 #[no_mangle]
18270 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
18271 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
18272         CResult_TxCreationKeysDecodeErrorZ {
18273                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
18274                         err: Box::into_raw(Box::new(e)),
18275                 },
18276                 result_ok: false,
18277         }
18278 }
18279 /// Checks if the given object is currently in the success state
18280 #[no_mangle]
18281 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
18282         o.result_ok
18283 }
18284 #[no_mangle]
18285 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
18286 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
18287 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
18288         fn drop(&mut self) {
18289                 if self.result_ok {
18290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18292                         }
18293                 } else {
18294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18296                         }
18297                 }
18298         }
18299 }
18300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
18301         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18302                 let contents = if o.result_ok {
18303                         let result = unsafe { o.contents.result };
18304                         unsafe { o.contents.result = core::ptr::null_mut() };
18305                         CResult_TxCreationKeysDecodeErrorZPtr { result }
18306                 } else {
18307                         let err = unsafe { o.contents.err };
18308                         unsafe { o.contents.err = core::ptr::null_mut(); }
18309                         CResult_TxCreationKeysDecodeErrorZPtr { err }
18310                 };
18311                 Self {
18312                         contents,
18313                         result_ok: o.result_ok,
18314                 }
18315         }
18316 }
18317 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
18318         fn clone(&self) -> Self {
18319                 if self.result_ok {
18320                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18321                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
18322                         } }
18323                 } else {
18324                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18325                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18326                         } }
18327                 }
18328         }
18329 }
18330 #[no_mangle]
18331 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
18332 /// but with all dynamically-allocated buffers duplicated in new buffers.
18333 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
18334 #[repr(C)]
18335 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
18336 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
18337         /// A pointer to the contents in the success state.
18338         /// Reading from this pointer when `result_ok` is not set is undefined.
18339         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
18340         /// A pointer to the contents in the error state.
18341         /// Reading from this pointer when `result_ok` is set is undefined.
18342         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18343 }
18344 #[repr(C)]
18345 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
18346 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18348 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
18349         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
18350         /// `err` or `result` depending on the state of `result_ok`.
18351         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
18352         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
18353         pub result_ok: bool,
18354 }
18355 #[no_mangle]
18356 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
18357 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
18358         CResult_ChannelPublicKeysDecodeErrorZ {
18359                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18360                         result: Box::into_raw(Box::new(o)),
18361                 },
18362                 result_ok: true,
18363         }
18364 }
18365 #[no_mangle]
18366 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
18367 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
18368         CResult_ChannelPublicKeysDecodeErrorZ {
18369                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18370                         err: Box::into_raw(Box::new(e)),
18371                 },
18372                 result_ok: false,
18373         }
18374 }
18375 /// Checks if the given object is currently in the success state
18376 #[no_mangle]
18377 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
18378         o.result_ok
18379 }
18380 #[no_mangle]
18381 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
18382 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
18383 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
18384         fn drop(&mut self) {
18385                 if self.result_ok {
18386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18388                         }
18389                 } else {
18390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18392                         }
18393                 }
18394         }
18395 }
18396 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
18397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18398                 let contents = if o.result_ok {
18399                         let result = unsafe { o.contents.result };
18400                         unsafe { o.contents.result = core::ptr::null_mut() };
18401                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
18402                 } else {
18403                         let err = unsafe { o.contents.err };
18404                         unsafe { o.contents.err = core::ptr::null_mut(); }
18405                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
18406                 };
18407                 Self {
18408                         contents,
18409                         result_ok: o.result_ok,
18410                 }
18411         }
18412 }
18413 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
18414         fn clone(&self) -> Self {
18415                 if self.result_ok {
18416                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18417                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
18418                         } }
18419                 } else {
18420                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18421                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18422                         } }
18423                 }
18424         }
18425 }
18426 #[no_mangle]
18427 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
18428 /// but with all dynamically-allocated buffers duplicated in new buffers.
18429 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
18430 #[repr(C)]
18431 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
18432 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18433         /// A pointer to the contents in the success state.
18434         /// Reading from this pointer when `result_ok` is not set is undefined.
18435         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
18436         /// A pointer to the contents in the error state.
18437         /// Reading from this pointer when `result_ok` is set is undefined.
18438         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18439 }
18440 #[repr(C)]
18441 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
18442 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
18443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18444 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
18445         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
18446         /// `err` or `result` depending on the state of `result_ok`.
18447         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
18448         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
18449         pub result_ok: bool,
18450 }
18451 #[no_mangle]
18452 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
18453 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18454         CResult_HTLCOutputInCommitmentDecodeErrorZ {
18455                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18456                         result: Box::into_raw(Box::new(o)),
18457                 },
18458                 result_ok: true,
18459         }
18460 }
18461 #[no_mangle]
18462 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
18463 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18464         CResult_HTLCOutputInCommitmentDecodeErrorZ {
18465                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18466                         err: Box::into_raw(Box::new(e)),
18467                 },
18468                 result_ok: false,
18469         }
18470 }
18471 /// Checks if the given object is currently in the success state
18472 #[no_mangle]
18473 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
18474         o.result_ok
18475 }
18476 #[no_mangle]
18477 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
18478 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
18479 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18480         fn drop(&mut self) {
18481                 if self.result_ok {
18482                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18483                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18484                         }
18485                 } else {
18486                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18487                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18488                         }
18489                 }
18490         }
18491 }
18492 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18493         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
18494                 let contents = if o.result_ok {
18495                         let result = unsafe { o.contents.result };
18496                         unsafe { o.contents.result = core::ptr::null_mut() };
18497                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
18498                 } else {
18499                         let err = unsafe { o.contents.err };
18500                         unsafe { o.contents.err = core::ptr::null_mut(); }
18501                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
18502                 };
18503                 Self {
18504                         contents,
18505                         result_ok: o.result_ok,
18506                 }
18507         }
18508 }
18509 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18510         fn clone(&self) -> Self {
18511                 if self.result_ok {
18512                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18513                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
18514                         } }
18515                 } else {
18516                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18517                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18518                         } }
18519                 }
18520         }
18521 }
18522 #[no_mangle]
18523 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
18524 /// but with all dynamically-allocated buffers duplicated in new buffers.
18525 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
18526 #[repr(C)]
18527 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
18528 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18529         /// A pointer to the contents in the success state.
18530         /// Reading from this pointer when `result_ok` is not set is undefined.
18531         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
18532         /// A pointer to the contents in the error state.
18533         /// Reading from this pointer when `result_ok` is set is undefined.
18534         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18535 }
18536 #[repr(C)]
18537 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18538 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18540 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18541         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
18542         /// `err` or `result` depending on the state of `result_ok`.
18543         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
18544         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
18545         pub result_ok: bool,
18546 }
18547 #[no_mangle]
18548 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
18549 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18550         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18551                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18552                         result: Box::into_raw(Box::new(o)),
18553                 },
18554                 result_ok: true,
18555         }
18556 }
18557 #[no_mangle]
18558 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
18559 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18560         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18561                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18562                         err: Box::into_raw(Box::new(e)),
18563                 },
18564                 result_ok: false,
18565         }
18566 }
18567 /// Checks if the given object is currently in the success state
18568 #[no_mangle]
18569 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
18570         o.result_ok
18571 }
18572 #[no_mangle]
18573 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
18574 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
18575 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18576         fn drop(&mut self) {
18577                 if self.result_ok {
18578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18580                         }
18581                 } else {
18582                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18583                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18584                         }
18585                 }
18586         }
18587 }
18588 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18589         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18590                 let contents = if o.result_ok {
18591                         let result = unsafe { o.contents.result };
18592                         unsafe { o.contents.result = core::ptr::null_mut() };
18593                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
18594                 } else {
18595                         let err = unsafe { o.contents.err };
18596                         unsafe { o.contents.err = core::ptr::null_mut(); }
18597                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
18598                 };
18599                 Self {
18600                         contents,
18601                         result_ok: o.result_ok,
18602                 }
18603         }
18604 }
18605 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18606         fn clone(&self) -> Self {
18607                 if self.result_ok {
18608                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18609                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18610                         } }
18611                 } else {
18612                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18613                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18614                         } }
18615                 }
18616         }
18617 }
18618 #[no_mangle]
18619 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18620 /// but with all dynamically-allocated buffers duplicated in new buffers.
18621 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18622 #[repr(C)]
18623 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
18624 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
18625         /// A pointer to the contents in the success state.
18626         /// Reading from this pointer when `result_ok` is not set is undefined.
18627         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
18628         /// A pointer to the contents in the error state.
18629         /// Reading from this pointer when `result_ok` is set is undefined.
18630         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18631 }
18632 #[repr(C)]
18633 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18634 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18636 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
18637         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
18638         /// `err` or `result` depending on the state of `result_ok`.
18639         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
18640         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
18641         pub result_ok: bool,
18642 }
18643 #[no_mangle]
18644 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
18645 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18646         CResult_ChannelTransactionParametersDecodeErrorZ {
18647                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18648                         result: Box::into_raw(Box::new(o)),
18649                 },
18650                 result_ok: true,
18651         }
18652 }
18653 #[no_mangle]
18654 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
18655 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18656         CResult_ChannelTransactionParametersDecodeErrorZ {
18657                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18658                         err: Box::into_raw(Box::new(e)),
18659                 },
18660                 result_ok: false,
18661         }
18662 }
18663 /// Checks if the given object is currently in the success state
18664 #[no_mangle]
18665 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
18666         o.result_ok
18667 }
18668 #[no_mangle]
18669 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
18670 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
18671 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
18672         fn drop(&mut self) {
18673                 if self.result_ok {
18674                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18675                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18676                         }
18677                 } else {
18678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18680                         }
18681                 }
18682         }
18683 }
18684 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
18685         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18686                 let contents = if o.result_ok {
18687                         let result = unsafe { o.contents.result };
18688                         unsafe { o.contents.result = core::ptr::null_mut() };
18689                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
18690                 } else {
18691                         let err = unsafe { o.contents.err };
18692                         unsafe { o.contents.err = core::ptr::null_mut(); }
18693                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
18694                 };
18695                 Self {
18696                         contents,
18697                         result_ok: o.result_ok,
18698                 }
18699         }
18700 }
18701 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
18702         fn clone(&self) -> Self {
18703                 if self.result_ok {
18704                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18705                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18706                         } }
18707                 } else {
18708                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18709                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18710                         } }
18711                 }
18712         }
18713 }
18714 #[no_mangle]
18715 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18716 /// but with all dynamically-allocated buffers duplicated in new buffers.
18717 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18718 #[repr(C)]
18719 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
18720 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18721         /// A pointer to the contents in the success state.
18722         /// Reading from this pointer when `result_ok` is not set is undefined.
18723         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
18724         /// A pointer to the contents in the error state.
18725         /// Reading from this pointer when `result_ok` is set is undefined.
18726         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18727 }
18728 #[repr(C)]
18729 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18730 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18732 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
18733         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
18734         /// `err` or `result` depending on the state of `result_ok`.
18735         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
18736         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
18737         pub result_ok: bool,
18738 }
18739 #[no_mangle]
18740 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
18741 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18742         CResult_HolderCommitmentTransactionDecodeErrorZ {
18743                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18744                         result: Box::into_raw(Box::new(o)),
18745                 },
18746                 result_ok: true,
18747         }
18748 }
18749 #[no_mangle]
18750 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
18751 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18752         CResult_HolderCommitmentTransactionDecodeErrorZ {
18753                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18754                         err: Box::into_raw(Box::new(e)),
18755                 },
18756                 result_ok: false,
18757         }
18758 }
18759 /// Checks if the given object is currently in the success state
18760 #[no_mangle]
18761 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
18762         o.result_ok
18763 }
18764 #[no_mangle]
18765 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
18766 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
18767 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
18768         fn drop(&mut self) {
18769                 if self.result_ok {
18770                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18771                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18772                         }
18773                 } else {
18774                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18775                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18776                         }
18777                 }
18778         }
18779 }
18780 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
18781         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18782                 let contents = if o.result_ok {
18783                         let result = unsafe { o.contents.result };
18784                         unsafe { o.contents.result = core::ptr::null_mut() };
18785                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
18786                 } else {
18787                         let err = unsafe { o.contents.err };
18788                         unsafe { o.contents.err = core::ptr::null_mut(); }
18789                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
18790                 };
18791                 Self {
18792                         contents,
18793                         result_ok: o.result_ok,
18794                 }
18795         }
18796 }
18797 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
18798         fn clone(&self) -> Self {
18799                 if self.result_ok {
18800                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18801                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18802                         } }
18803                 } else {
18804                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18805                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18806                         } }
18807                 }
18808         }
18809 }
18810 #[no_mangle]
18811 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18812 /// but with all dynamically-allocated buffers duplicated in new buffers.
18813 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18814 #[repr(C)]
18815 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
18816 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18817         /// A pointer to the contents in the success state.
18818         /// Reading from this pointer when `result_ok` is not set is undefined.
18819         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
18820         /// A pointer to the contents in the error state.
18821         /// Reading from this pointer when `result_ok` is set is undefined.
18822         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18823 }
18824 #[repr(C)]
18825 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18826 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18828 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
18829         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
18830         /// `err` or `result` depending on the state of `result_ok`.
18831         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
18832         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
18833         pub result_ok: bool,
18834 }
18835 #[no_mangle]
18836 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
18837 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18838         CResult_BuiltCommitmentTransactionDecodeErrorZ {
18839                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18840                         result: Box::into_raw(Box::new(o)),
18841                 },
18842                 result_ok: true,
18843         }
18844 }
18845 #[no_mangle]
18846 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
18847 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18848         CResult_BuiltCommitmentTransactionDecodeErrorZ {
18849                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18850                         err: Box::into_raw(Box::new(e)),
18851                 },
18852                 result_ok: false,
18853         }
18854 }
18855 /// Checks if the given object is currently in the success state
18856 #[no_mangle]
18857 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
18858         o.result_ok
18859 }
18860 #[no_mangle]
18861 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
18862 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
18863 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18864         fn drop(&mut self) {
18865                 if self.result_ok {
18866                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18867                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18868                         }
18869                 } else {
18870                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18871                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18872                         }
18873                 }
18874         }
18875 }
18876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18877         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18878                 let contents = if o.result_ok {
18879                         let result = unsafe { o.contents.result };
18880                         unsafe { o.contents.result = core::ptr::null_mut() };
18881                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
18882                 } else {
18883                         let err = unsafe { o.contents.err };
18884                         unsafe { o.contents.err = core::ptr::null_mut(); }
18885                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
18886                 };
18887                 Self {
18888                         contents,
18889                         result_ok: o.result_ok,
18890                 }
18891         }
18892 }
18893 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18894         fn clone(&self) -> Self {
18895                 if self.result_ok {
18896                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18897                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18898                         } }
18899                 } else {
18900                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18901                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18902                         } }
18903                 }
18904         }
18905 }
18906 #[no_mangle]
18907 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18908 /// but with all dynamically-allocated buffers duplicated in new buffers.
18909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18910 #[repr(C)]
18911 /// The contents of CResult_TrustedClosingTransactionNoneZ
18912 pub union CResult_TrustedClosingTransactionNoneZPtr {
18913         /// A pointer to the contents in the success state.
18914         /// Reading from this pointer when `result_ok` is not set is undefined.
18915         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
18916         /// Note that this value is always NULL, as there are no contents in the Err variant
18917         pub err: *mut core::ffi::c_void,
18918 }
18919 #[repr(C)]
18920 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
18921 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
18922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18923 pub struct CResult_TrustedClosingTransactionNoneZ {
18924         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
18925         /// `err` or `result` depending on the state of `result_ok`.
18926         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
18927         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
18928         pub result_ok: bool,
18929 }
18930 #[no_mangle]
18931 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
18932 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
18933         CResult_TrustedClosingTransactionNoneZ {
18934                 contents: CResult_TrustedClosingTransactionNoneZPtr {
18935                         result: Box::into_raw(Box::new(o)),
18936                 },
18937                 result_ok: true,
18938         }
18939 }
18940 #[no_mangle]
18941 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
18942 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
18943         CResult_TrustedClosingTransactionNoneZ {
18944                 contents: CResult_TrustedClosingTransactionNoneZPtr {
18945                         err: core::ptr::null_mut(),
18946                 },
18947                 result_ok: false,
18948         }
18949 }
18950 /// Checks if the given object is currently in the success state
18951 #[no_mangle]
18952 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
18953         o.result_ok
18954 }
18955 #[no_mangle]
18956 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
18957 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
18958 impl Drop for CResult_TrustedClosingTransactionNoneZ {
18959         fn drop(&mut self) {
18960                 if self.result_ok {
18961                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18962                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18963                         }
18964                 } else {
18965                 }
18966         }
18967 }
18968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
18969         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
18970                 let contents = if o.result_ok {
18971                         let result = unsafe { o.contents.result };
18972                         unsafe { o.contents.result = core::ptr::null_mut() };
18973                         CResult_TrustedClosingTransactionNoneZPtr { result }
18974                 } else {
18975                         let _ = unsafe { Box::from_raw(o.contents.err) };
18976                         o.contents.err = core::ptr::null_mut();
18977                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
18978                 };
18979                 Self {
18980                         contents,
18981                         result_ok: o.result_ok,
18982                 }
18983         }
18984 }
18985 #[repr(C)]
18986 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
18987 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
18988         /// A pointer to the contents in the success state.
18989         /// Reading from this pointer when `result_ok` is not set is undefined.
18990         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
18991         /// A pointer to the contents in the error state.
18992         /// Reading from this pointer when `result_ok` is set is undefined.
18993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18994 }
18995 #[repr(C)]
18996 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18997 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18999 pub struct CResult_CommitmentTransactionDecodeErrorZ {
19000         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
19001         /// `err` or `result` depending on the state of `result_ok`.
19002         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
19003         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
19004         pub result_ok: bool,
19005 }
19006 #[no_mangle]
19007 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
19008 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
19009         CResult_CommitmentTransactionDecodeErrorZ {
19010                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19011                         result: Box::into_raw(Box::new(o)),
19012                 },
19013                 result_ok: true,
19014         }
19015 }
19016 #[no_mangle]
19017 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
19018 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
19019         CResult_CommitmentTransactionDecodeErrorZ {
19020                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19021                         err: Box::into_raw(Box::new(e)),
19022                 },
19023                 result_ok: false,
19024         }
19025 }
19026 /// Checks if the given object is currently in the success state
19027 #[no_mangle]
19028 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
19029         o.result_ok
19030 }
19031 #[no_mangle]
19032 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
19033 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
19034 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
19035         fn drop(&mut self) {
19036                 if self.result_ok {
19037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19039                         }
19040                 } else {
19041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19043                         }
19044                 }
19045         }
19046 }
19047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
19048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
19049                 let contents = if o.result_ok {
19050                         let result = unsafe { o.contents.result };
19051                         unsafe { o.contents.result = core::ptr::null_mut() };
19052                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
19053                 } else {
19054                         let err = unsafe { o.contents.err };
19055                         unsafe { o.contents.err = core::ptr::null_mut(); }
19056                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
19057                 };
19058                 Self {
19059                         contents,
19060                         result_ok: o.result_ok,
19061                 }
19062         }
19063 }
19064 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
19065         fn clone(&self) -> Self {
19066                 if self.result_ok {
19067                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19068                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
19069                         } }
19070                 } else {
19071                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19073                         } }
19074                 }
19075         }
19076 }
19077 #[no_mangle]
19078 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
19079 /// but with all dynamically-allocated buffers duplicated in new buffers.
19080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
19081 #[repr(C)]
19082 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
19083 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
19084         /// A pointer to the contents in the success state.
19085         /// Reading from this pointer when `result_ok` is not set is undefined.
19086         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
19087         /// Note that this value is always NULL, as there are no contents in the Err variant
19088         pub err: *mut core::ffi::c_void,
19089 }
19090 #[repr(C)]
19091 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
19092 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
19093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19094 pub struct CResult_TrustedCommitmentTransactionNoneZ {
19095         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
19096         /// `err` or `result` depending on the state of `result_ok`.
19097         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
19098         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
19099         pub result_ok: bool,
19100 }
19101 #[no_mangle]
19102 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
19103 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
19104         CResult_TrustedCommitmentTransactionNoneZ {
19105                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
19106                         result: Box::into_raw(Box::new(o)),
19107                 },
19108                 result_ok: true,
19109         }
19110 }
19111 #[no_mangle]
19112 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
19113 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
19114         CResult_TrustedCommitmentTransactionNoneZ {
19115                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
19116                         err: core::ptr::null_mut(),
19117                 },
19118                 result_ok: false,
19119         }
19120 }
19121 /// Checks if the given object is currently in the success state
19122 #[no_mangle]
19123 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
19124         o.result_ok
19125 }
19126 #[no_mangle]
19127 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
19128 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
19129 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
19130         fn drop(&mut self) {
19131                 if self.result_ok {
19132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19134                         }
19135                 } else {
19136                 }
19137         }
19138 }
19139 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
19140         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
19141                 let contents = if o.result_ok {
19142                         let result = unsafe { o.contents.result };
19143                         unsafe { o.contents.result = core::ptr::null_mut() };
19144                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
19145                 } else {
19146                         let _ = unsafe { Box::from_raw(o.contents.err) };
19147                         o.contents.err = core::ptr::null_mut();
19148                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
19149                 };
19150                 Self {
19151                         contents,
19152                         result_ok: o.result_ok,
19153                 }
19154         }
19155 }
19156 #[repr(C)]
19157 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
19158 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
19159         /// A pointer to the contents in the success state.
19160         /// Reading from this pointer when `result_ok` is not set is undefined.
19161         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
19162         /// Note that this value is always NULL, as there are no contents in the Err variant
19163         pub err: *mut core::ffi::c_void,
19164 }
19165 #[repr(C)]
19166 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
19167 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
19168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19169 pub struct CResult_CVec_ECDSASignatureZNoneZ {
19170         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
19171         /// `err` or `result` depending on the state of `result_ok`.
19172         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
19173         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
19174         pub result_ok: bool,
19175 }
19176 #[no_mangle]
19177 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
19178 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
19179         CResult_CVec_ECDSASignatureZNoneZ {
19180                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19181                         result: Box::into_raw(Box::new(o)),
19182                 },
19183                 result_ok: true,
19184         }
19185 }
19186 #[no_mangle]
19187 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
19188 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
19189         CResult_CVec_ECDSASignatureZNoneZ {
19190                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19191                         err: core::ptr::null_mut(),
19192                 },
19193                 result_ok: false,
19194         }
19195 }
19196 /// Checks if the given object is currently in the success state
19197 #[no_mangle]
19198 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
19199         o.result_ok
19200 }
19201 #[no_mangle]
19202 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
19203 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
19204 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
19205         fn drop(&mut self) {
19206                 if self.result_ok {
19207                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19208                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19209                         }
19210                 } else {
19211                 }
19212         }
19213 }
19214 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
19215         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
19216                 let contents = if o.result_ok {
19217                         let result = unsafe { o.contents.result };
19218                         unsafe { o.contents.result = core::ptr::null_mut() };
19219                         CResult_CVec_ECDSASignatureZNoneZPtr { result }
19220                 } else {
19221                         let _ = unsafe { Box::from_raw(o.contents.err) };
19222                         o.contents.err = core::ptr::null_mut();
19223                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
19224                 };
19225                 Self {
19226                         contents,
19227                         result_ok: o.result_ok,
19228                 }
19229         }
19230 }
19231 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
19232         fn clone(&self) -> Self {
19233                 if self.result_ok {
19234                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19235                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
19236                         } }
19237                 } else {
19238                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19239                                 err: core::ptr::null_mut()
19240                         } }
19241                 }
19242         }
19243 }
19244 #[no_mangle]
19245 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
19246 /// but with all dynamically-allocated buffers duplicated in new buffers.
19247 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
19248 #[repr(C)]
19249 #[derive(Clone)]
19250 /// An enum which can either contain a usize or not
19251 pub enum COption_usizeZ {
19252         /// When we're in this state, this COption_usizeZ contains a usize
19253         Some(usize),
19254         /// When we're in this state, this COption_usizeZ contains nothing
19255         None
19256 }
19257 impl COption_usizeZ {
19258         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19259                 if let Self::None = self { false } else { true }
19260         }
19261         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19262                 !self.is_some()
19263         }
19264         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
19265                 if let Self::Some(v) = self { v } else { unreachable!() }
19266         }
19267 }
19268 #[no_mangle]
19269 /// Constructs a new COption_usizeZ containing a usize
19270 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
19271         COption_usizeZ::Some(o)
19272 }
19273 #[no_mangle]
19274 /// Constructs a new COption_usizeZ containing nothing
19275 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
19276         COption_usizeZ::None
19277 }
19278 #[no_mangle]
19279 /// Frees any resources associated with the usize, if we are in the Some state
19280 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
19281 #[no_mangle]
19282 /// Creates a new COption_usizeZ which has the same data as `orig`
19283 /// but with all dynamically-allocated buffers duplicated in new buffers.
19284 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
19285 #[repr(C)]
19286 /// The contents of CResult_ShutdownScriptDecodeErrorZ
19287 pub union CResult_ShutdownScriptDecodeErrorZPtr {
19288         /// A pointer to the contents in the success state.
19289         /// Reading from this pointer when `result_ok` is not set is undefined.
19290         pub result: *mut crate::lightning::ln::script::ShutdownScript,
19291         /// A pointer to the contents in the error state.
19292         /// Reading from this pointer when `result_ok` is set is undefined.
19293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19294 }
19295 #[repr(C)]
19296 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
19297 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
19298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19299 pub struct CResult_ShutdownScriptDecodeErrorZ {
19300         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
19301         /// `err` or `result` depending on the state of `result_ok`.
19302         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
19303         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
19304         pub result_ok: bool,
19305 }
19306 #[no_mangle]
19307 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
19308 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
19309         CResult_ShutdownScriptDecodeErrorZ {
19310                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19311                         result: Box::into_raw(Box::new(o)),
19312                 },
19313                 result_ok: true,
19314         }
19315 }
19316 #[no_mangle]
19317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
19318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
19319         CResult_ShutdownScriptDecodeErrorZ {
19320                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19321                         err: Box::into_raw(Box::new(e)),
19322                 },
19323                 result_ok: false,
19324         }
19325 }
19326 /// Checks if the given object is currently in the success state
19327 #[no_mangle]
19328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
19329         o.result_ok
19330 }
19331 #[no_mangle]
19332 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
19333 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
19334 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
19335         fn drop(&mut self) {
19336                 if self.result_ok {
19337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19339                         }
19340                 } else {
19341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19343                         }
19344                 }
19345         }
19346 }
19347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
19348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
19349                 let contents = if o.result_ok {
19350                         let result = unsafe { o.contents.result };
19351                         unsafe { o.contents.result = core::ptr::null_mut() };
19352                         CResult_ShutdownScriptDecodeErrorZPtr { result }
19353                 } else {
19354                         let err = unsafe { o.contents.err };
19355                         unsafe { o.contents.err = core::ptr::null_mut(); }
19356                         CResult_ShutdownScriptDecodeErrorZPtr { err }
19357                 };
19358                 Self {
19359                         contents,
19360                         result_ok: o.result_ok,
19361                 }
19362         }
19363 }
19364 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
19365         fn clone(&self) -> Self {
19366                 if self.result_ok {
19367                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19368                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19369                         } }
19370                 } else {
19371                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19373                         } }
19374                 }
19375         }
19376 }
19377 #[no_mangle]
19378 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
19379 /// but with all dynamically-allocated buffers duplicated in new buffers.
19380 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
19381 #[repr(C)]
19382 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
19383 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19384         /// A pointer to the contents in the success state.
19385         /// Reading from this pointer when `result_ok` is not set is undefined.
19386         pub result: *mut crate::lightning::ln::script::ShutdownScript,
19387         /// A pointer to the contents in the error state.
19388         /// Reading from this pointer when `result_ok` is set is undefined.
19389         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
19390 }
19391 #[repr(C)]
19392 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
19393 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
19394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19395 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
19396         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
19397         /// `err` or `result` depending on the state of `result_ok`.
19398         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
19399         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
19400         pub result_ok: bool,
19401 }
19402 #[no_mangle]
19403 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
19404 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19405         CResult_ShutdownScriptInvalidShutdownScriptZ {
19406                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19407                         result: Box::into_raw(Box::new(o)),
19408                 },
19409                 result_ok: true,
19410         }
19411 }
19412 #[no_mangle]
19413 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
19414 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19415         CResult_ShutdownScriptInvalidShutdownScriptZ {
19416                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19417                         err: Box::into_raw(Box::new(e)),
19418                 },
19419                 result_ok: false,
19420         }
19421 }
19422 /// Checks if the given object is currently in the success state
19423 #[no_mangle]
19424 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
19425         o.result_ok
19426 }
19427 #[no_mangle]
19428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
19429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
19430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
19431         fn drop(&mut self) {
19432                 if self.result_ok {
19433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19435                         }
19436                 } else {
19437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19439                         }
19440                 }
19441         }
19442 }
19443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
19444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
19445                 let contents = if o.result_ok {
19446                         let result = unsafe { o.contents.result };
19447                         unsafe { o.contents.result = core::ptr::null_mut() };
19448                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
19449                 } else {
19450                         let err = unsafe { o.contents.err };
19451                         unsafe { o.contents.err = core::ptr::null_mut(); }
19452                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
19453                 };
19454                 Self {
19455                         contents,
19456                         result_ok: o.result_ok,
19457                 }
19458         }
19459 }
19460 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
19461         fn clone(&self) -> Self {
19462                 if self.result_ok {
19463                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19464                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19465                         } }
19466                 } else {
19467                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19468                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
19469                         } }
19470                 }
19471         }
19472 }
19473 #[no_mangle]
19474 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
19475 /// but with all dynamically-allocated buffers duplicated in new buffers.
19476 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
19477 #[repr(C)]
19478 /// The contents of CResult_PaymentPurposeDecodeErrorZ
19479 pub union CResult_PaymentPurposeDecodeErrorZPtr {
19480         /// A pointer to the contents in the success state.
19481         /// Reading from this pointer when `result_ok` is not set is undefined.
19482         pub result: *mut crate::lightning::events::PaymentPurpose,
19483         /// A pointer to the contents in the error state.
19484         /// Reading from this pointer when `result_ok` is set is undefined.
19485         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19486 }
19487 #[repr(C)]
19488 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
19489 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
19490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19491 pub struct CResult_PaymentPurposeDecodeErrorZ {
19492         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
19493         /// `err` or `result` depending on the state of `result_ok`.
19494         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
19495         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
19496         pub result_ok: bool,
19497 }
19498 #[no_mangle]
19499 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
19500 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
19501         CResult_PaymentPurposeDecodeErrorZ {
19502                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19503                         result: Box::into_raw(Box::new(o)),
19504                 },
19505                 result_ok: true,
19506         }
19507 }
19508 #[no_mangle]
19509 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
19510 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
19511         CResult_PaymentPurposeDecodeErrorZ {
19512                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19513                         err: Box::into_raw(Box::new(e)),
19514                 },
19515                 result_ok: false,
19516         }
19517 }
19518 /// Checks if the given object is currently in the success state
19519 #[no_mangle]
19520 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
19521         o.result_ok
19522 }
19523 #[no_mangle]
19524 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
19525 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
19526 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
19527         fn drop(&mut self) {
19528                 if self.result_ok {
19529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19531                         }
19532                 } else {
19533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19535                         }
19536                 }
19537         }
19538 }
19539 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
19540         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
19541                 let contents = if o.result_ok {
19542                         let result = unsafe { o.contents.result };
19543                         unsafe { o.contents.result = core::ptr::null_mut() };
19544                         CResult_PaymentPurposeDecodeErrorZPtr { result }
19545                 } else {
19546                         let err = unsafe { o.contents.err };
19547                         unsafe { o.contents.err = core::ptr::null_mut(); }
19548                         CResult_PaymentPurposeDecodeErrorZPtr { err }
19549                 };
19550                 Self {
19551                         contents,
19552                         result_ok: o.result_ok,
19553                 }
19554         }
19555 }
19556 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
19557         fn clone(&self) -> Self {
19558                 if self.result_ok {
19559                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19560                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
19561                         } }
19562                 } else {
19563                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19564                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19565                         } }
19566                 }
19567         }
19568 }
19569 #[no_mangle]
19570 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
19571 /// but with all dynamically-allocated buffers duplicated in new buffers.
19572 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
19573 #[repr(C)]
19574 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
19575 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
19576         /// A pointer to the contents in the success state.
19577         /// Reading from this pointer when `result_ok` is not set is undefined.
19578         pub result: *mut crate::lightning::events::ClaimedHTLC,
19579         /// A pointer to the contents in the error state.
19580         /// Reading from this pointer when `result_ok` is set is undefined.
19581         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19582 }
19583 #[repr(C)]
19584 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
19585 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19587 pub struct CResult_ClaimedHTLCDecodeErrorZ {
19588         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
19589         /// `err` or `result` depending on the state of `result_ok`.
19590         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
19591         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
19592         pub result_ok: bool,
19593 }
19594 #[no_mangle]
19595 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
19596 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
19597         CResult_ClaimedHTLCDecodeErrorZ {
19598                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19599                         result: Box::into_raw(Box::new(o)),
19600                 },
19601                 result_ok: true,
19602         }
19603 }
19604 #[no_mangle]
19605 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
19606 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
19607         CResult_ClaimedHTLCDecodeErrorZ {
19608                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19609                         err: Box::into_raw(Box::new(e)),
19610                 },
19611                 result_ok: false,
19612         }
19613 }
19614 /// Checks if the given object is currently in the success state
19615 #[no_mangle]
19616 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
19617         o.result_ok
19618 }
19619 #[no_mangle]
19620 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
19621 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
19622 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
19623         fn drop(&mut self) {
19624                 if self.result_ok {
19625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19627                         }
19628                 } else {
19629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19631                         }
19632                 }
19633         }
19634 }
19635 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
19636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19637                 let contents = if o.result_ok {
19638                         let result = unsafe { o.contents.result };
19639                         unsafe { o.contents.result = core::ptr::null_mut() };
19640                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
19641                 } else {
19642                         let err = unsafe { o.contents.err };
19643                         unsafe { o.contents.err = core::ptr::null_mut(); }
19644                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
19645                 };
19646                 Self {
19647                         contents,
19648                         result_ok: o.result_ok,
19649                 }
19650         }
19651 }
19652 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
19653         fn clone(&self) -> Self {
19654                 if self.result_ok {
19655                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19656                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
19657                         } }
19658                 } else {
19659                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19661                         } }
19662                 }
19663         }
19664 }
19665 #[no_mangle]
19666 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
19667 /// but with all dynamically-allocated buffers duplicated in new buffers.
19668 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
19669 #[repr(C)]
19670 #[derive(Clone)]
19671 /// An enum which can either contain a crate::lightning::events::PathFailure or not
19672 pub enum COption_PathFailureZ {
19673         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
19674         Some(crate::lightning::events::PathFailure),
19675         /// When we're in this state, this COption_PathFailureZ contains nothing
19676         None
19677 }
19678 impl COption_PathFailureZ {
19679         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19680                 if let Self::None = self { false } else { true }
19681         }
19682         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19683                 !self.is_some()
19684         }
19685         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
19686                 if let Self::Some(v) = self { v } else { unreachable!() }
19687         }
19688 }
19689 #[no_mangle]
19690 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
19691 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
19692         COption_PathFailureZ::Some(o)
19693 }
19694 #[no_mangle]
19695 /// Constructs a new COption_PathFailureZ containing nothing
19696 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
19697         COption_PathFailureZ::None
19698 }
19699 #[no_mangle]
19700 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
19701 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
19702 #[no_mangle]
19703 /// Creates a new COption_PathFailureZ which has the same data as `orig`
19704 /// but with all dynamically-allocated buffers duplicated in new buffers.
19705 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
19706 #[repr(C)]
19707 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
19708 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
19709         /// A pointer to the contents in the success state.
19710         /// Reading from this pointer when `result_ok` is not set is undefined.
19711         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
19712         /// A pointer to the contents in the error state.
19713         /// Reading from this pointer when `result_ok` is set is undefined.
19714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19715 }
19716 #[repr(C)]
19717 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
19718 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19720 pub struct CResult_COption_PathFailureZDecodeErrorZ {
19721         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
19722         /// `err` or `result` depending on the state of `result_ok`.
19723         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
19724         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
19725         pub result_ok: bool,
19726 }
19727 #[no_mangle]
19728 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
19729 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
19730         CResult_COption_PathFailureZDecodeErrorZ {
19731                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19732                         result: Box::into_raw(Box::new(o)),
19733                 },
19734                 result_ok: true,
19735         }
19736 }
19737 #[no_mangle]
19738 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
19739 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
19740         CResult_COption_PathFailureZDecodeErrorZ {
19741                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19742                         err: Box::into_raw(Box::new(e)),
19743                 },
19744                 result_ok: false,
19745         }
19746 }
19747 /// Checks if the given object is currently in the success state
19748 #[no_mangle]
19749 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
19750         o.result_ok
19751 }
19752 #[no_mangle]
19753 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
19754 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
19755 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
19756         fn drop(&mut self) {
19757                 if self.result_ok {
19758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19760                         }
19761                 } else {
19762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19764                         }
19765                 }
19766         }
19767 }
19768 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
19769         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19770                 let contents = if o.result_ok {
19771                         let result = unsafe { o.contents.result };
19772                         unsafe { o.contents.result = core::ptr::null_mut() };
19773                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
19774                 } else {
19775                         let err = unsafe { o.contents.err };
19776                         unsafe { o.contents.err = core::ptr::null_mut(); }
19777                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
19778                 };
19779                 Self {
19780                         contents,
19781                         result_ok: o.result_ok,
19782                 }
19783         }
19784 }
19785 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
19786         fn clone(&self) -> Self {
19787                 if self.result_ok {
19788                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19789                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
19790                         } }
19791                 } else {
19792                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19793                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19794                         } }
19795                 }
19796         }
19797 }
19798 #[no_mangle]
19799 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
19800 /// but with all dynamically-allocated buffers duplicated in new buffers.
19801 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
19802 #[repr(C)]
19803 #[derive(Clone)]
19804 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
19805 pub enum COption_ClosureReasonZ {
19806         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
19807         Some(crate::lightning::events::ClosureReason),
19808         /// When we're in this state, this COption_ClosureReasonZ contains nothing
19809         None
19810 }
19811 impl COption_ClosureReasonZ {
19812         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19813                 if let Self::None = self { false } else { true }
19814         }
19815         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19816                 !self.is_some()
19817         }
19818         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
19819                 if let Self::Some(v) = self { v } else { unreachable!() }
19820         }
19821 }
19822 #[no_mangle]
19823 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
19824 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
19825         COption_ClosureReasonZ::Some(o)
19826 }
19827 #[no_mangle]
19828 /// Constructs a new COption_ClosureReasonZ containing nothing
19829 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
19830         COption_ClosureReasonZ::None
19831 }
19832 #[no_mangle]
19833 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
19834 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
19835 #[no_mangle]
19836 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
19837 /// but with all dynamically-allocated buffers duplicated in new buffers.
19838 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
19839 #[repr(C)]
19840 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
19841 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
19842         /// A pointer to the contents in the success state.
19843         /// Reading from this pointer when `result_ok` is not set is undefined.
19844         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
19845         /// A pointer to the contents in the error state.
19846         /// Reading from this pointer when `result_ok` is set is undefined.
19847         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19848 }
19849 #[repr(C)]
19850 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
19851 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19853 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
19854         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
19855         /// `err` or `result` depending on the state of `result_ok`.
19856         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
19857         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
19858         pub result_ok: bool,
19859 }
19860 #[no_mangle]
19861 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
19862 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19863         CResult_COption_ClosureReasonZDecodeErrorZ {
19864                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19865                         result: Box::into_raw(Box::new(o)),
19866                 },
19867                 result_ok: true,
19868         }
19869 }
19870 #[no_mangle]
19871 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
19872 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19873         CResult_COption_ClosureReasonZDecodeErrorZ {
19874                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19875                         err: Box::into_raw(Box::new(e)),
19876                 },
19877                 result_ok: false,
19878         }
19879 }
19880 /// Checks if the given object is currently in the success state
19881 #[no_mangle]
19882 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
19883         o.result_ok
19884 }
19885 #[no_mangle]
19886 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
19887 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
19888 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
19889         fn drop(&mut self) {
19890                 if self.result_ok {
19891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19893                         }
19894                 } else {
19895                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19896                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19897                         }
19898                 }
19899         }
19900 }
19901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
19902         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19903                 let contents = if o.result_ok {
19904                         let result = unsafe { o.contents.result };
19905                         unsafe { o.contents.result = core::ptr::null_mut() };
19906                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
19907                 } else {
19908                         let err = unsafe { o.contents.err };
19909                         unsafe { o.contents.err = core::ptr::null_mut(); }
19910                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
19911                 };
19912                 Self {
19913                         contents,
19914                         result_ok: o.result_ok,
19915                 }
19916         }
19917 }
19918 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
19919         fn clone(&self) -> Self {
19920                 if self.result_ok {
19921                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19922                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
19923                         } }
19924                 } else {
19925                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19926                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19927                         } }
19928                 }
19929         }
19930 }
19931 #[no_mangle]
19932 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
19933 /// but with all dynamically-allocated buffers duplicated in new buffers.
19934 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
19935 #[repr(C)]
19936 #[derive(Clone)]
19937 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
19938 pub enum COption_HTLCDestinationZ {
19939         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
19940         Some(crate::lightning::events::HTLCDestination),
19941         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
19942         None
19943 }
19944 impl COption_HTLCDestinationZ {
19945         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19946                 if let Self::None = self { false } else { true }
19947         }
19948         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19949                 !self.is_some()
19950         }
19951         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
19952                 if let Self::Some(v) = self { v } else { unreachable!() }
19953         }
19954 }
19955 #[no_mangle]
19956 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
19957 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
19958         COption_HTLCDestinationZ::Some(o)
19959 }
19960 #[no_mangle]
19961 /// Constructs a new COption_HTLCDestinationZ containing nothing
19962 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
19963         COption_HTLCDestinationZ::None
19964 }
19965 #[no_mangle]
19966 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
19967 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
19968 #[no_mangle]
19969 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
19970 /// but with all dynamically-allocated buffers duplicated in new buffers.
19971 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
19972 #[repr(C)]
19973 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
19974 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19975         /// A pointer to the contents in the success state.
19976         /// Reading from this pointer when `result_ok` is not set is undefined.
19977         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
19978         /// A pointer to the contents in the error state.
19979         /// Reading from this pointer when `result_ok` is set is undefined.
19980         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19981 }
19982 #[repr(C)]
19983 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
19984 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19986 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
19987         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
19988         /// `err` or `result` depending on the state of `result_ok`.
19989         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
19990         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
19991         pub result_ok: bool,
19992 }
19993 #[no_mangle]
19994 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
19995 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19996         CResult_COption_HTLCDestinationZDecodeErrorZ {
19997                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19998                         result: Box::into_raw(Box::new(o)),
19999                 },
20000                 result_ok: true,
20001         }
20002 }
20003 #[no_mangle]
20004 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
20005 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
20006         CResult_COption_HTLCDestinationZDecodeErrorZ {
20007                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20008                         err: Box::into_raw(Box::new(e)),
20009                 },
20010                 result_ok: false,
20011         }
20012 }
20013 /// Checks if the given object is currently in the success state
20014 #[no_mangle]
20015 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
20016         o.result_ok
20017 }
20018 #[no_mangle]
20019 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
20020 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
20021 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
20022         fn drop(&mut self) {
20023                 if self.result_ok {
20024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20026                         }
20027                 } else {
20028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20030                         }
20031                 }
20032         }
20033 }
20034 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
20035         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20036                 let contents = if o.result_ok {
20037                         let result = unsafe { o.contents.result };
20038                         unsafe { o.contents.result = core::ptr::null_mut() };
20039                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
20040                 } else {
20041                         let err = unsafe { o.contents.err };
20042                         unsafe { o.contents.err = core::ptr::null_mut(); }
20043                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
20044                 };
20045                 Self {
20046                         contents,
20047                         result_ok: o.result_ok,
20048                 }
20049         }
20050 }
20051 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
20052         fn clone(&self) -> Self {
20053                 if self.result_ok {
20054                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20055                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
20056                         } }
20057                 } else {
20058                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20059                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20060                         } }
20061                 }
20062         }
20063 }
20064 #[no_mangle]
20065 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
20066 /// but with all dynamically-allocated buffers duplicated in new buffers.
20067 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
20068 #[repr(C)]
20069 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
20070 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
20071         /// A pointer to the contents in the success state.
20072         /// Reading from this pointer when `result_ok` is not set is undefined.
20073         pub result: *mut crate::lightning::events::PaymentFailureReason,
20074         /// A pointer to the contents in the error state.
20075         /// Reading from this pointer when `result_ok` is set is undefined.
20076         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20077 }
20078 #[repr(C)]
20079 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
20080 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
20081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20082 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
20083         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
20084         /// `err` or `result` depending on the state of `result_ok`.
20085         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
20086         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
20087         pub result_ok: bool,
20088 }
20089 #[no_mangle]
20090 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
20091 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
20092         CResult_PaymentFailureReasonDecodeErrorZ {
20093                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20094                         result: Box::into_raw(Box::new(o)),
20095                 },
20096                 result_ok: true,
20097         }
20098 }
20099 #[no_mangle]
20100 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
20101 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
20102         CResult_PaymentFailureReasonDecodeErrorZ {
20103                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20104                         err: Box::into_raw(Box::new(e)),
20105                 },
20106                 result_ok: false,
20107         }
20108 }
20109 /// Checks if the given object is currently in the success state
20110 #[no_mangle]
20111 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
20112         o.result_ok
20113 }
20114 #[no_mangle]
20115 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
20116 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
20117 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
20118         fn drop(&mut self) {
20119                 if self.result_ok {
20120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20122                         }
20123                 } else {
20124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20126                         }
20127                 }
20128         }
20129 }
20130 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
20131         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
20132                 let contents = if o.result_ok {
20133                         let result = unsafe { o.contents.result };
20134                         unsafe { o.contents.result = core::ptr::null_mut() };
20135                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
20136                 } else {
20137                         let err = unsafe { o.contents.err };
20138                         unsafe { o.contents.err = core::ptr::null_mut(); }
20139                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
20140                 };
20141                 Self {
20142                         contents,
20143                         result_ok: o.result_ok,
20144                 }
20145         }
20146 }
20147 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
20148         fn clone(&self) -> Self {
20149                 if self.result_ok {
20150                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20151                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
20152                         } }
20153                 } else {
20154                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20156                         } }
20157                 }
20158         }
20159 }
20160 #[no_mangle]
20161 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
20162 /// but with all dynamically-allocated buffers duplicated in new buffers.
20163 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
20164 #[repr(C)]
20165 #[derive(Clone)]
20166 /// An enum which can either contain a crate::c_types::U128 or not
20167 pub enum COption_U128Z {
20168         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
20169         Some(crate::c_types::U128),
20170         /// When we're in this state, this COption_U128Z contains nothing
20171         None
20172 }
20173 impl COption_U128Z {
20174         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20175                 if let Self::None = self { false } else { true }
20176         }
20177         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20178                 !self.is_some()
20179         }
20180         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
20181                 if let Self::Some(v) = self { v } else { unreachable!() }
20182         }
20183 }
20184 #[no_mangle]
20185 /// Constructs a new COption_U128Z containing a crate::c_types::U128
20186 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
20187         COption_U128Z::Some(o)
20188 }
20189 #[no_mangle]
20190 /// Constructs a new COption_U128Z containing nothing
20191 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
20192         COption_U128Z::None
20193 }
20194 #[no_mangle]
20195 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
20196 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
20197 #[no_mangle]
20198 /// Creates a new COption_U128Z which has the same data as `orig`
20199 /// but with all dynamically-allocated buffers duplicated in new buffers.
20200 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
20201 #[repr(C)]
20202 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
20203 /// This corresponds to std::vector in C++
20204 pub struct CVec_ClaimedHTLCZ {
20205         /// The elements in the array.
20206         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20207         pub data: *mut crate::lightning::events::ClaimedHTLC,
20208         /// The number of elements pointed to by `data`.
20209         pub datalen: usize
20210 }
20211 impl CVec_ClaimedHTLCZ {
20212         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
20213                 if self.datalen == 0 { return Vec::new(); }
20214                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20215                 self.data = core::ptr::null_mut();
20216                 self.datalen = 0;
20217                 ret
20218         }
20219         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
20220                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20221         }
20222 }
20223 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
20224         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
20225                 let datalen = v.len();
20226                 let data = Box::into_raw(v.into_boxed_slice());
20227                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20228         }
20229 }
20230 #[no_mangle]
20231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20232 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
20233 impl Drop for CVec_ClaimedHTLCZ {
20234         fn drop(&mut self) {
20235                 if self.datalen == 0 { return; }
20236                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20237         }
20238 }
20239 impl Clone for CVec_ClaimedHTLCZ {
20240         fn clone(&self) -> Self {
20241                 let mut res = Vec::new();
20242                 if self.datalen == 0 { return Self::from(res); }
20243                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20244                 Self::from(res)
20245         }
20246 }
20247 #[repr(C)]
20248 #[derive(Clone)]
20249 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
20250 pub enum COption_PaymentFailureReasonZ {
20251         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
20252         Some(crate::lightning::events::PaymentFailureReason),
20253         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
20254         None
20255 }
20256 impl COption_PaymentFailureReasonZ {
20257         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20258                 if let Self::None = self { false } else { true }
20259         }
20260         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20261                 !self.is_some()
20262         }
20263         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
20264                 if let Self::Some(v) = self { v } else { unreachable!() }
20265         }
20266 }
20267 #[no_mangle]
20268 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
20269 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
20270         COption_PaymentFailureReasonZ::Some(o)
20271 }
20272 #[no_mangle]
20273 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
20274 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
20275         COption_PaymentFailureReasonZ::None
20276 }
20277 #[no_mangle]
20278 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
20279 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
20280 #[no_mangle]
20281 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
20282 /// but with all dynamically-allocated buffers duplicated in new buffers.
20283 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
20284 #[repr(C)]
20285 #[derive(Clone)]
20286 /// An enum which can either contain a crate::lightning::events::Event or not
20287 pub enum COption_EventZ {
20288         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
20289         Some(crate::lightning::events::Event),
20290         /// When we're in this state, this COption_EventZ contains nothing
20291         None
20292 }
20293 impl COption_EventZ {
20294         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20295                 if let Self::None = self { false } else { true }
20296         }
20297         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20298                 !self.is_some()
20299         }
20300         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
20301                 if let Self::Some(v) = self { v } else { unreachable!() }
20302         }
20303 }
20304 #[no_mangle]
20305 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
20306 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
20307         COption_EventZ::Some(o)
20308 }
20309 #[no_mangle]
20310 /// Constructs a new COption_EventZ containing nothing
20311 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
20312         COption_EventZ::None
20313 }
20314 #[no_mangle]
20315 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
20316 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
20317 #[no_mangle]
20318 /// Creates a new COption_EventZ which has the same data as `orig`
20319 /// but with all dynamically-allocated buffers duplicated in new buffers.
20320 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
20321 #[repr(C)]
20322 /// The contents of CResult_COption_EventZDecodeErrorZ
20323 pub union CResult_COption_EventZDecodeErrorZPtr {
20324         /// A pointer to the contents in the success state.
20325         /// Reading from this pointer when `result_ok` is not set is undefined.
20326         pub result: *mut crate::c_types::derived::COption_EventZ,
20327         /// A pointer to the contents in the error state.
20328         /// Reading from this pointer when `result_ok` is set is undefined.
20329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20330 }
20331 #[repr(C)]
20332 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
20333 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20335 pub struct CResult_COption_EventZDecodeErrorZ {
20336         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
20337         /// `err` or `result` depending on the state of `result_ok`.
20338         pub contents: CResult_COption_EventZDecodeErrorZPtr,
20339         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
20340         pub result_ok: bool,
20341 }
20342 #[no_mangle]
20343 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
20344 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
20345         CResult_COption_EventZDecodeErrorZ {
20346                 contents: CResult_COption_EventZDecodeErrorZPtr {
20347                         result: Box::into_raw(Box::new(o)),
20348                 },
20349                 result_ok: true,
20350         }
20351 }
20352 #[no_mangle]
20353 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
20354 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
20355         CResult_COption_EventZDecodeErrorZ {
20356                 contents: CResult_COption_EventZDecodeErrorZPtr {
20357                         err: Box::into_raw(Box::new(e)),
20358                 },
20359                 result_ok: false,
20360         }
20361 }
20362 /// Checks if the given object is currently in the success state
20363 #[no_mangle]
20364 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
20365         o.result_ok
20366 }
20367 #[no_mangle]
20368 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
20369 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
20370 impl Drop for CResult_COption_EventZDecodeErrorZ {
20371         fn drop(&mut self) {
20372                 if self.result_ok {
20373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20375                         }
20376                 } else {
20377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20379                         }
20380                 }
20381         }
20382 }
20383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
20384         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20385                 let contents = if o.result_ok {
20386                         let result = unsafe { o.contents.result };
20387                         unsafe { o.contents.result = core::ptr::null_mut() };
20388                         CResult_COption_EventZDecodeErrorZPtr { result }
20389                 } else {
20390                         let err = unsafe { o.contents.err };
20391                         unsafe { o.contents.err = core::ptr::null_mut(); }
20392                         CResult_COption_EventZDecodeErrorZPtr { err }
20393                 };
20394                 Self {
20395                         contents,
20396                         result_ok: o.result_ok,
20397                 }
20398         }
20399 }
20400 impl Clone for CResult_COption_EventZDecodeErrorZ {
20401         fn clone(&self) -> Self {
20402                 if self.result_ok {
20403                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
20404                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
20405                         } }
20406                 } else {
20407                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
20408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20409                         } }
20410                 }
20411         }
20412 }
20413 #[no_mangle]
20414 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
20415 /// but with all dynamically-allocated buffers duplicated in new buffers.
20416 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
20417 #[repr(C)]
20418 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
20419 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
20420         /// A pointer to the contents in the success state.
20421         /// Reading from this pointer when `result_ok` is not set is undefined.
20422         pub result: *mut crate::lightning_invoice::SiPrefix,
20423         /// A pointer to the contents in the error state.
20424         /// Reading from this pointer when `result_ok` is set is undefined.
20425         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20426 }
20427 #[repr(C)]
20428 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
20429 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20431 pub struct CResult_SiPrefixBolt11ParseErrorZ {
20432         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
20433         /// `err` or `result` depending on the state of `result_ok`.
20434         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
20435         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
20436         pub result_ok: bool,
20437 }
20438 #[no_mangle]
20439 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
20440 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
20441         CResult_SiPrefixBolt11ParseErrorZ {
20442                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20443                         result: Box::into_raw(Box::new(o)),
20444                 },
20445                 result_ok: true,
20446         }
20447 }
20448 #[no_mangle]
20449 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
20450 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
20451         CResult_SiPrefixBolt11ParseErrorZ {
20452                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20453                         err: Box::into_raw(Box::new(e)),
20454                 },
20455                 result_ok: false,
20456         }
20457 }
20458 /// Checks if the given object is currently in the success state
20459 #[no_mangle]
20460 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
20461         o.result_ok
20462 }
20463 #[no_mangle]
20464 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
20465 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
20466 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
20467         fn drop(&mut self) {
20468                 if self.result_ok {
20469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20471                         }
20472                 } else {
20473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20475                         }
20476                 }
20477         }
20478 }
20479 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
20480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20481                 let contents = if o.result_ok {
20482                         let result = unsafe { o.contents.result };
20483                         unsafe { o.contents.result = core::ptr::null_mut() };
20484                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
20485                 } else {
20486                         let err = unsafe { o.contents.err };
20487                         unsafe { o.contents.err = core::ptr::null_mut(); }
20488                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
20489                 };
20490                 Self {
20491                         contents,
20492                         result_ok: o.result_ok,
20493                 }
20494         }
20495 }
20496 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
20497         fn clone(&self) -> Self {
20498                 if self.result_ok {
20499                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20500                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
20501                         } }
20502                 } else {
20503                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20504                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20505                         } }
20506                 }
20507         }
20508 }
20509 #[no_mangle]
20510 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
20511 /// but with all dynamically-allocated buffers duplicated in new buffers.
20512 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
20513 #[repr(C)]
20514 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
20515 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20516         /// A pointer to the contents in the success state.
20517         /// Reading from this pointer when `result_ok` is not set is undefined.
20518         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20519         /// A pointer to the contents in the error state.
20520         /// Reading from this pointer when `result_ok` is set is undefined.
20521         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
20522 }
20523 #[repr(C)]
20524 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
20525 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
20526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20527 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20528         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
20529         /// `err` or `result` depending on the state of `result_ok`.
20530         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
20531         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
20532         pub result_ok: bool,
20533 }
20534 #[no_mangle]
20535 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
20536 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20537         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20538                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20539                         result: Box::into_raw(Box::new(o)),
20540                 },
20541                 result_ok: true,
20542         }
20543 }
20544 #[no_mangle]
20545 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
20546 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20547         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20548                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20549                         err: Box::into_raw(Box::new(e)),
20550                 },
20551                 result_ok: false,
20552         }
20553 }
20554 /// Checks if the given object is currently in the success state
20555 #[no_mangle]
20556 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
20557         o.result_ok
20558 }
20559 #[no_mangle]
20560 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
20561 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
20562 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20563         fn drop(&mut self) {
20564                 if self.result_ok {
20565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20567                         }
20568                 } else {
20569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20571                         }
20572                 }
20573         }
20574 }
20575 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20576         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
20577                 let contents = if o.result_ok {
20578                         let result = unsafe { o.contents.result };
20579                         unsafe { o.contents.result = core::ptr::null_mut() };
20580                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
20581                 } else {
20582                         let err = unsafe { o.contents.err };
20583                         unsafe { o.contents.err = core::ptr::null_mut(); }
20584                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
20585                 };
20586                 Self {
20587                         contents,
20588                         result_ok: o.result_ok,
20589                 }
20590         }
20591 }
20592 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20593         fn clone(&self) -> Self {
20594                 if self.result_ok {
20595                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20596                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20597                         } }
20598                 } else {
20599                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20600                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
20601                         } }
20602                 }
20603         }
20604 }
20605 #[no_mangle]
20606 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
20607 /// but with all dynamically-allocated buffers duplicated in new buffers.
20608 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
20609 #[repr(C)]
20610 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
20611 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20612         /// A pointer to the contents in the success state.
20613         /// Reading from this pointer when `result_ok` is not set is undefined.
20614         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
20615         /// A pointer to the contents in the error state.
20616         /// Reading from this pointer when `result_ok` is set is undefined.
20617         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20618 }
20619 #[repr(C)]
20620 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
20621 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20623 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20624         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
20625         /// `err` or `result` depending on the state of `result_ok`.
20626         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
20627         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
20628         pub result_ok: bool,
20629 }
20630 #[no_mangle]
20631 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
20632 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20633         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20634                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20635                         result: Box::into_raw(Box::new(o)),
20636                 },
20637                 result_ok: true,
20638         }
20639 }
20640 #[no_mangle]
20641 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
20642 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20643         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20644                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20645                         err: Box::into_raw(Box::new(e)),
20646                 },
20647                 result_ok: false,
20648         }
20649 }
20650 /// Checks if the given object is currently in the success state
20651 #[no_mangle]
20652 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
20653         o.result_ok
20654 }
20655 #[no_mangle]
20656 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
20657 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
20658 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20659         fn drop(&mut self) {
20660                 if self.result_ok {
20661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20663                         }
20664                 } else {
20665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20667                         }
20668                 }
20669         }
20670 }
20671 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20673                 let contents = if o.result_ok {
20674                         let result = unsafe { o.contents.result };
20675                         unsafe { o.contents.result = core::ptr::null_mut() };
20676                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
20677                 } else {
20678                         let err = unsafe { o.contents.err };
20679                         unsafe { o.contents.err = core::ptr::null_mut(); }
20680                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
20681                 };
20682                 Self {
20683                         contents,
20684                         result_ok: o.result_ok,
20685                 }
20686         }
20687 }
20688 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20689         fn clone(&self) -> Self {
20690                 if self.result_ok {
20691                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20692                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
20693                         } }
20694                 } else {
20695                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20696                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20697                         } }
20698                 }
20699         }
20700 }
20701 #[no_mangle]
20702 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
20703 /// but with all dynamically-allocated buffers duplicated in new buffers.
20704 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
20705 #[repr(C)]
20706 /// A tuple of 3 elements. See the individual fields for the types contained.
20707 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20708         /// The element at position 0
20709         pub a: crate::lightning_invoice::RawBolt11Invoice,
20710         /// The element at position 1
20711         pub b: crate::c_types::ThirtyTwoBytes,
20712         /// The element at position 2
20713         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
20714 }
20715 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20716         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
20717                 Self {
20718                         a: tup.0,
20719                         b: tup.1,
20720                         c: tup.2,
20721                 }
20722         }
20723 }
20724 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20725         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
20726                 (self.a, self.b, self.c)
20727         }
20728 }
20729 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20730         fn clone(&self) -> Self {
20731                 Self {
20732                         a: Clone::clone(&self.a),
20733                         b: Clone::clone(&self.b),
20734                         c: Clone::clone(&self.c),
20735                 }
20736         }
20737 }
20738 #[no_mangle]
20739 /// Creates a new tuple which has the same data as `orig`
20740 /// but with all dynamically-allocated buffers duplicated in new buffers.
20741 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
20742 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
20743 #[no_mangle]
20744 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 {
20745         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
20746 }
20747
20748 #[no_mangle]
20749 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
20750 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
20751 #[repr(C)]
20752 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
20753 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
20754         /// A pointer to the contents in the success state.
20755         /// Reading from this pointer when `result_ok` is not set is undefined.
20756         pub result: *mut crate::lightning_invoice::PayeePubKey,
20757         /// A pointer to the contents in the error state.
20758         /// Reading from this pointer when `result_ok` is set is undefined.
20759         pub err: *mut crate::c_types::Secp256k1Error,
20760 }
20761 #[repr(C)]
20762 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
20763 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
20764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20765 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
20766         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
20767         /// `err` or `result` depending on the state of `result_ok`.
20768         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
20769         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
20770         pub result_ok: bool,
20771 }
20772 #[no_mangle]
20773 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
20774 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
20775         CResult_PayeePubKeySecp256k1ErrorZ {
20776                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20777                         result: Box::into_raw(Box::new(o)),
20778                 },
20779                 result_ok: true,
20780         }
20781 }
20782 #[no_mangle]
20783 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
20784 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
20785         CResult_PayeePubKeySecp256k1ErrorZ {
20786                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20787                         err: Box::into_raw(Box::new(e)),
20788                 },
20789                 result_ok: false,
20790         }
20791 }
20792 /// Checks if the given object is currently in the success state
20793 #[no_mangle]
20794 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
20795         o.result_ok
20796 }
20797 #[no_mangle]
20798 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
20799 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
20800 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
20801         fn drop(&mut self) {
20802                 if self.result_ok {
20803                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20804                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20805                         }
20806                 } else {
20807                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20808                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20809                         }
20810                 }
20811         }
20812 }
20813 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
20814         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
20815                 let contents = if o.result_ok {
20816                         let result = unsafe { o.contents.result };
20817                         unsafe { o.contents.result = core::ptr::null_mut() };
20818                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
20819                 } else {
20820                         let err = unsafe { o.contents.err };
20821                         unsafe { o.contents.err = core::ptr::null_mut(); }
20822                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
20823                 };
20824                 Self {
20825                         contents,
20826                         result_ok: o.result_ok,
20827                 }
20828         }
20829 }
20830 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
20831         fn clone(&self) -> Self {
20832                 if self.result_ok {
20833                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20834                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
20835                         } }
20836                 } else {
20837                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20838                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20839                         } }
20840                 }
20841         }
20842 }
20843 #[no_mangle]
20844 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
20845 /// but with all dynamically-allocated buffers duplicated in new buffers.
20846 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
20847 #[repr(C)]
20848 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
20849 /// This corresponds to std::vector in C++
20850 pub struct CVec_PrivateRouteZ {
20851         /// The elements in the array.
20852         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20853         pub data: *mut crate::lightning_invoice::PrivateRoute,
20854         /// The number of elements pointed to by `data`.
20855         pub datalen: usize
20856 }
20857 impl CVec_PrivateRouteZ {
20858         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
20859                 if self.datalen == 0 { return Vec::new(); }
20860                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20861                 self.data = core::ptr::null_mut();
20862                 self.datalen = 0;
20863                 ret
20864         }
20865         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
20866                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20867         }
20868 }
20869 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
20870         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
20871                 let datalen = v.len();
20872                 let data = Box::into_raw(v.into_boxed_slice());
20873                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20874         }
20875 }
20876 #[no_mangle]
20877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20878 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
20879 impl Drop for CVec_PrivateRouteZ {
20880         fn drop(&mut self) {
20881                 if self.datalen == 0 { return; }
20882                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20883         }
20884 }
20885 impl Clone for CVec_PrivateRouteZ {
20886         fn clone(&self) -> Self {
20887                 let mut res = Vec::new();
20888                 if self.datalen == 0 { return Self::from(res); }
20889                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20890                 Self::from(res)
20891         }
20892 }
20893 #[repr(C)]
20894 /// The contents of CResult_PositiveTimestampCreationErrorZ
20895 pub union CResult_PositiveTimestampCreationErrorZPtr {
20896         /// A pointer to the contents in the success state.
20897         /// Reading from this pointer when `result_ok` is not set is undefined.
20898         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
20899         /// A pointer to the contents in the error state.
20900         /// Reading from this pointer when `result_ok` is set is undefined.
20901         pub err: *mut crate::lightning_invoice::CreationError,
20902 }
20903 #[repr(C)]
20904 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
20905 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
20906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20907 pub struct CResult_PositiveTimestampCreationErrorZ {
20908         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
20909         /// `err` or `result` depending on the state of `result_ok`.
20910         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
20911         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
20912         pub result_ok: bool,
20913 }
20914 #[no_mangle]
20915 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
20916 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
20917         CResult_PositiveTimestampCreationErrorZ {
20918                 contents: CResult_PositiveTimestampCreationErrorZPtr {
20919                         result: Box::into_raw(Box::new(o)),
20920                 },
20921                 result_ok: true,
20922         }
20923 }
20924 #[no_mangle]
20925 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
20926 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
20927         CResult_PositiveTimestampCreationErrorZ {
20928                 contents: CResult_PositiveTimestampCreationErrorZPtr {
20929                         err: Box::into_raw(Box::new(e)),
20930                 },
20931                 result_ok: false,
20932         }
20933 }
20934 /// Checks if the given object is currently in the success state
20935 #[no_mangle]
20936 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
20937         o.result_ok
20938 }
20939 #[no_mangle]
20940 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
20941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
20942 impl Drop for CResult_PositiveTimestampCreationErrorZ {
20943         fn drop(&mut self) {
20944                 if self.result_ok {
20945                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20946                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20947                         }
20948                 } else {
20949                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20950                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20951                         }
20952                 }
20953         }
20954 }
20955 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
20956         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
20957                 let contents = if o.result_ok {
20958                         let result = unsafe { o.contents.result };
20959                         unsafe { o.contents.result = core::ptr::null_mut() };
20960                         CResult_PositiveTimestampCreationErrorZPtr { result }
20961                 } else {
20962                         let err = unsafe { o.contents.err };
20963                         unsafe { o.contents.err = core::ptr::null_mut(); }
20964                         CResult_PositiveTimestampCreationErrorZPtr { err }
20965                 };
20966                 Self {
20967                         contents,
20968                         result_ok: o.result_ok,
20969                 }
20970         }
20971 }
20972 impl Clone for CResult_PositiveTimestampCreationErrorZ {
20973         fn clone(&self) -> Self {
20974                 if self.result_ok {
20975                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
20976                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
20977                         } }
20978                 } else {
20979                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
20980                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20981                         } }
20982                 }
20983         }
20984 }
20985 #[no_mangle]
20986 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
20987 /// but with all dynamically-allocated buffers duplicated in new buffers.
20988 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
20989 #[repr(C)]
20990 /// The contents of CResult_NoneBolt11SemanticErrorZ
20991 pub union CResult_NoneBolt11SemanticErrorZPtr {
20992         /// Note that this value is always NULL, as there are no contents in the OK variant
20993         pub result: *mut core::ffi::c_void,
20994         /// A pointer to the contents in the error state.
20995         /// Reading from this pointer when `result_ok` is set is undefined.
20996         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20997 }
20998 #[repr(C)]
20999 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
21000 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
21001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21002 pub struct CResult_NoneBolt11SemanticErrorZ {
21003         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
21004         /// `err` or `result` depending on the state of `result_ok`.
21005         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
21006         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
21007         pub result_ok: bool,
21008 }
21009 #[no_mangle]
21010 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
21011 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
21012         CResult_NoneBolt11SemanticErrorZ {
21013                 contents: CResult_NoneBolt11SemanticErrorZPtr {
21014                         result: core::ptr::null_mut(),
21015                 },
21016                 result_ok: true,
21017         }
21018 }
21019 #[no_mangle]
21020 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
21021 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
21022         CResult_NoneBolt11SemanticErrorZ {
21023                 contents: CResult_NoneBolt11SemanticErrorZPtr {
21024                         err: Box::into_raw(Box::new(e)),
21025                 },
21026                 result_ok: false,
21027         }
21028 }
21029 /// Checks if the given object is currently in the success state
21030 #[no_mangle]
21031 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
21032         o.result_ok
21033 }
21034 #[no_mangle]
21035 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
21036 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
21037 impl Drop for CResult_NoneBolt11SemanticErrorZ {
21038         fn drop(&mut self) {
21039                 if self.result_ok {
21040                 } else {
21041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21043                         }
21044                 }
21045         }
21046 }
21047 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
21048         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
21049                 let contents = if o.result_ok {
21050                         let _ = unsafe { Box::from_raw(o.contents.result) };
21051                         o.contents.result = core::ptr::null_mut();
21052                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
21053                 } else {
21054                         let err = unsafe { o.contents.err };
21055                         unsafe { o.contents.err = core::ptr::null_mut(); }
21056                         CResult_NoneBolt11SemanticErrorZPtr { err }
21057                 };
21058                 Self {
21059                         contents,
21060                         result_ok: o.result_ok,
21061                 }
21062         }
21063 }
21064 impl Clone for CResult_NoneBolt11SemanticErrorZ {
21065         fn clone(&self) -> Self {
21066                 if self.result_ok {
21067                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
21068                                 result: core::ptr::null_mut()
21069                         } }
21070                 } else {
21071                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
21072                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
21073                         } }
21074                 }
21075         }
21076 }
21077 #[no_mangle]
21078 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
21079 /// but with all dynamically-allocated buffers duplicated in new buffers.
21080 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
21081 #[repr(C)]
21082 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
21083 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21084         /// A pointer to the contents in the success state.
21085         /// Reading from this pointer when `result_ok` is not set is undefined.
21086         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
21087         /// A pointer to the contents in the error state.
21088         /// Reading from this pointer when `result_ok` is set is undefined.
21089         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
21090 }
21091 #[repr(C)]
21092 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
21093 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
21094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21095 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21096         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
21097         /// `err` or `result` depending on the state of `result_ok`.
21098         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
21099         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
21100         pub result_ok: bool,
21101 }
21102 #[no_mangle]
21103 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
21104 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21105         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21106                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21107                         result: Box::into_raw(Box::new(o)),
21108                 },
21109                 result_ok: true,
21110         }
21111 }
21112 #[no_mangle]
21113 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
21114 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21115         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21116                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21117                         err: Box::into_raw(Box::new(e)),
21118                 },
21119                 result_ok: false,
21120         }
21121 }
21122 /// Checks if the given object is currently in the success state
21123 #[no_mangle]
21124 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
21125         o.result_ok
21126 }
21127 #[no_mangle]
21128 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
21129 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
21130 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21131         fn drop(&mut self) {
21132                 if self.result_ok {
21133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21135                         }
21136                 } else {
21137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21139                         }
21140                 }
21141         }
21142 }
21143 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21144         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
21145                 let contents = if o.result_ok {
21146                         let result = unsafe { o.contents.result };
21147                         unsafe { o.contents.result = core::ptr::null_mut() };
21148                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
21149                 } else {
21150                         let err = unsafe { o.contents.err };
21151                         unsafe { o.contents.err = core::ptr::null_mut(); }
21152                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
21153                 };
21154                 Self {
21155                         contents,
21156                         result_ok: o.result_ok,
21157                 }
21158         }
21159 }
21160 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21161         fn clone(&self) -> Self {
21162                 if self.result_ok {
21163                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21164                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
21165                         } }
21166                 } else {
21167                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21168                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
21169                         } }
21170                 }
21171         }
21172 }
21173 #[no_mangle]
21174 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
21175 /// but with all dynamically-allocated buffers duplicated in new buffers.
21176 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
21177 #[repr(C)]
21178 /// The contents of CResult_DescriptionCreationErrorZ
21179 pub union CResult_DescriptionCreationErrorZPtr {
21180         /// A pointer to the contents in the success state.
21181         /// Reading from this pointer when `result_ok` is not set is undefined.
21182         pub result: *mut crate::lightning_invoice::Description,
21183         /// A pointer to the contents in the error state.
21184         /// Reading from this pointer when `result_ok` is set is undefined.
21185         pub err: *mut crate::lightning_invoice::CreationError,
21186 }
21187 #[repr(C)]
21188 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
21189 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
21190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21191 pub struct CResult_DescriptionCreationErrorZ {
21192         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
21193         /// `err` or `result` depending on the state of `result_ok`.
21194         pub contents: CResult_DescriptionCreationErrorZPtr,
21195         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
21196         pub result_ok: bool,
21197 }
21198 #[no_mangle]
21199 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
21200 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
21201         CResult_DescriptionCreationErrorZ {
21202                 contents: CResult_DescriptionCreationErrorZPtr {
21203                         result: Box::into_raw(Box::new(o)),
21204                 },
21205                 result_ok: true,
21206         }
21207 }
21208 #[no_mangle]
21209 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
21210 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
21211         CResult_DescriptionCreationErrorZ {
21212                 contents: CResult_DescriptionCreationErrorZPtr {
21213                         err: Box::into_raw(Box::new(e)),
21214                 },
21215                 result_ok: false,
21216         }
21217 }
21218 /// Checks if the given object is currently in the success state
21219 #[no_mangle]
21220 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
21221         o.result_ok
21222 }
21223 #[no_mangle]
21224 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
21225 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
21226 impl Drop for CResult_DescriptionCreationErrorZ {
21227         fn drop(&mut self) {
21228                 if self.result_ok {
21229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21231                         }
21232                 } else {
21233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21235                         }
21236                 }
21237         }
21238 }
21239 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
21240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
21241                 let contents = if o.result_ok {
21242                         let result = unsafe { o.contents.result };
21243                         unsafe { o.contents.result = core::ptr::null_mut() };
21244                         CResult_DescriptionCreationErrorZPtr { result }
21245                 } else {
21246                         let err = unsafe { o.contents.err };
21247                         unsafe { o.contents.err = core::ptr::null_mut(); }
21248                         CResult_DescriptionCreationErrorZPtr { err }
21249                 };
21250                 Self {
21251                         contents,
21252                         result_ok: o.result_ok,
21253                 }
21254         }
21255 }
21256 impl Clone for CResult_DescriptionCreationErrorZ {
21257         fn clone(&self) -> Self {
21258                 if self.result_ok {
21259                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
21260                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
21261                         } }
21262                 } else {
21263                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
21264                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21265                         } }
21266                 }
21267         }
21268 }
21269 #[no_mangle]
21270 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
21271 /// but with all dynamically-allocated buffers duplicated in new buffers.
21272 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
21273 #[repr(C)]
21274 /// The contents of CResult_PrivateRouteCreationErrorZ
21275 pub union CResult_PrivateRouteCreationErrorZPtr {
21276         /// A pointer to the contents in the success state.
21277         /// Reading from this pointer when `result_ok` is not set is undefined.
21278         pub result: *mut crate::lightning_invoice::PrivateRoute,
21279         /// A pointer to the contents in the error state.
21280         /// Reading from this pointer when `result_ok` is set is undefined.
21281         pub err: *mut crate::lightning_invoice::CreationError,
21282 }
21283 #[repr(C)]
21284 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
21285 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
21286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21287 pub struct CResult_PrivateRouteCreationErrorZ {
21288         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
21289         /// `err` or `result` depending on the state of `result_ok`.
21290         pub contents: CResult_PrivateRouteCreationErrorZPtr,
21291         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
21292         pub result_ok: bool,
21293 }
21294 #[no_mangle]
21295 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
21296 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
21297         CResult_PrivateRouteCreationErrorZ {
21298                 contents: CResult_PrivateRouteCreationErrorZPtr {
21299                         result: Box::into_raw(Box::new(o)),
21300                 },
21301                 result_ok: true,
21302         }
21303 }
21304 #[no_mangle]
21305 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
21306 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
21307         CResult_PrivateRouteCreationErrorZ {
21308                 contents: CResult_PrivateRouteCreationErrorZPtr {
21309                         err: Box::into_raw(Box::new(e)),
21310                 },
21311                 result_ok: false,
21312         }
21313 }
21314 /// Checks if the given object is currently in the success state
21315 #[no_mangle]
21316 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
21317         o.result_ok
21318 }
21319 #[no_mangle]
21320 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
21321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
21322 impl Drop for CResult_PrivateRouteCreationErrorZ {
21323         fn drop(&mut self) {
21324                 if self.result_ok {
21325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21327                         }
21328                 } else {
21329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21331                         }
21332                 }
21333         }
21334 }
21335 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
21336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
21337                 let contents = if o.result_ok {
21338                         let result = unsafe { o.contents.result };
21339                         unsafe { o.contents.result = core::ptr::null_mut() };
21340                         CResult_PrivateRouteCreationErrorZPtr { result }
21341                 } else {
21342                         let err = unsafe { o.contents.err };
21343                         unsafe { o.contents.err = core::ptr::null_mut(); }
21344                         CResult_PrivateRouteCreationErrorZPtr { err }
21345                 };
21346                 Self {
21347                         contents,
21348                         result_ok: o.result_ok,
21349                 }
21350         }
21351 }
21352 impl Clone for CResult_PrivateRouteCreationErrorZ {
21353         fn clone(&self) -> Self {
21354                 if self.result_ok {
21355                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
21356                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
21357                         } }
21358                 } else {
21359                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
21360                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21361                         } }
21362                 }
21363         }
21364 }
21365 #[no_mangle]
21366 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
21367 /// but with all dynamically-allocated buffers duplicated in new buffers.
21368 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
21369 #[repr(C)]
21370 /// The contents of CResult_OutPointDecodeErrorZ
21371 pub union CResult_OutPointDecodeErrorZPtr {
21372         /// A pointer to the contents in the success state.
21373         /// Reading from this pointer when `result_ok` is not set is undefined.
21374         pub result: *mut crate::lightning::chain::transaction::OutPoint,
21375         /// A pointer to the contents in the error state.
21376         /// Reading from this pointer when `result_ok` is set is undefined.
21377         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21378 }
21379 #[repr(C)]
21380 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
21381 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21383 pub struct CResult_OutPointDecodeErrorZ {
21384         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
21385         /// `err` or `result` depending on the state of `result_ok`.
21386         pub contents: CResult_OutPointDecodeErrorZPtr,
21387         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
21388         pub result_ok: bool,
21389 }
21390 #[no_mangle]
21391 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
21392 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
21393         CResult_OutPointDecodeErrorZ {
21394                 contents: CResult_OutPointDecodeErrorZPtr {
21395                         result: Box::into_raw(Box::new(o)),
21396                 },
21397                 result_ok: true,
21398         }
21399 }
21400 #[no_mangle]
21401 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
21402 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
21403         CResult_OutPointDecodeErrorZ {
21404                 contents: CResult_OutPointDecodeErrorZPtr {
21405                         err: Box::into_raw(Box::new(e)),
21406                 },
21407                 result_ok: false,
21408         }
21409 }
21410 /// Checks if the given object is currently in the success state
21411 #[no_mangle]
21412 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
21413         o.result_ok
21414 }
21415 #[no_mangle]
21416 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
21417 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
21418 impl Drop for CResult_OutPointDecodeErrorZ {
21419         fn drop(&mut self) {
21420                 if self.result_ok {
21421                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21422                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21423                         }
21424                 } else {
21425                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21426                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21427                         }
21428                 }
21429         }
21430 }
21431 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
21432         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
21433                 let contents = if o.result_ok {
21434                         let result = unsafe { o.contents.result };
21435                         unsafe { o.contents.result = core::ptr::null_mut() };
21436                         CResult_OutPointDecodeErrorZPtr { result }
21437                 } else {
21438                         let err = unsafe { o.contents.err };
21439                         unsafe { o.contents.err = core::ptr::null_mut(); }
21440                         CResult_OutPointDecodeErrorZPtr { err }
21441                 };
21442                 Self {
21443                         contents,
21444                         result_ok: o.result_ok,
21445                 }
21446         }
21447 }
21448 impl Clone for CResult_OutPointDecodeErrorZ {
21449         fn clone(&self) -> Self {
21450                 if self.result_ok {
21451                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
21452                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
21453                         } }
21454                 } else {
21455                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
21456                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21457                         } }
21458                 }
21459         }
21460 }
21461 #[no_mangle]
21462 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
21463 /// but with all dynamically-allocated buffers duplicated in new buffers.
21464 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
21465 #[repr(C)]
21466 /// The contents of CResult_BigSizeDecodeErrorZ
21467 pub union CResult_BigSizeDecodeErrorZPtr {
21468         /// A pointer to the contents in the success state.
21469         /// Reading from this pointer when `result_ok` is not set is undefined.
21470         pub result: *mut crate::lightning::util::ser::BigSize,
21471         /// A pointer to the contents in the error state.
21472         /// Reading from this pointer when `result_ok` is set is undefined.
21473         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21474 }
21475 #[repr(C)]
21476 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
21477 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
21478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21479 pub struct CResult_BigSizeDecodeErrorZ {
21480         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
21481         /// `err` or `result` depending on the state of `result_ok`.
21482         pub contents: CResult_BigSizeDecodeErrorZPtr,
21483         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
21484         pub result_ok: bool,
21485 }
21486 #[no_mangle]
21487 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
21488 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
21489         CResult_BigSizeDecodeErrorZ {
21490                 contents: CResult_BigSizeDecodeErrorZPtr {
21491                         result: Box::into_raw(Box::new(o)),
21492                 },
21493                 result_ok: true,
21494         }
21495 }
21496 #[no_mangle]
21497 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
21498 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
21499         CResult_BigSizeDecodeErrorZ {
21500                 contents: CResult_BigSizeDecodeErrorZPtr {
21501                         err: Box::into_raw(Box::new(e)),
21502                 },
21503                 result_ok: false,
21504         }
21505 }
21506 /// Checks if the given object is currently in the success state
21507 #[no_mangle]
21508 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
21509         o.result_ok
21510 }
21511 #[no_mangle]
21512 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
21513 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
21514 impl Drop for CResult_BigSizeDecodeErrorZ {
21515         fn drop(&mut self) {
21516                 if self.result_ok {
21517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21519                         }
21520                 } else {
21521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21523                         }
21524                 }
21525         }
21526 }
21527 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
21528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
21529                 let contents = if o.result_ok {
21530                         let result = unsafe { o.contents.result };
21531                         unsafe { o.contents.result = core::ptr::null_mut() };
21532                         CResult_BigSizeDecodeErrorZPtr { result }
21533                 } else {
21534                         let err = unsafe { o.contents.err };
21535                         unsafe { o.contents.err = core::ptr::null_mut(); }
21536                         CResult_BigSizeDecodeErrorZPtr { err }
21537                 };
21538                 Self {
21539                         contents,
21540                         result_ok: o.result_ok,
21541                 }
21542         }
21543 }
21544 impl Clone for CResult_BigSizeDecodeErrorZ {
21545         fn clone(&self) -> Self {
21546                 if self.result_ok {
21547                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
21548                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
21549                         } }
21550                 } else {
21551                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
21552                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21553                         } }
21554                 }
21555         }
21556 }
21557 #[no_mangle]
21558 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
21559 /// but with all dynamically-allocated buffers duplicated in new buffers.
21560 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
21561 #[repr(C)]
21562 /// The contents of CResult_HostnameDecodeErrorZ
21563 pub union CResult_HostnameDecodeErrorZPtr {
21564         /// A pointer to the contents in the success state.
21565         /// Reading from this pointer when `result_ok` is not set is undefined.
21566         pub result: *mut crate::lightning::util::ser::Hostname,
21567         /// A pointer to the contents in the error state.
21568         /// Reading from this pointer when `result_ok` is set is undefined.
21569         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21570 }
21571 #[repr(C)]
21572 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
21573 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
21574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21575 pub struct CResult_HostnameDecodeErrorZ {
21576         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
21577         /// `err` or `result` depending on the state of `result_ok`.
21578         pub contents: CResult_HostnameDecodeErrorZPtr,
21579         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
21580         pub result_ok: bool,
21581 }
21582 #[no_mangle]
21583 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
21584 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
21585         CResult_HostnameDecodeErrorZ {
21586                 contents: CResult_HostnameDecodeErrorZPtr {
21587                         result: Box::into_raw(Box::new(o)),
21588                 },
21589                 result_ok: true,
21590         }
21591 }
21592 #[no_mangle]
21593 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
21594 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
21595         CResult_HostnameDecodeErrorZ {
21596                 contents: CResult_HostnameDecodeErrorZPtr {
21597                         err: Box::into_raw(Box::new(e)),
21598                 },
21599                 result_ok: false,
21600         }
21601 }
21602 /// Checks if the given object is currently in the success state
21603 #[no_mangle]
21604 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
21605         o.result_ok
21606 }
21607 #[no_mangle]
21608 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
21609 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
21610 impl Drop for CResult_HostnameDecodeErrorZ {
21611         fn drop(&mut self) {
21612                 if self.result_ok {
21613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21615                         }
21616                 } else {
21617                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21618                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21619                         }
21620                 }
21621         }
21622 }
21623 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
21624         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
21625                 let contents = if o.result_ok {
21626                         let result = unsafe { o.contents.result };
21627                         unsafe { o.contents.result = core::ptr::null_mut() };
21628                         CResult_HostnameDecodeErrorZPtr { result }
21629                 } else {
21630                         let err = unsafe { o.contents.err };
21631                         unsafe { o.contents.err = core::ptr::null_mut(); }
21632                         CResult_HostnameDecodeErrorZPtr { err }
21633                 };
21634                 Self {
21635                         contents,
21636                         result_ok: o.result_ok,
21637                 }
21638         }
21639 }
21640 impl Clone for CResult_HostnameDecodeErrorZ {
21641         fn clone(&self) -> Self {
21642                 if self.result_ok {
21643                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
21644                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
21645                         } }
21646                 } else {
21647                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
21648                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21649                         } }
21650                 }
21651         }
21652 }
21653 #[no_mangle]
21654 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
21655 /// but with all dynamically-allocated buffers duplicated in new buffers.
21656 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
21657 #[repr(C)]
21658 /// The contents of CResult_TransactionU16LenLimitedNoneZ
21659 pub union CResult_TransactionU16LenLimitedNoneZPtr {
21660         /// A pointer to the contents in the success state.
21661         /// Reading from this pointer when `result_ok` is not set is undefined.
21662         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21663         /// Note that this value is always NULL, as there are no contents in the Err variant
21664         pub err: *mut core::ffi::c_void,
21665 }
21666 #[repr(C)]
21667 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
21668 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
21669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21670 pub struct CResult_TransactionU16LenLimitedNoneZ {
21671         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
21672         /// `err` or `result` depending on the state of `result_ok`.
21673         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
21674         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
21675         pub result_ok: bool,
21676 }
21677 #[no_mangle]
21678 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
21679 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
21680         CResult_TransactionU16LenLimitedNoneZ {
21681                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21682                         result: Box::into_raw(Box::new(o)),
21683                 },
21684                 result_ok: true,
21685         }
21686 }
21687 #[no_mangle]
21688 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
21689 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
21690         CResult_TransactionU16LenLimitedNoneZ {
21691                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21692                         err: core::ptr::null_mut(),
21693                 },
21694                 result_ok: false,
21695         }
21696 }
21697 /// Checks if the given object is currently in the success state
21698 #[no_mangle]
21699 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
21700         o.result_ok
21701 }
21702 #[no_mangle]
21703 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
21704 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
21705 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
21706         fn drop(&mut self) {
21707                 if self.result_ok {
21708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21710                         }
21711                 } else {
21712                 }
21713         }
21714 }
21715 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
21716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
21717                 let contents = if o.result_ok {
21718                         let result = unsafe { o.contents.result };
21719                         unsafe { o.contents.result = core::ptr::null_mut() };
21720                         CResult_TransactionU16LenLimitedNoneZPtr { result }
21721                 } else {
21722                         let _ = unsafe { Box::from_raw(o.contents.err) };
21723                         o.contents.err = core::ptr::null_mut();
21724                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
21725                 };
21726                 Self {
21727                         contents,
21728                         result_ok: o.result_ok,
21729                 }
21730         }
21731 }
21732 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
21733         fn clone(&self) -> Self {
21734                 if self.result_ok {
21735                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21736                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21737                         } }
21738                 } else {
21739                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21740                                 err: core::ptr::null_mut()
21741                         } }
21742                 }
21743         }
21744 }
21745 #[no_mangle]
21746 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
21747 /// but with all dynamically-allocated buffers duplicated in new buffers.
21748 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
21749 #[repr(C)]
21750 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
21751 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21752         /// A pointer to the contents in the success state.
21753         /// Reading from this pointer when `result_ok` is not set is undefined.
21754         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21755         /// A pointer to the contents in the error state.
21756         /// Reading from this pointer when `result_ok` is set is undefined.
21757         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21758 }
21759 #[repr(C)]
21760 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
21761 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
21762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21763 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
21764         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
21765         /// `err` or `result` depending on the state of `result_ok`.
21766         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
21767         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
21768         pub result_ok: bool,
21769 }
21770 #[no_mangle]
21771 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
21772 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21773         CResult_TransactionU16LenLimitedDecodeErrorZ {
21774                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21775                         result: Box::into_raw(Box::new(o)),
21776                 },
21777                 result_ok: true,
21778         }
21779 }
21780 #[no_mangle]
21781 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
21782 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21783         CResult_TransactionU16LenLimitedDecodeErrorZ {
21784                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21785                         err: Box::into_raw(Box::new(e)),
21786                 },
21787                 result_ok: false,
21788         }
21789 }
21790 /// Checks if the given object is currently in the success state
21791 #[no_mangle]
21792 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
21793         o.result_ok
21794 }
21795 #[no_mangle]
21796 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
21797 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
21798 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
21799         fn drop(&mut self) {
21800                 if self.result_ok {
21801                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21802                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21803                         }
21804                 } else {
21805                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21806                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21807                         }
21808                 }
21809         }
21810 }
21811 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
21812         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
21813                 let contents = if o.result_ok {
21814                         let result = unsafe { o.contents.result };
21815                         unsafe { o.contents.result = core::ptr::null_mut() };
21816                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
21817                 } else {
21818                         let err = unsafe { o.contents.err };
21819                         unsafe { o.contents.err = core::ptr::null_mut(); }
21820                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
21821                 };
21822                 Self {
21823                         contents,
21824                         result_ok: o.result_ok,
21825                 }
21826         }
21827 }
21828 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
21829         fn clone(&self) -> Self {
21830                 if self.result_ok {
21831                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21832                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21833                         } }
21834                 } else {
21835                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21836                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21837                         } }
21838                 }
21839         }
21840 }
21841 #[no_mangle]
21842 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
21843 /// but with all dynamically-allocated buffers duplicated in new buffers.
21844 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
21845 #[repr(C)]
21846 /// The contents of CResult_UntrustedStringDecodeErrorZ
21847 pub union CResult_UntrustedStringDecodeErrorZPtr {
21848         /// A pointer to the contents in the success state.
21849         /// Reading from this pointer when `result_ok` is not set is undefined.
21850         pub result: *mut crate::lightning::util::string::UntrustedString,
21851         /// A pointer to the contents in the error state.
21852         /// Reading from this pointer when `result_ok` is set is undefined.
21853         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21854 }
21855 #[repr(C)]
21856 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
21857 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
21858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21859 pub struct CResult_UntrustedStringDecodeErrorZ {
21860         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
21861         /// `err` or `result` depending on the state of `result_ok`.
21862         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
21863         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
21864         pub result_ok: bool,
21865 }
21866 #[no_mangle]
21867 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
21868 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
21869         CResult_UntrustedStringDecodeErrorZ {
21870                 contents: CResult_UntrustedStringDecodeErrorZPtr {
21871                         result: Box::into_raw(Box::new(o)),
21872                 },
21873                 result_ok: true,
21874         }
21875 }
21876 #[no_mangle]
21877 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
21878 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
21879         CResult_UntrustedStringDecodeErrorZ {
21880                 contents: CResult_UntrustedStringDecodeErrorZPtr {
21881                         err: Box::into_raw(Box::new(e)),
21882                 },
21883                 result_ok: false,
21884         }
21885 }
21886 /// Checks if the given object is currently in the success state
21887 #[no_mangle]
21888 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
21889         o.result_ok
21890 }
21891 #[no_mangle]
21892 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
21893 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
21894 impl Drop for CResult_UntrustedStringDecodeErrorZ {
21895         fn drop(&mut self) {
21896                 if self.result_ok {
21897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21899                         }
21900                 } else {
21901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21903                         }
21904                 }
21905         }
21906 }
21907 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
21908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
21909                 let contents = if o.result_ok {
21910                         let result = unsafe { o.contents.result };
21911                         unsafe { o.contents.result = core::ptr::null_mut() };
21912                         CResult_UntrustedStringDecodeErrorZPtr { result }
21913                 } else {
21914                         let err = unsafe { o.contents.err };
21915                         unsafe { o.contents.err = core::ptr::null_mut(); }
21916                         CResult_UntrustedStringDecodeErrorZPtr { err }
21917                 };
21918                 Self {
21919                         contents,
21920                         result_ok: o.result_ok,
21921                 }
21922         }
21923 }
21924 impl Clone for CResult_UntrustedStringDecodeErrorZ {
21925         fn clone(&self) -> Self {
21926                 if self.result_ok {
21927                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
21928                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
21929                         } }
21930                 } else {
21931                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
21932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21933                         } }
21934                 }
21935         }
21936 }
21937 #[no_mangle]
21938 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
21939 /// but with all dynamically-allocated buffers duplicated in new buffers.
21940 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
21941 #[repr(C)]
21942 /// The contents of CResult_ReceiveTlvsDecodeErrorZ
21943 pub union CResult_ReceiveTlvsDecodeErrorZPtr {
21944         /// A pointer to the contents in the success state.
21945         /// Reading from this pointer when `result_ok` is not set is undefined.
21946         pub result: *mut crate::lightning::blinded_path::payment::ReceiveTlvs,
21947         /// A pointer to the contents in the error state.
21948         /// Reading from this pointer when `result_ok` is set is undefined.
21949         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21950 }
21951 #[repr(C)]
21952 /// A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation,
21953 /// containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure.
21954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21955 pub struct CResult_ReceiveTlvsDecodeErrorZ {
21956         /// The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either
21957         /// `err` or `result` depending on the state of `result_ok`.
21958         pub contents: CResult_ReceiveTlvsDecodeErrorZPtr,
21959         /// Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state.
21960         pub result_ok: bool,
21961 }
21962 #[no_mangle]
21963 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state.
21964 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::ReceiveTlvs) -> CResult_ReceiveTlvsDecodeErrorZ {
21965         CResult_ReceiveTlvsDecodeErrorZ {
21966                 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21967                         result: Box::into_raw(Box::new(o)),
21968                 },
21969                 result_ok: true,
21970         }
21971 }
21972 #[no_mangle]
21973 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state.
21974 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReceiveTlvsDecodeErrorZ {
21975         CResult_ReceiveTlvsDecodeErrorZ {
21976                 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21977                         err: Box::into_raw(Box::new(e)),
21978                 },
21979                 result_ok: false,
21980         }
21981 }
21982 /// Checks if the given object is currently in the success state
21983 #[no_mangle]
21984 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_is_ok(o: &CResult_ReceiveTlvsDecodeErrorZ) -> bool {
21985         o.result_ok
21986 }
21987 #[no_mangle]
21988 /// Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ.
21989 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_free(_res: CResult_ReceiveTlvsDecodeErrorZ) { }
21990 impl Drop for CResult_ReceiveTlvsDecodeErrorZ {
21991         fn drop(&mut self) {
21992                 if self.result_ok {
21993                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21994                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21995                         }
21996                 } else {
21997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21999                         }
22000                 }
22001         }
22002 }
22003 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>> for CResult_ReceiveTlvsDecodeErrorZ {
22004         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>) -> Self {
22005                 let contents = if o.result_ok {
22006                         let result = unsafe { o.contents.result };
22007                         unsafe { o.contents.result = core::ptr::null_mut() };
22008                         CResult_ReceiveTlvsDecodeErrorZPtr { result }
22009                 } else {
22010                         let err = unsafe { o.contents.err };
22011                         unsafe { o.contents.err = core::ptr::null_mut(); }
22012                         CResult_ReceiveTlvsDecodeErrorZPtr { err }
22013                 };
22014                 Self {
22015                         contents,
22016                         result_ok: o.result_ok,
22017                 }
22018         }
22019 }
22020 impl Clone for CResult_ReceiveTlvsDecodeErrorZ {
22021         fn clone(&self) -> Self {
22022                 if self.result_ok {
22023                         Self { result_ok: true, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
22024                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::ReceiveTlvs>::clone(unsafe { &*self.contents.result })))
22025                         } }
22026                 } else {
22027                         Self { result_ok: false, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
22028                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22029                         } }
22030                 }
22031         }
22032 }
22033 #[no_mangle]
22034 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig`
22035 /// but with all dynamically-allocated buffers duplicated in new buffers.
22036 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_clone(orig: &CResult_ReceiveTlvsDecodeErrorZ) -> CResult_ReceiveTlvsDecodeErrorZ { Clone::clone(&orig) }
22037 #[repr(C)]
22038 /// The contents of CResult_PaymentRelayDecodeErrorZ
22039 pub union CResult_PaymentRelayDecodeErrorZPtr {
22040         /// A pointer to the contents in the success state.
22041         /// Reading from this pointer when `result_ok` is not set is undefined.
22042         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
22043         /// A pointer to the contents in the error state.
22044         /// Reading from this pointer when `result_ok` is set is undefined.
22045         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22046 }
22047 #[repr(C)]
22048 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
22049 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
22050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22051 pub struct CResult_PaymentRelayDecodeErrorZ {
22052         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
22053         /// `err` or `result` depending on the state of `result_ok`.
22054         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
22055         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
22056         pub result_ok: bool,
22057 }
22058 #[no_mangle]
22059 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
22060 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
22061         CResult_PaymentRelayDecodeErrorZ {
22062                 contents: CResult_PaymentRelayDecodeErrorZPtr {
22063                         result: Box::into_raw(Box::new(o)),
22064                 },
22065                 result_ok: true,
22066         }
22067 }
22068 #[no_mangle]
22069 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
22070 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
22071         CResult_PaymentRelayDecodeErrorZ {
22072                 contents: CResult_PaymentRelayDecodeErrorZPtr {
22073                         err: Box::into_raw(Box::new(e)),
22074                 },
22075                 result_ok: false,
22076         }
22077 }
22078 /// Checks if the given object is currently in the success state
22079 #[no_mangle]
22080 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
22081         o.result_ok
22082 }
22083 #[no_mangle]
22084 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
22085 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
22086 impl Drop for CResult_PaymentRelayDecodeErrorZ {
22087         fn drop(&mut self) {
22088                 if self.result_ok {
22089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22091                         }
22092                 } else {
22093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22095                         }
22096                 }
22097         }
22098 }
22099 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
22100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
22101                 let contents = if o.result_ok {
22102                         let result = unsafe { o.contents.result };
22103                         unsafe { o.contents.result = core::ptr::null_mut() };
22104                         CResult_PaymentRelayDecodeErrorZPtr { result }
22105                 } else {
22106                         let err = unsafe { o.contents.err };
22107                         unsafe { o.contents.err = core::ptr::null_mut(); }
22108                         CResult_PaymentRelayDecodeErrorZPtr { err }
22109                 };
22110                 Self {
22111                         contents,
22112                         result_ok: o.result_ok,
22113                 }
22114         }
22115 }
22116 impl Clone for CResult_PaymentRelayDecodeErrorZ {
22117         fn clone(&self) -> Self {
22118                 if self.result_ok {
22119                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
22120                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
22121                         } }
22122                 } else {
22123                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
22124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22125                         } }
22126                 }
22127         }
22128 }
22129 #[no_mangle]
22130 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
22131 /// but with all dynamically-allocated buffers duplicated in new buffers.
22132 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
22133 #[repr(C)]
22134 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
22135 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
22136         /// A pointer to the contents in the success state.
22137         /// Reading from this pointer when `result_ok` is not set is undefined.
22138         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
22139         /// A pointer to the contents in the error state.
22140         /// Reading from this pointer when `result_ok` is set is undefined.
22141         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22142 }
22143 #[repr(C)]
22144 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
22145 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
22146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22147 pub struct CResult_PaymentConstraintsDecodeErrorZ {
22148         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
22149         /// `err` or `result` depending on the state of `result_ok`.
22150         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
22151         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
22152         pub result_ok: bool,
22153 }
22154 #[no_mangle]
22155 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
22156 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
22157         CResult_PaymentConstraintsDecodeErrorZ {
22158                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22159                         result: Box::into_raw(Box::new(o)),
22160                 },
22161                 result_ok: true,
22162         }
22163 }
22164 #[no_mangle]
22165 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
22166 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
22167         CResult_PaymentConstraintsDecodeErrorZ {
22168                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22169                         err: Box::into_raw(Box::new(e)),
22170                 },
22171                 result_ok: false,
22172         }
22173 }
22174 /// Checks if the given object is currently in the success state
22175 #[no_mangle]
22176 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
22177         o.result_ok
22178 }
22179 #[no_mangle]
22180 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
22181 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
22182 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
22183         fn drop(&mut self) {
22184                 if self.result_ok {
22185                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22186                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22187                         }
22188                 } else {
22189                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22190                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22191                         }
22192                 }
22193         }
22194 }
22195 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
22196         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
22197                 let contents = if o.result_ok {
22198                         let result = unsafe { o.contents.result };
22199                         unsafe { o.contents.result = core::ptr::null_mut() };
22200                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
22201                 } else {
22202                         let err = unsafe { o.contents.err };
22203                         unsafe { o.contents.err = core::ptr::null_mut(); }
22204                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
22205                 };
22206                 Self {
22207                         contents,
22208                         result_ok: o.result_ok,
22209                 }
22210         }
22211 }
22212 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
22213         fn clone(&self) -> Self {
22214                 if self.result_ok {
22215                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22216                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
22217                         } }
22218                 } else {
22219                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22220                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22221                         } }
22222                 }
22223         }
22224 }
22225 #[no_mangle]
22226 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
22227 /// but with all dynamically-allocated buffers duplicated in new buffers.
22228 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
22229 #[repr(C)]
22230 /// The contents of CResult_ThirtyTwoBytesPaymentErrorZ
22231 pub union CResult_ThirtyTwoBytesPaymentErrorZPtr {
22232         /// A pointer to the contents in the success state.
22233         /// Reading from this pointer when `result_ok` is not set is undefined.
22234         pub result: *mut crate::c_types::ThirtyTwoBytes,
22235         /// A pointer to the contents in the error state.
22236         /// Reading from this pointer when `result_ok` is set is undefined.
22237         pub err: *mut crate::lightning_invoice::payment::PaymentError,
22238 }
22239 #[repr(C)]
22240 /// A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation,
22241 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
22242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22243 pub struct CResult_ThirtyTwoBytesPaymentErrorZ {
22244         /// The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either
22245         /// `err` or `result` depending on the state of `result_ok`.
22246         pub contents: CResult_ThirtyTwoBytesPaymentErrorZPtr,
22247         /// Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state.
22248         pub result_ok: bool,
22249 }
22250 #[no_mangle]
22251 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state.
22252 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentErrorZ {
22253         CResult_ThirtyTwoBytesPaymentErrorZ {
22254                 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22255                         result: Box::into_raw(Box::new(o)),
22256                 },
22257                 result_ok: true,
22258         }
22259 }
22260 #[no_mangle]
22261 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state.
22262 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_ThirtyTwoBytesPaymentErrorZ {
22263         CResult_ThirtyTwoBytesPaymentErrorZ {
22264                 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22265                         err: Box::into_raw(Box::new(e)),
22266                 },
22267                 result_ok: false,
22268         }
22269 }
22270 /// Checks if the given object is currently in the success state
22271 #[no_mangle]
22272 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentErrorZ) -> bool {
22273         o.result_ok
22274 }
22275 #[no_mangle]
22276 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ.
22277 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_free(_res: CResult_ThirtyTwoBytesPaymentErrorZ) { }
22278 impl Drop for CResult_ThirtyTwoBytesPaymentErrorZ {
22279         fn drop(&mut self) {
22280                 if self.result_ok {
22281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22283                         }
22284                 } else {
22285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22287                         }
22288                 }
22289         }
22290 }
22291 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_ThirtyTwoBytesPaymentErrorZ {
22292         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
22293                 let contents = if o.result_ok {
22294                         let result = unsafe { o.contents.result };
22295                         unsafe { o.contents.result = core::ptr::null_mut() };
22296                         CResult_ThirtyTwoBytesPaymentErrorZPtr { result }
22297                 } else {
22298                         let err = unsafe { o.contents.err };
22299                         unsafe { o.contents.err = core::ptr::null_mut(); }
22300                         CResult_ThirtyTwoBytesPaymentErrorZPtr { err }
22301                 };
22302                 Self {
22303                         contents,
22304                         result_ok: o.result_ok,
22305                 }
22306         }
22307 }
22308 impl Clone for CResult_ThirtyTwoBytesPaymentErrorZ {
22309         fn clone(&self) -> Self {
22310                 if self.result_ok {
22311                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22312                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
22313                         } }
22314                 } else {
22315                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22316                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22317                         } }
22318                 }
22319         }
22320 }
22321 #[no_mangle]
22322 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig`
22323 /// but with all dynamically-allocated buffers duplicated in new buffers.
22324 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig: &CResult_ThirtyTwoBytesPaymentErrorZ) -> CResult_ThirtyTwoBytesPaymentErrorZ { Clone::clone(&orig) }
22325 #[repr(C)]
22326 /// The contents of CResult_NonePaymentErrorZ
22327 pub union CResult_NonePaymentErrorZPtr {
22328         /// Note that this value is always NULL, as there are no contents in the OK variant
22329         pub result: *mut core::ffi::c_void,
22330         /// A pointer to the contents in the error state.
22331         /// Reading from this pointer when `result_ok` is set is undefined.
22332         pub err: *mut crate::lightning_invoice::payment::PaymentError,
22333 }
22334 #[repr(C)]
22335 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
22336 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
22337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22338 pub struct CResult_NonePaymentErrorZ {
22339         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
22340         /// `err` or `result` depending on the state of `result_ok`.
22341         pub contents: CResult_NonePaymentErrorZPtr,
22342         /// Whether this CResult_NonePaymentErrorZ represents a success state.
22343         pub result_ok: bool,
22344 }
22345 #[no_mangle]
22346 /// Creates a new CResult_NonePaymentErrorZ in the success state.
22347 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
22348         CResult_NonePaymentErrorZ {
22349                 contents: CResult_NonePaymentErrorZPtr {
22350                         result: core::ptr::null_mut(),
22351                 },
22352                 result_ok: true,
22353         }
22354 }
22355 #[no_mangle]
22356 /// Creates a new CResult_NonePaymentErrorZ in the error state.
22357 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
22358         CResult_NonePaymentErrorZ {
22359                 contents: CResult_NonePaymentErrorZPtr {
22360                         err: Box::into_raw(Box::new(e)),
22361                 },
22362                 result_ok: false,
22363         }
22364 }
22365 /// Checks if the given object is currently in the success state
22366 #[no_mangle]
22367 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
22368         o.result_ok
22369 }
22370 #[no_mangle]
22371 /// Frees any resources used by the CResult_NonePaymentErrorZ.
22372 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
22373 impl Drop for CResult_NonePaymentErrorZ {
22374         fn drop(&mut self) {
22375                 if self.result_ok {
22376                 } else {
22377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22379                         }
22380                 }
22381         }
22382 }
22383 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
22384         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
22385                 let contents = if o.result_ok {
22386                         let _ = unsafe { Box::from_raw(o.contents.result) };
22387                         o.contents.result = core::ptr::null_mut();
22388                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
22389                 } else {
22390                         let err = unsafe { o.contents.err };
22391                         unsafe { o.contents.err = core::ptr::null_mut(); }
22392                         CResult_NonePaymentErrorZPtr { err }
22393                 };
22394                 Self {
22395                         contents,
22396                         result_ok: o.result_ok,
22397                 }
22398         }
22399 }
22400 impl Clone for CResult_NonePaymentErrorZ {
22401         fn clone(&self) -> Self {
22402                 if self.result_ok {
22403                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
22404                                 result: core::ptr::null_mut()
22405                         } }
22406                 } else {
22407                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
22408                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22409                         } }
22410                 }
22411         }
22412 }
22413 #[no_mangle]
22414 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
22415 /// but with all dynamically-allocated buffers duplicated in new buffers.
22416 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
22417 #[repr(C)]
22418 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ
22419 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22420         /// A pointer to the contents in the success state.
22421         /// Reading from this pointer when `result_ok` is not set is undefined.
22422         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
22423         /// A pointer to the contents in the error state.
22424         /// Reading from this pointer when `result_ok` is set is undefined.
22425         pub err: *mut crate::lightning_invoice::payment::ProbingError,
22426 }
22427 #[repr(C)]
22428 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation,
22429 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure.
22430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22431 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22432         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either
22433         /// `err` or `result` depending on the state of `result_ok`.
22434         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr,
22435         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state.
22436         pub result_ok: bool,
22437 }
22438 #[no_mangle]
22439 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state.
22440 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22441         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22442                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22443                         result: Box::into_raw(Box::new(o)),
22444                 },
22445                 result_ok: true,
22446         }
22447 }
22448 #[no_mangle]
22449 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state.
22450 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e: crate::lightning_invoice::payment::ProbingError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22451         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22452                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22453                         err: Box::into_raw(Box::new(e)),
22454                 },
22455                 result_ok: false,
22456         }
22457 }
22458 /// Checks if the given object is currently in the success state
22459 #[no_mangle]
22460 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> bool {
22461         o.result_ok
22462 }
22463 #[no_mangle]
22464 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.
22465 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) { }
22466 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22467         fn drop(&mut self) {
22468                 if self.result_ok {
22469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22471                         }
22472                 } else {
22473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22475                         }
22476                 }
22477         }
22478 }
22479 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22480         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>) -> Self {
22481                 let contents = if o.result_ok {
22482                         let result = unsafe { o.contents.result };
22483                         unsafe { o.contents.result = core::ptr::null_mut() };
22484                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { result }
22485                 } else {
22486                         let err = unsafe { o.contents.err };
22487                         unsafe { o.contents.err = core::ptr::null_mut(); }
22488                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { err }
22489                 };
22490                 Self {
22491                         contents,
22492                         result_ok: o.result_ok,
22493                 }
22494         }
22495 }
22496 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22497         fn clone(&self) -> Self {
22498                 if self.result_ok {
22499                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22500                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
22501                         } }
22502                 } else {
22503                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22504                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::ProbingError>::clone(unsafe { &*self.contents.err })))
22505                         } }
22506                 }
22507         }
22508 }
22509 #[no_mangle]
22510 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig`
22511 /// but with all dynamically-allocated buffers duplicated in new buffers.
22512 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { Clone::clone(&orig) }
22513 #[repr(C)]
22514 /// The contents of CResult_StrSecp256k1ErrorZ
22515 pub union CResult_StrSecp256k1ErrorZPtr {
22516         /// A pointer to the contents in the success state.
22517         /// Reading from this pointer when `result_ok` is not set is undefined.
22518         pub result: *mut crate::c_types::Str,
22519         /// A pointer to the contents in the error state.
22520         /// Reading from this pointer when `result_ok` is set is undefined.
22521         pub err: *mut crate::c_types::Secp256k1Error,
22522 }
22523 #[repr(C)]
22524 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
22525 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
22526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22527 pub struct CResult_StrSecp256k1ErrorZ {
22528         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
22529         /// `err` or `result` depending on the state of `result_ok`.
22530         pub contents: CResult_StrSecp256k1ErrorZPtr,
22531         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
22532         pub result_ok: bool,
22533 }
22534 #[no_mangle]
22535 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
22536 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
22537         CResult_StrSecp256k1ErrorZ {
22538                 contents: CResult_StrSecp256k1ErrorZPtr {
22539                         result: Box::into_raw(Box::new(o)),
22540                 },
22541                 result_ok: true,
22542         }
22543 }
22544 #[no_mangle]
22545 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
22546 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
22547         CResult_StrSecp256k1ErrorZ {
22548                 contents: CResult_StrSecp256k1ErrorZPtr {
22549                         err: Box::into_raw(Box::new(e)),
22550                 },
22551                 result_ok: false,
22552         }
22553 }
22554 /// Checks if the given object is currently in the success state
22555 #[no_mangle]
22556 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
22557         o.result_ok
22558 }
22559 #[no_mangle]
22560 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
22561 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
22562 impl Drop for CResult_StrSecp256k1ErrorZ {
22563         fn drop(&mut self) {
22564                 if self.result_ok {
22565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22567                         }
22568                 } else {
22569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22571                         }
22572                 }
22573         }
22574 }
22575 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
22576         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
22577                 let contents = if o.result_ok {
22578                         let result = unsafe { o.contents.result };
22579                         unsafe { o.contents.result = core::ptr::null_mut() };
22580                         CResult_StrSecp256k1ErrorZPtr { result }
22581                 } else {
22582                         let err = unsafe { o.contents.err };
22583                         unsafe { o.contents.err = core::ptr::null_mut(); }
22584                         CResult_StrSecp256k1ErrorZPtr { err }
22585                 };
22586                 Self {
22587                         contents,
22588                         result_ok: o.result_ok,
22589                 }
22590         }
22591 }
22592 impl Clone for CResult_StrSecp256k1ErrorZ {
22593         fn clone(&self) -> Self {
22594                 if self.result_ok {
22595                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
22596                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
22597                         } }
22598                 } else {
22599                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
22600                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22601                         } }
22602                 }
22603         }
22604 }
22605 #[no_mangle]
22606 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
22607 /// but with all dynamically-allocated buffers duplicated in new buffers.
22608 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
22609 #[repr(C)]
22610 /// The contents of CResult_TxOutUtxoLookupErrorZ
22611 pub union CResult_TxOutUtxoLookupErrorZPtr {
22612         /// A pointer to the contents in the success state.
22613         /// Reading from this pointer when `result_ok` is not set is undefined.
22614         pub result: *mut crate::c_types::TxOut,
22615         /// A pointer to the contents in the error state.
22616         /// Reading from this pointer when `result_ok` is set is undefined.
22617         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
22618 }
22619 #[repr(C)]
22620 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
22621 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
22622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22623 pub struct CResult_TxOutUtxoLookupErrorZ {
22624         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
22625         /// `err` or `result` depending on the state of `result_ok`.
22626         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
22627         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
22628         pub result_ok: bool,
22629 }
22630 #[no_mangle]
22631 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
22632 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
22633         CResult_TxOutUtxoLookupErrorZ {
22634                 contents: CResult_TxOutUtxoLookupErrorZPtr {
22635                         result: Box::into_raw(Box::new(o)),
22636                 },
22637                 result_ok: true,
22638         }
22639 }
22640 #[no_mangle]
22641 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
22642 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
22643         CResult_TxOutUtxoLookupErrorZ {
22644                 contents: CResult_TxOutUtxoLookupErrorZPtr {
22645                         err: Box::into_raw(Box::new(e)),
22646                 },
22647                 result_ok: false,
22648         }
22649 }
22650 /// Checks if the given object is currently in the success state
22651 #[no_mangle]
22652 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
22653         o.result_ok
22654 }
22655 #[no_mangle]
22656 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
22657 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
22658 impl Drop for CResult_TxOutUtxoLookupErrorZ {
22659         fn drop(&mut self) {
22660                 if self.result_ok {
22661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22663                         }
22664                 } else {
22665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22667                         }
22668                 }
22669         }
22670 }
22671 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
22672         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
22673                 let contents = if o.result_ok {
22674                         let result = unsafe { o.contents.result };
22675                         unsafe { o.contents.result = core::ptr::null_mut() };
22676                         CResult_TxOutUtxoLookupErrorZPtr { result }
22677                 } else {
22678                         let err = unsafe { o.contents.err };
22679                         unsafe { o.contents.err = core::ptr::null_mut(); }
22680                         CResult_TxOutUtxoLookupErrorZPtr { err }
22681                 };
22682                 Self {
22683                         contents,
22684                         result_ok: o.result_ok,
22685                 }
22686         }
22687 }
22688 impl Clone for CResult_TxOutUtxoLookupErrorZ {
22689         fn clone(&self) -> Self {
22690                 if self.result_ok {
22691                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
22692                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
22693                         } }
22694                 } else {
22695                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
22696                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
22697                         } }
22698                 }
22699         }
22700 }
22701 #[no_mangle]
22702 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
22703 /// but with all dynamically-allocated buffers duplicated in new buffers.
22704 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
22705 #[repr(C)]
22706 /// The contents of CResult_OnionMessagePathNoneZ
22707 pub union CResult_OnionMessagePathNoneZPtr {
22708         /// A pointer to the contents in the success state.
22709         /// Reading from this pointer when `result_ok` is not set is undefined.
22710         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
22711         /// Note that this value is always NULL, as there are no contents in the Err variant
22712         pub err: *mut core::ffi::c_void,
22713 }
22714 #[repr(C)]
22715 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
22716 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
22717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22718 pub struct CResult_OnionMessagePathNoneZ {
22719         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
22720         /// `err` or `result` depending on the state of `result_ok`.
22721         pub contents: CResult_OnionMessagePathNoneZPtr,
22722         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
22723         pub result_ok: bool,
22724 }
22725 #[no_mangle]
22726 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
22727 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
22728         CResult_OnionMessagePathNoneZ {
22729                 contents: CResult_OnionMessagePathNoneZPtr {
22730                         result: Box::into_raw(Box::new(o)),
22731                 },
22732                 result_ok: true,
22733         }
22734 }
22735 #[no_mangle]
22736 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
22737 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
22738         CResult_OnionMessagePathNoneZ {
22739                 contents: CResult_OnionMessagePathNoneZPtr {
22740                         err: core::ptr::null_mut(),
22741                 },
22742                 result_ok: false,
22743         }
22744 }
22745 /// Checks if the given object is currently in the success state
22746 #[no_mangle]
22747 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
22748         o.result_ok
22749 }
22750 #[no_mangle]
22751 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
22752 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
22753 impl Drop for CResult_OnionMessagePathNoneZ {
22754         fn drop(&mut self) {
22755                 if self.result_ok {
22756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22758                         }
22759                 } else {
22760                 }
22761         }
22762 }
22763 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
22764         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
22765                 let contents = if o.result_ok {
22766                         let result = unsafe { o.contents.result };
22767                         unsafe { o.contents.result = core::ptr::null_mut() };
22768                         CResult_OnionMessagePathNoneZPtr { result }
22769                 } else {
22770                         let _ = unsafe { Box::from_raw(o.contents.err) };
22771                         o.contents.err = core::ptr::null_mut();
22772                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
22773                 };
22774                 Self {
22775                         contents,
22776                         result_ok: o.result_ok,
22777                 }
22778         }
22779 }
22780 impl Clone for CResult_OnionMessagePathNoneZ {
22781         fn clone(&self) -> Self {
22782                 if self.result_ok {
22783                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
22784                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
22785                         } }
22786                 } else {
22787                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
22788                                 err: core::ptr::null_mut()
22789                         } }
22790                 }
22791         }
22792 }
22793 #[no_mangle]
22794 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
22795 /// but with all dynamically-allocated buffers duplicated in new buffers.
22796 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
22797 #[repr(C)]
22798 /// A tuple of 2 elements. See the individual fields for the types contained.
22799 pub struct C2Tuple_PublicKeyOnionMessageZ {
22800         /// The element at position 0
22801         pub a: crate::c_types::PublicKey,
22802         /// The element at position 1
22803         pub b: crate::lightning::ln::msgs::OnionMessage,
22804 }
22805 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)> for C2Tuple_PublicKeyOnionMessageZ {
22806         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)) -> Self {
22807                 Self {
22808                         a: tup.0,
22809                         b: tup.1,
22810                 }
22811         }
22812 }
22813 impl C2Tuple_PublicKeyOnionMessageZ {
22814         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage) {
22815                 (self.a, self.b)
22816         }
22817 }
22818 impl Clone for C2Tuple_PublicKeyOnionMessageZ {
22819         fn clone(&self) -> Self {
22820                 Self {
22821                         a: Clone::clone(&self.a),
22822                         b: Clone::clone(&self.b),
22823                 }
22824         }
22825 }
22826 #[no_mangle]
22827 /// Creates a new tuple which has the same data as `orig`
22828 /// but with all dynamically-allocated buffers duplicated in new buffers.
22829 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_clone(orig: &C2Tuple_PublicKeyOnionMessageZ) -> C2Tuple_PublicKeyOnionMessageZ { Clone::clone(&orig) }
22830 /// Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements.
22831 #[no_mangle]
22832 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage) -> C2Tuple_PublicKeyOnionMessageZ {
22833         C2Tuple_PublicKeyOnionMessageZ { a, b, }
22834 }
22835
22836 #[no_mangle]
22837 /// Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ.
22838 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_free(_res: C2Tuple_PublicKeyOnionMessageZ) { }
22839 #[repr(C)]
22840 /// The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ
22841 pub union CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22842         /// A pointer to the contents in the success state.
22843         /// Reading from this pointer when `result_ok` is not set is undefined.
22844         pub result: *mut crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ,
22845         /// A pointer to the contents in the error state.
22846         /// Reading from this pointer when `result_ok` is set is undefined.
22847         pub err: *mut crate::lightning::onion_message::messenger::SendError,
22848 }
22849 #[repr(C)]
22850 /// A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation,
22851 /// containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
22852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22853 pub struct CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22854         /// The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either
22855         /// `err` or `result` depending on the state of `result_ok`.
22856         pub contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr,
22857         /// Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state.
22858         pub result_ok: bool,
22859 }
22860 #[no_mangle]
22861 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state.
22862 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o: crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22863         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22864                 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22865                         result: Box::into_raw(Box::new(o)),
22866                 },
22867                 result_ok: true,
22868         }
22869 }
22870 #[no_mangle]
22871 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state.
22872 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22873         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22874                 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22875                         err: Box::into_raw(Box::new(e)),
22876                 },
22877                 result_ok: false,
22878         }
22879 }
22880 /// Checks if the given object is currently in the success state
22881 #[no_mangle]
22882 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o: &CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) -> bool {
22883         o.result_ok
22884 }
22885 #[no_mangle]
22886 /// Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ.
22887 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) { }
22888 impl Drop for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22889         fn drop(&mut self) {
22890                 if self.result_ok {
22891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22893                         }
22894                 } else {
22895                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22896                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22897                         }
22898                 }
22899         }
22900 }
22901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22902         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
22903                 let contents = if o.result_ok {
22904                         let result = unsafe { o.contents.result };
22905                         unsafe { o.contents.result = core::ptr::null_mut() };
22906                         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { result }
22907                 } else {
22908                         let err = unsafe { o.contents.err };
22909                         unsafe { o.contents.err = core::ptr::null_mut(); }
22910                         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { err }
22911                 };
22912                 Self {
22913                         contents,
22914                         result_ok: o.result_ok,
22915                 }
22916         }
22917 }
22918 #[repr(C)]
22919 /// The contents of CResult_PeeledOnionNoneZ
22920 pub union CResult_PeeledOnionNoneZPtr {
22921         /// A pointer to the contents in the success state.
22922         /// Reading from this pointer when `result_ok` is not set is undefined.
22923         pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
22924         /// Note that this value is always NULL, as there are no contents in the Err variant
22925         pub err: *mut core::ffi::c_void,
22926 }
22927 #[repr(C)]
22928 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
22929 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
22930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22931 pub struct CResult_PeeledOnionNoneZ {
22932         /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
22933         /// `err` or `result` depending on the state of `result_ok`.
22934         pub contents: CResult_PeeledOnionNoneZPtr,
22935         /// Whether this CResult_PeeledOnionNoneZ represents a success state.
22936         pub result_ok: bool,
22937 }
22938 #[no_mangle]
22939 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
22940 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
22941         CResult_PeeledOnionNoneZ {
22942                 contents: CResult_PeeledOnionNoneZPtr {
22943                         result: Box::into_raw(Box::new(o)),
22944                 },
22945                 result_ok: true,
22946         }
22947 }
22948 #[no_mangle]
22949 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
22950 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
22951         CResult_PeeledOnionNoneZ {
22952                 contents: CResult_PeeledOnionNoneZPtr {
22953                         err: core::ptr::null_mut(),
22954                 },
22955                 result_ok: false,
22956         }
22957 }
22958 /// Checks if the given object is currently in the success state
22959 #[no_mangle]
22960 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
22961         o.result_ok
22962 }
22963 #[no_mangle]
22964 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
22965 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
22966 impl Drop for CResult_PeeledOnionNoneZ {
22967         fn drop(&mut self) {
22968                 if self.result_ok {
22969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22971                         }
22972                 } else {
22973                 }
22974         }
22975 }
22976 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
22977         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
22978                 let contents = if o.result_ok {
22979                         let result = unsafe { o.contents.result };
22980                         unsafe { o.contents.result = core::ptr::null_mut() };
22981                         CResult_PeeledOnionNoneZPtr { result }
22982                 } else {
22983                         let _ = unsafe { Box::from_raw(o.contents.err) };
22984                         o.contents.err = core::ptr::null_mut();
22985                         CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
22986                 };
22987                 Self {
22988                         contents,
22989                         result_ok: o.result_ok,
22990                 }
22991         }
22992 }
22993 #[repr(C)]
22994 /// The contents of CResult_NoneSendErrorZ
22995 pub union CResult_NoneSendErrorZPtr {
22996         /// Note that this value is always NULL, as there are no contents in the OK variant
22997         pub result: *mut core::ffi::c_void,
22998         /// A pointer to the contents in the error state.
22999         /// Reading from this pointer when `result_ok` is set is undefined.
23000         pub err: *mut crate::lightning::onion_message::messenger::SendError,
23001 }
23002 #[repr(C)]
23003 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
23004 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
23005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23006 pub struct CResult_NoneSendErrorZ {
23007         /// The contents of this CResult_NoneSendErrorZ, accessible via either
23008         /// `err` or `result` depending on the state of `result_ok`.
23009         pub contents: CResult_NoneSendErrorZPtr,
23010         /// Whether this CResult_NoneSendErrorZ represents a success state.
23011         pub result_ok: bool,
23012 }
23013 #[no_mangle]
23014 /// Creates a new CResult_NoneSendErrorZ in the success state.
23015 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
23016         CResult_NoneSendErrorZ {
23017                 contents: CResult_NoneSendErrorZPtr {
23018                         result: core::ptr::null_mut(),
23019                 },
23020                 result_ok: true,
23021         }
23022 }
23023 #[no_mangle]
23024 /// Creates a new CResult_NoneSendErrorZ in the error state.
23025 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
23026         CResult_NoneSendErrorZ {
23027                 contents: CResult_NoneSendErrorZPtr {
23028                         err: Box::into_raw(Box::new(e)),
23029                 },
23030                 result_ok: false,
23031         }
23032 }
23033 /// Checks if the given object is currently in the success state
23034 #[no_mangle]
23035 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
23036         o.result_ok
23037 }
23038 #[no_mangle]
23039 /// Frees any resources used by the CResult_NoneSendErrorZ.
23040 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
23041 impl Drop for CResult_NoneSendErrorZ {
23042         fn drop(&mut self) {
23043                 if self.result_ok {
23044                 } else {
23045                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23046                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23047                         }
23048                 }
23049         }
23050 }
23051 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
23052         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
23053                 let contents = if o.result_ok {
23054                         let _ = unsafe { Box::from_raw(o.contents.result) };
23055                         o.contents.result = core::ptr::null_mut();
23056                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
23057                 } else {
23058                         let err = unsafe { o.contents.err };
23059                         unsafe { o.contents.err = core::ptr::null_mut(); }
23060                         CResult_NoneSendErrorZPtr { err }
23061                 };
23062                 Self {
23063                         contents,
23064                         result_ok: o.result_ok,
23065                 }
23066         }
23067 }
23068 #[repr(C)]
23069 /// The contents of CResult_BlindedPathNoneZ
23070 pub union CResult_BlindedPathNoneZPtr {
23071         /// A pointer to the contents in the success state.
23072         /// Reading from this pointer when `result_ok` is not set is undefined.
23073         pub result: *mut crate::lightning::blinded_path::BlindedPath,
23074         /// Note that this value is always NULL, as there are no contents in the Err variant
23075         pub err: *mut core::ffi::c_void,
23076 }
23077 #[repr(C)]
23078 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
23079 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
23080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23081 pub struct CResult_BlindedPathNoneZ {
23082         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
23083         /// `err` or `result` depending on the state of `result_ok`.
23084         pub contents: CResult_BlindedPathNoneZPtr,
23085         /// Whether this CResult_BlindedPathNoneZ represents a success state.
23086         pub result_ok: bool,
23087 }
23088 #[no_mangle]
23089 /// Creates a new CResult_BlindedPathNoneZ in the success state.
23090 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
23091         CResult_BlindedPathNoneZ {
23092                 contents: CResult_BlindedPathNoneZPtr {
23093                         result: Box::into_raw(Box::new(o)),
23094                 },
23095                 result_ok: true,
23096         }
23097 }
23098 #[no_mangle]
23099 /// Creates a new CResult_BlindedPathNoneZ in the error state.
23100 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
23101         CResult_BlindedPathNoneZ {
23102                 contents: CResult_BlindedPathNoneZPtr {
23103                         err: core::ptr::null_mut(),
23104                 },
23105                 result_ok: false,
23106         }
23107 }
23108 /// Checks if the given object is currently in the success state
23109 #[no_mangle]
23110 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
23111         o.result_ok
23112 }
23113 #[no_mangle]
23114 /// Frees any resources used by the CResult_BlindedPathNoneZ.
23115 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
23116 impl Drop for CResult_BlindedPathNoneZ {
23117         fn drop(&mut self) {
23118                 if self.result_ok {
23119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23121                         }
23122                 } else {
23123                 }
23124         }
23125 }
23126 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
23127         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
23128                 let contents = if o.result_ok {
23129                         let result = unsafe { o.contents.result };
23130                         unsafe { o.contents.result = core::ptr::null_mut() };
23131                         CResult_BlindedPathNoneZPtr { result }
23132                 } else {
23133                         let _ = unsafe { Box::from_raw(o.contents.err) };
23134                         o.contents.err = core::ptr::null_mut();
23135                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
23136                 };
23137                 Self {
23138                         contents,
23139                         result_ok: o.result_ok,
23140                 }
23141         }
23142 }
23143 impl Clone for CResult_BlindedPathNoneZ {
23144         fn clone(&self) -> Self {
23145                 if self.result_ok {
23146                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
23147                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
23148                         } }
23149                 } else {
23150                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
23151                                 err: core::ptr::null_mut()
23152                         } }
23153                 }
23154         }
23155 }
23156 #[no_mangle]
23157 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
23158 /// but with all dynamically-allocated buffers duplicated in new buffers.
23159 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
23160 #[repr(C)]
23161 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
23162 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23163         /// A pointer to the contents in the success state.
23164         /// Reading from this pointer when `result_ok` is not set is undefined.
23165         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
23166         /// Note that this value is always NULL, as there are no contents in the Err variant
23167         pub err: *mut core::ffi::c_void,
23168 }
23169 #[repr(C)]
23170 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
23171 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
23172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23173 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23174         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
23175         /// `err` or `result` depending on the state of `result_ok`.
23176         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
23177         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
23178         pub result_ok: bool,
23179 }
23180 #[no_mangle]
23181 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
23182 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23183         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23184                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23185                         result: Box::into_raw(Box::new(o)),
23186                 },
23187                 result_ok: true,
23188         }
23189 }
23190 #[no_mangle]
23191 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
23192 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23193         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23194                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23195                         err: core::ptr::null_mut(),
23196                 },
23197                 result_ok: false,
23198         }
23199 }
23200 /// Checks if the given object is currently in the success state
23201 #[no_mangle]
23202 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
23203         o.result_ok
23204 }
23205 #[no_mangle]
23206 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
23207 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
23208 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23209         fn drop(&mut self) {
23210                 if self.result_ok {
23211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23213                         }
23214                 } else {
23215                 }
23216         }
23217 }
23218 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23219         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
23220                 let contents = if o.result_ok {
23221                         let result = unsafe { o.contents.result };
23222                         unsafe { o.contents.result = core::ptr::null_mut() };
23223                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
23224                 } else {
23225                         let _ = unsafe { Box::from_raw(o.contents.err) };
23226                         o.contents.err = core::ptr::null_mut();
23227                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
23228                 };
23229                 Self {
23230                         contents,
23231                         result_ok: o.result_ok,
23232                 }
23233         }
23234 }
23235 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23236         fn clone(&self) -> Self {
23237                 if self.result_ok {
23238                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23239                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
23240                         } }
23241                 } else {
23242                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23243                                 err: core::ptr::null_mut()
23244                         } }
23245                 }
23246         }
23247 }
23248 #[no_mangle]
23249 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
23250 /// but with all dynamically-allocated buffers duplicated in new buffers.
23251 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
23252 #[repr(C)]
23253 /// The contents of CResult_BlindedPathDecodeErrorZ
23254 pub union CResult_BlindedPathDecodeErrorZPtr {
23255         /// A pointer to the contents in the success state.
23256         /// Reading from this pointer when `result_ok` is not set is undefined.
23257         pub result: *mut crate::lightning::blinded_path::BlindedPath,
23258         /// A pointer to the contents in the error state.
23259         /// Reading from this pointer when `result_ok` is set is undefined.
23260         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23261 }
23262 #[repr(C)]
23263 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
23264 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
23265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23266 pub struct CResult_BlindedPathDecodeErrorZ {
23267         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
23268         /// `err` or `result` depending on the state of `result_ok`.
23269         pub contents: CResult_BlindedPathDecodeErrorZPtr,
23270         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
23271         pub result_ok: bool,
23272 }
23273 #[no_mangle]
23274 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
23275 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
23276         CResult_BlindedPathDecodeErrorZ {
23277                 contents: CResult_BlindedPathDecodeErrorZPtr {
23278                         result: Box::into_raw(Box::new(o)),
23279                 },
23280                 result_ok: true,
23281         }
23282 }
23283 #[no_mangle]
23284 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
23285 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
23286         CResult_BlindedPathDecodeErrorZ {
23287                 contents: CResult_BlindedPathDecodeErrorZPtr {
23288                         err: Box::into_raw(Box::new(e)),
23289                 },
23290                 result_ok: false,
23291         }
23292 }
23293 /// Checks if the given object is currently in the success state
23294 #[no_mangle]
23295 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
23296         o.result_ok
23297 }
23298 #[no_mangle]
23299 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
23300 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
23301 impl Drop for CResult_BlindedPathDecodeErrorZ {
23302         fn drop(&mut self) {
23303                 if self.result_ok {
23304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23306                         }
23307                 } else {
23308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23310                         }
23311                 }
23312         }
23313 }
23314 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
23315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
23316                 let contents = if o.result_ok {
23317                         let result = unsafe { o.contents.result };
23318                         unsafe { o.contents.result = core::ptr::null_mut() };
23319                         CResult_BlindedPathDecodeErrorZPtr { result }
23320                 } else {
23321                         let err = unsafe { o.contents.err };
23322                         unsafe { o.contents.err = core::ptr::null_mut(); }
23323                         CResult_BlindedPathDecodeErrorZPtr { err }
23324                 };
23325                 Self {
23326                         contents,
23327                         result_ok: o.result_ok,
23328                 }
23329         }
23330 }
23331 impl Clone for CResult_BlindedPathDecodeErrorZ {
23332         fn clone(&self) -> Self {
23333                 if self.result_ok {
23334                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
23335                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
23336                         } }
23337                 } else {
23338                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
23339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23340                         } }
23341                 }
23342         }
23343 }
23344 #[no_mangle]
23345 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
23346 /// but with all dynamically-allocated buffers duplicated in new buffers.
23347 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
23348 #[repr(C)]
23349 /// The contents of CResult_BlindedHopDecodeErrorZ
23350 pub union CResult_BlindedHopDecodeErrorZPtr {
23351         /// A pointer to the contents in the success state.
23352         /// Reading from this pointer when `result_ok` is not set is undefined.
23353         pub result: *mut crate::lightning::blinded_path::BlindedHop,
23354         /// A pointer to the contents in the error state.
23355         /// Reading from this pointer when `result_ok` is set is undefined.
23356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23357 }
23358 #[repr(C)]
23359 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
23360 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
23361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23362 pub struct CResult_BlindedHopDecodeErrorZ {
23363         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
23364         /// `err` or `result` depending on the state of `result_ok`.
23365         pub contents: CResult_BlindedHopDecodeErrorZPtr,
23366         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
23367         pub result_ok: bool,
23368 }
23369 #[no_mangle]
23370 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
23371 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
23372         CResult_BlindedHopDecodeErrorZ {
23373                 contents: CResult_BlindedHopDecodeErrorZPtr {
23374                         result: Box::into_raw(Box::new(o)),
23375                 },
23376                 result_ok: true,
23377         }
23378 }
23379 #[no_mangle]
23380 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
23381 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
23382         CResult_BlindedHopDecodeErrorZ {
23383                 contents: CResult_BlindedHopDecodeErrorZPtr {
23384                         err: Box::into_raw(Box::new(e)),
23385                 },
23386                 result_ok: false,
23387         }
23388 }
23389 /// Checks if the given object is currently in the success state
23390 #[no_mangle]
23391 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
23392         o.result_ok
23393 }
23394 #[no_mangle]
23395 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
23396 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
23397 impl Drop for CResult_BlindedHopDecodeErrorZ {
23398         fn drop(&mut self) {
23399                 if self.result_ok {
23400                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23401                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23402                         }
23403                 } else {
23404                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23405                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23406                         }
23407                 }
23408         }
23409 }
23410 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
23411         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
23412                 let contents = if o.result_ok {
23413                         let result = unsafe { o.contents.result };
23414                         unsafe { o.contents.result = core::ptr::null_mut() };
23415                         CResult_BlindedHopDecodeErrorZPtr { result }
23416                 } else {
23417                         let err = unsafe { o.contents.err };
23418                         unsafe { o.contents.err = core::ptr::null_mut(); }
23419                         CResult_BlindedHopDecodeErrorZPtr { err }
23420                 };
23421                 Self {
23422                         contents,
23423                         result_ok: o.result_ok,
23424                 }
23425         }
23426 }
23427 impl Clone for CResult_BlindedHopDecodeErrorZ {
23428         fn clone(&self) -> Self {
23429                 if self.result_ok {
23430                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
23431                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
23432                         } }
23433                 } else {
23434                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
23435                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23436                         } }
23437                 }
23438         }
23439 }
23440 #[no_mangle]
23441 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
23442 /// but with all dynamically-allocated buffers duplicated in new buffers.
23443 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
23444 #[repr(C)]
23445 /// The contents of CResult_InvoiceErrorDecodeErrorZ
23446 pub union CResult_InvoiceErrorDecodeErrorZPtr {
23447         /// A pointer to the contents in the success state.
23448         /// Reading from this pointer when `result_ok` is not set is undefined.
23449         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
23450         /// A pointer to the contents in the error state.
23451         /// Reading from this pointer when `result_ok` is set is undefined.
23452         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23453 }
23454 #[repr(C)]
23455 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
23456 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
23457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23458 pub struct CResult_InvoiceErrorDecodeErrorZ {
23459         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
23460         /// `err` or `result` depending on the state of `result_ok`.
23461         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
23462         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
23463         pub result_ok: bool,
23464 }
23465 #[no_mangle]
23466 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
23467 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
23468         CResult_InvoiceErrorDecodeErrorZ {
23469                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23470                         result: Box::into_raw(Box::new(o)),
23471                 },
23472                 result_ok: true,
23473         }
23474 }
23475 #[no_mangle]
23476 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
23477 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
23478         CResult_InvoiceErrorDecodeErrorZ {
23479                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23480                         err: Box::into_raw(Box::new(e)),
23481                 },
23482                 result_ok: false,
23483         }
23484 }
23485 /// Checks if the given object is currently in the success state
23486 #[no_mangle]
23487 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
23488         o.result_ok
23489 }
23490 #[no_mangle]
23491 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
23492 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
23493 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
23494         fn drop(&mut self) {
23495                 if self.result_ok {
23496                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23497                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23498                         }
23499                 } else {
23500                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23501                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23502                         }
23503                 }
23504         }
23505 }
23506 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
23507         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
23508                 let contents = if o.result_ok {
23509                         let result = unsafe { o.contents.result };
23510                         unsafe { o.contents.result = core::ptr::null_mut() };
23511                         CResult_InvoiceErrorDecodeErrorZPtr { result }
23512                 } else {
23513                         let err = unsafe { o.contents.err };
23514                         unsafe { o.contents.err = core::ptr::null_mut(); }
23515                         CResult_InvoiceErrorDecodeErrorZPtr { err }
23516                 };
23517                 Self {
23518                         contents,
23519                         result_ok: o.result_ok,
23520                 }
23521         }
23522 }
23523 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
23524         fn clone(&self) -> Self {
23525                 if self.result_ok {
23526                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23527                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
23528                         } }
23529                 } else {
23530                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23531                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23532                         } }
23533                 }
23534         }
23535 }
23536 #[no_mangle]
23537 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
23538 /// but with all dynamically-allocated buffers duplicated in new buffers.
23539 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
23540 #[repr(C)]
23541 /// An enum which can either contain a crate::lightning::chain::Filter or not
23542 pub enum COption_FilterZ {
23543         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
23544         Some(crate::lightning::chain::Filter),
23545         /// When we're in this state, this COption_FilterZ contains nothing
23546         None
23547 }
23548 impl COption_FilterZ {
23549         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23550                 if let Self::None = self { false } else { true }
23551         }
23552         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23553                 !self.is_some()
23554         }
23555         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
23556                 if let Self::Some(v) = self { v } else { unreachable!() }
23557         }
23558 }
23559 #[no_mangle]
23560 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
23561 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
23562         COption_FilterZ::Some(o)
23563 }
23564 #[no_mangle]
23565 /// Constructs a new COption_FilterZ containing nothing
23566 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
23567         COption_FilterZ::None
23568 }
23569 #[no_mangle]
23570 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
23571 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
23572 #[repr(C)]
23573 /// The contents of CResult_LockedChannelMonitorNoneZ
23574 pub union CResult_LockedChannelMonitorNoneZPtr {
23575         /// A pointer to the contents in the success state.
23576         /// Reading from this pointer when `result_ok` is not set is undefined.
23577         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
23578         /// Note that this value is always NULL, as there are no contents in the Err variant
23579         pub err: *mut core::ffi::c_void,
23580 }
23581 #[repr(C)]
23582 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
23583 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
23584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23585 pub struct CResult_LockedChannelMonitorNoneZ {
23586         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
23587         /// `err` or `result` depending on the state of `result_ok`.
23588         pub contents: CResult_LockedChannelMonitorNoneZPtr,
23589         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
23590         pub result_ok: bool,
23591 }
23592 #[no_mangle]
23593 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
23594 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
23595         CResult_LockedChannelMonitorNoneZ {
23596                 contents: CResult_LockedChannelMonitorNoneZPtr {
23597                         result: Box::into_raw(Box::new(o)),
23598                 },
23599                 result_ok: true,
23600         }
23601 }
23602 #[no_mangle]
23603 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
23604 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
23605         CResult_LockedChannelMonitorNoneZ {
23606                 contents: CResult_LockedChannelMonitorNoneZPtr {
23607                         err: core::ptr::null_mut(),
23608                 },
23609                 result_ok: false,
23610         }
23611 }
23612 /// Checks if the given object is currently in the success state
23613 #[no_mangle]
23614 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
23615         o.result_ok
23616 }
23617 #[no_mangle]
23618 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
23619 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
23620 impl Drop for CResult_LockedChannelMonitorNoneZ {
23621         fn drop(&mut self) {
23622                 if self.result_ok {
23623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23625                         }
23626                 } else {
23627                 }
23628         }
23629 }
23630 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
23631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
23632                 let contents = if o.result_ok {
23633                         let result = unsafe { o.contents.result };
23634                         unsafe { o.contents.result = core::ptr::null_mut() };
23635                         CResult_LockedChannelMonitorNoneZPtr { result }
23636                 } else {
23637                         let _ = unsafe { Box::from_raw(o.contents.err) };
23638                         o.contents.err = core::ptr::null_mut();
23639                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
23640                 };
23641                 Self {
23642                         contents,
23643                         result_ok: o.result_ok,
23644                 }
23645         }
23646 }
23647 #[repr(C)]
23648 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
23649 /// This corresponds to std::vector in C++
23650 pub struct CVec_OutPointZ {
23651         /// The elements in the array.
23652         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23653         pub data: *mut crate::lightning::chain::transaction::OutPoint,
23654         /// The number of elements pointed to by `data`.
23655         pub datalen: usize
23656 }
23657 impl CVec_OutPointZ {
23658         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
23659                 if self.datalen == 0 { return Vec::new(); }
23660                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23661                 self.data = core::ptr::null_mut();
23662                 self.datalen = 0;
23663                 ret
23664         }
23665         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
23666                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23667         }
23668 }
23669 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
23670         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
23671                 let datalen = v.len();
23672                 let data = Box::into_raw(v.into_boxed_slice());
23673                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23674         }
23675 }
23676 #[no_mangle]
23677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23678 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
23679 impl Drop for CVec_OutPointZ {
23680         fn drop(&mut self) {
23681                 if self.datalen == 0 { return; }
23682                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23683         }
23684 }
23685 impl Clone for CVec_OutPointZ {
23686         fn clone(&self) -> Self {
23687                 let mut res = Vec::new();
23688                 if self.datalen == 0 { return Self::from(res); }
23689                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23690                 Self::from(res)
23691         }
23692 }
23693 #[repr(C)]
23694 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
23695 /// This corresponds to std::vector in C++
23696 pub struct CVec_MonitorUpdateIdZ {
23697         /// The elements in the array.
23698         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23699         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
23700         /// The number of elements pointed to by `data`.
23701         pub datalen: usize
23702 }
23703 impl CVec_MonitorUpdateIdZ {
23704         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
23705                 if self.datalen == 0 { return Vec::new(); }
23706                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23707                 self.data = core::ptr::null_mut();
23708                 self.datalen = 0;
23709                 ret
23710         }
23711         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
23712                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23713         }
23714 }
23715 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
23716         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
23717                 let datalen = v.len();
23718                 let data = Box::into_raw(v.into_boxed_slice());
23719                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23720         }
23721 }
23722 #[no_mangle]
23723 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23724 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
23725 impl Drop for CVec_MonitorUpdateIdZ {
23726         fn drop(&mut self) {
23727                 if self.datalen == 0 { return; }
23728                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23729         }
23730 }
23731 impl Clone for CVec_MonitorUpdateIdZ {
23732         fn clone(&self) -> Self {
23733                 let mut res = Vec::new();
23734                 if self.datalen == 0 { return Self::from(res); }
23735                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23736                 Self::from(res)
23737         }
23738 }
23739 #[repr(C)]
23740 /// A tuple of 2 elements. See the individual fields for the types contained.
23741 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23742         /// The element at position 0
23743         pub a: crate::lightning::chain::transaction::OutPoint,
23744         /// The element at position 1
23745         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
23746 }
23747 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23748         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
23749                 Self {
23750                         a: tup.0,
23751                         b: tup.1,
23752                 }
23753         }
23754 }
23755 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23756         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
23757                 (self.a, self.b)
23758         }
23759 }
23760 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23761         fn clone(&self) -> Self {
23762                 Self {
23763                         a: Clone::clone(&self.a),
23764                         b: Clone::clone(&self.b),
23765                 }
23766         }
23767 }
23768 #[no_mangle]
23769 /// Creates a new tuple which has the same data as `orig`
23770 /// but with all dynamically-allocated buffers duplicated in new buffers.
23771 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
23772 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
23773 #[no_mangle]
23774 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23775         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
23776 }
23777
23778 #[no_mangle]
23779 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
23780 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
23781 #[repr(C)]
23782 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
23783 /// This corresponds to std::vector in C++
23784 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23785         /// The elements in the array.
23786         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23787         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
23788         /// The number of elements pointed to by `data`.
23789         pub datalen: usize
23790 }
23791 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23792         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
23793                 if self.datalen == 0 { return Vec::new(); }
23794                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23795                 self.data = core::ptr::null_mut();
23796                 self.datalen = 0;
23797                 ret
23798         }
23799         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
23800                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23801         }
23802 }
23803 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23804         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
23805                 let datalen = v.len();
23806                 let data = Box::into_raw(v.into_boxed_slice());
23807                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23808         }
23809 }
23810 #[no_mangle]
23811 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23812 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
23813 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23814         fn drop(&mut self) {
23815                 if self.datalen == 0 { return; }
23816                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23817         }
23818 }
23819 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23820         fn clone(&self) -> Self {
23821                 let mut res = Vec::new();
23822                 if self.datalen == 0 { return Self::from(res); }
23823                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23824                 Self::from(res)
23825         }
23826 }