Update CI/Cargo.toml references to 0.0.122
[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_u8Zu64Z {
1557         /// The element at position 0
1558         pub a: crate::c_types::derived::CVec_u8Z,
1559         /// The element at position 1
1560         pub b: u64,
1561 }
1562 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
1563         fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
1564                 Self {
1565                         a: tup.0,
1566                         b: tup.1,
1567                 }
1568         }
1569 }
1570 impl C2Tuple_CVec_u8Zu64Z {
1571         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
1572                 (self.a, self.b)
1573         }
1574 }
1575 impl Clone for C2Tuple_CVec_u8Zu64Z {
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_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
1587 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
1588 #[no_mangle]
1589 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
1590         C2Tuple_CVec_u8Zu64Z { a, b, }
1591 }
1592
1593 #[no_mangle]
1594 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
1595 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
1596 #[repr(C)]
1597 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
1598 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
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_u8Zu64Z,
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_u8Zu64ZNoneZ represents the result of a fallible operation,
1607 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z 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_u8Zu64ZNoneZ {
1610         /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
1611         /// `err` or `result` depending on the state of `result_ok`.
1612         pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
1613         /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
1614         pub result_ok: bool,
1615 }
1616 #[no_mangle]
1617 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
1618 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1619         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1620                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
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_u8Zu64ZNoneZ in the error state.
1628 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1629         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1630                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
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_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
1639         o.result_ok
1640 }
1641 #[no_mangle]
1642 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
1643 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
1644 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
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_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1655         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> 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_u8Zu64ZNoneZPtr { result }
1660                 } else {
1661                         let _ = unsafe { Box::from_raw(o.contents.err) };
1662                         o.contents.err = core::ptr::null_mut();
1663                         CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { 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_u8Zu64ZNoneZ {
1672         fn clone(&self) -> Self {
1673                 if self.result_ok {
1674                         Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1675                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
1676                         } }
1677                 } else {
1678                         Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1679                                 err: core::ptr::null_mut()
1680                         } }
1681                 }
1682         }
1683 }
1684 #[no_mangle]
1685 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ 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_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { 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 /// The contents of CResult_PublicKeyNoneZ
1970 pub union CResult_PublicKeyNoneZPtr {
1971         /// A pointer to the contents in the success state.
1972         /// Reading from this pointer when `result_ok` is not set is undefined.
1973         pub result: *mut crate::c_types::PublicKey,
1974         /// Note that this value is always NULL, as there are no contents in the Err variant
1975         pub err: *mut core::ffi::c_void,
1976 }
1977 #[repr(C)]
1978 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
1979 /// containing a crate::c_types::PublicKey on success and a () on failure.
1980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1981 pub struct CResult_PublicKeyNoneZ {
1982         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
1983         /// `err` or `result` depending on the state of `result_ok`.
1984         pub contents: CResult_PublicKeyNoneZPtr,
1985         /// Whether this CResult_PublicKeyNoneZ represents a success state.
1986         pub result_ok: bool,
1987 }
1988 #[no_mangle]
1989 /// Creates a new CResult_PublicKeyNoneZ in the success state.
1990 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
1991         CResult_PublicKeyNoneZ {
1992                 contents: CResult_PublicKeyNoneZPtr {
1993                         result: Box::into_raw(Box::new(o)),
1994                 },
1995                 result_ok: true,
1996         }
1997 }
1998 #[no_mangle]
1999 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2000 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2001         CResult_PublicKeyNoneZ {
2002                 contents: CResult_PublicKeyNoneZPtr {
2003                         err: core::ptr::null_mut(),
2004                 },
2005                 result_ok: false,
2006         }
2007 }
2008 /// Checks if the given object is currently in the success state
2009 #[no_mangle]
2010 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2011         o.result_ok
2012 }
2013 #[no_mangle]
2014 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2015 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2016 impl Drop for CResult_PublicKeyNoneZ {
2017         fn drop(&mut self) {
2018                 if self.result_ok {
2019                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2020                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2021                         }
2022                 } else {
2023                 }
2024         }
2025 }
2026 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2027         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2028                 let contents = if o.result_ok {
2029                         let result = unsafe { o.contents.result };
2030                         unsafe { o.contents.result = core::ptr::null_mut() };
2031                         CResult_PublicKeyNoneZPtr { result }
2032                 } else {
2033                         let _ = unsafe { Box::from_raw(o.contents.err) };
2034                         o.contents.err = core::ptr::null_mut();
2035                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2036                 };
2037                 Self {
2038                         contents,
2039                         result_ok: o.result_ok,
2040                 }
2041         }
2042 }
2043 impl Clone for CResult_PublicKeyNoneZ {
2044         fn clone(&self) -> Self {
2045                 if self.result_ok {
2046                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2047                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2048                         } }
2049                 } else {
2050                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2051                                 err: core::ptr::null_mut()
2052                         } }
2053                 }
2054         }
2055 }
2056 #[no_mangle]
2057 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2058 /// but with all dynamically-allocated buffers duplicated in new buffers.
2059 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2060 #[repr(C)]
2061 #[derive(Clone)]
2062 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2063 pub enum COption_BigEndianScalarZ {
2064         /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2065         Some(crate::c_types::BigEndianScalar),
2066         /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2067         None
2068 }
2069 impl COption_BigEndianScalarZ {
2070         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2071                 if let Self::None = self { false } else { true }
2072         }
2073         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2074                 !self.is_some()
2075         }
2076         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2077                 if let Self::Some(v) = self { v } else { unreachable!() }
2078         }
2079 }
2080 #[no_mangle]
2081 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2082 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2083         COption_BigEndianScalarZ::Some(o)
2084 }
2085 #[no_mangle]
2086 /// Constructs a new COption_BigEndianScalarZ containing nothing
2087 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2088         COption_BigEndianScalarZ::None
2089 }
2090 #[no_mangle]
2091 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2092 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2093 #[no_mangle]
2094 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2095 /// but with all dynamically-allocated buffers duplicated in new buffers.
2096 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2097 #[repr(C)]
2098 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2099 /// This corresponds to std::vector in C++
2100 pub struct CVec_U5Z {
2101         /// The elements in the array.
2102         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2103         pub data: *mut crate::c_types::U5,
2104         /// The number of elements pointed to by `data`.
2105         pub datalen: usize
2106 }
2107 impl CVec_U5Z {
2108         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2109                 if self.datalen == 0 { return Vec::new(); }
2110                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2111                 self.data = core::ptr::null_mut();
2112                 self.datalen = 0;
2113                 ret
2114         }
2115         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2116                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2117         }
2118 }
2119 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2120         fn from(v: Vec<crate::c_types::U5>) -> Self {
2121                 let datalen = v.len();
2122                 let data = Box::into_raw(v.into_boxed_slice());
2123                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2124         }
2125 }
2126 #[no_mangle]
2127 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2128 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2129 impl Drop for CVec_U5Z {
2130         fn drop(&mut self) {
2131                 if self.datalen == 0 { return; }
2132                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2133         }
2134 }
2135 impl Clone for CVec_U5Z {
2136         fn clone(&self) -> Self {
2137                 let mut res = Vec::new();
2138                 if self.datalen == 0 { return Self::from(res); }
2139                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2140                 Self::from(res)
2141         }
2142 }
2143 #[repr(C)]
2144 /// The contents of CResult_RecoverableSignatureNoneZ
2145 pub union CResult_RecoverableSignatureNoneZPtr {
2146         /// A pointer to the contents in the success state.
2147         /// Reading from this pointer when `result_ok` is not set is undefined.
2148         pub result: *mut crate::c_types::RecoverableSignature,
2149         /// Note that this value is always NULL, as there are no contents in the Err variant
2150         pub err: *mut core::ffi::c_void,
2151 }
2152 #[repr(C)]
2153 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2154 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2156 pub struct CResult_RecoverableSignatureNoneZ {
2157         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2158         /// `err` or `result` depending on the state of `result_ok`.
2159         pub contents: CResult_RecoverableSignatureNoneZPtr,
2160         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2161         pub result_ok: bool,
2162 }
2163 #[no_mangle]
2164 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2165 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2166         CResult_RecoverableSignatureNoneZ {
2167                 contents: CResult_RecoverableSignatureNoneZPtr {
2168                         result: Box::into_raw(Box::new(o)),
2169                 },
2170                 result_ok: true,
2171         }
2172 }
2173 #[no_mangle]
2174 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2175 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2176         CResult_RecoverableSignatureNoneZ {
2177                 contents: CResult_RecoverableSignatureNoneZPtr {
2178                         err: core::ptr::null_mut(),
2179                 },
2180                 result_ok: false,
2181         }
2182 }
2183 /// Checks if the given object is currently in the success state
2184 #[no_mangle]
2185 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2186         o.result_ok
2187 }
2188 #[no_mangle]
2189 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2190 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2191 impl Drop for CResult_RecoverableSignatureNoneZ {
2192         fn drop(&mut self) {
2193                 if self.result_ok {
2194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2196                         }
2197                 } else {
2198                 }
2199         }
2200 }
2201 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2202         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2203                 let contents = if o.result_ok {
2204                         let result = unsafe { o.contents.result };
2205                         unsafe { o.contents.result = core::ptr::null_mut() };
2206                         CResult_RecoverableSignatureNoneZPtr { result }
2207                 } else {
2208                         let _ = unsafe { Box::from_raw(o.contents.err) };
2209                         o.contents.err = core::ptr::null_mut();
2210                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2211                 };
2212                 Self {
2213                         contents,
2214                         result_ok: o.result_ok,
2215                 }
2216         }
2217 }
2218 impl Clone for CResult_RecoverableSignatureNoneZ {
2219         fn clone(&self) -> Self {
2220                 if self.result_ok {
2221                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2222                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2223                         } }
2224                 } else {
2225                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2226                                 err: core::ptr::null_mut()
2227                         } }
2228                 }
2229         }
2230 }
2231 #[no_mangle]
2232 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2233 /// but with all dynamically-allocated buffers duplicated in new buffers.
2234 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2235 #[repr(C)]
2236 /// The contents of CResult_SchnorrSignatureNoneZ
2237 pub union CResult_SchnorrSignatureNoneZPtr {
2238         /// A pointer to the contents in the success state.
2239         /// Reading from this pointer when `result_ok` is not set is undefined.
2240         pub result: *mut crate::c_types::SchnorrSignature,
2241         /// Note that this value is always NULL, as there are no contents in the Err variant
2242         pub err: *mut core::ffi::c_void,
2243 }
2244 #[repr(C)]
2245 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2246 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2248 pub struct CResult_SchnorrSignatureNoneZ {
2249         /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2250         /// `err` or `result` depending on the state of `result_ok`.
2251         pub contents: CResult_SchnorrSignatureNoneZPtr,
2252         /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2253         pub result_ok: bool,
2254 }
2255 #[no_mangle]
2256 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2257 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2258         CResult_SchnorrSignatureNoneZ {
2259                 contents: CResult_SchnorrSignatureNoneZPtr {
2260                         result: Box::into_raw(Box::new(o)),
2261                 },
2262                 result_ok: true,
2263         }
2264 }
2265 #[no_mangle]
2266 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2267 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2268         CResult_SchnorrSignatureNoneZ {
2269                 contents: CResult_SchnorrSignatureNoneZPtr {
2270                         err: core::ptr::null_mut(),
2271                 },
2272                 result_ok: false,
2273         }
2274 }
2275 /// Checks if the given object is currently in the success state
2276 #[no_mangle]
2277 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2278         o.result_ok
2279 }
2280 #[no_mangle]
2281 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2282 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2283 impl Drop for CResult_SchnorrSignatureNoneZ {
2284         fn drop(&mut self) {
2285                 if self.result_ok {
2286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2288                         }
2289                 } else {
2290                 }
2291         }
2292 }
2293 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2294         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2295                 let contents = if o.result_ok {
2296                         let result = unsafe { o.contents.result };
2297                         unsafe { o.contents.result = core::ptr::null_mut() };
2298                         CResult_SchnorrSignatureNoneZPtr { result }
2299                 } else {
2300                         let _ = unsafe { Box::from_raw(o.contents.err) };
2301                         o.contents.err = core::ptr::null_mut();
2302                         CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2303                 };
2304                 Self {
2305                         contents,
2306                         result_ok: o.result_ok,
2307                 }
2308         }
2309 }
2310 impl Clone for CResult_SchnorrSignatureNoneZ {
2311         fn clone(&self) -> Self {
2312                 if self.result_ok {
2313                         Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2314                                 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2315                         } }
2316                 } else {
2317                         Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2318                                 err: core::ptr::null_mut()
2319                         } }
2320                 }
2321         }
2322 }
2323 #[no_mangle]
2324 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2325 /// but with all dynamically-allocated buffers duplicated in new buffers.
2326 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2327 #[repr(C)]
2328 /// The contents of CResult_ECDSASignatureNoneZ
2329 pub union CResult_ECDSASignatureNoneZPtr {
2330         /// A pointer to the contents in the success state.
2331         /// Reading from this pointer when `result_ok` is not set is undefined.
2332         pub result: *mut crate::c_types::ECDSASignature,
2333         /// Note that this value is always NULL, as there are no contents in the Err variant
2334         pub err: *mut core::ffi::c_void,
2335 }
2336 #[repr(C)]
2337 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2338 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2340 pub struct CResult_ECDSASignatureNoneZ {
2341         /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2342         /// `err` or `result` depending on the state of `result_ok`.
2343         pub contents: CResult_ECDSASignatureNoneZPtr,
2344         /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2345         pub result_ok: bool,
2346 }
2347 #[no_mangle]
2348 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2349 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2350         CResult_ECDSASignatureNoneZ {
2351                 contents: CResult_ECDSASignatureNoneZPtr {
2352                         result: Box::into_raw(Box::new(o)),
2353                 },
2354                 result_ok: true,
2355         }
2356 }
2357 #[no_mangle]
2358 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2359 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2360         CResult_ECDSASignatureNoneZ {
2361                 contents: CResult_ECDSASignatureNoneZPtr {
2362                         err: core::ptr::null_mut(),
2363                 },
2364                 result_ok: false,
2365         }
2366 }
2367 /// Checks if the given object is currently in the success state
2368 #[no_mangle]
2369 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2370         o.result_ok
2371 }
2372 #[no_mangle]
2373 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2374 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2375 impl Drop for CResult_ECDSASignatureNoneZ {
2376         fn drop(&mut self) {
2377                 if self.result_ok {
2378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2380                         }
2381                 } else {
2382                 }
2383         }
2384 }
2385 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2386         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2387                 let contents = if o.result_ok {
2388                         let result = unsafe { o.contents.result };
2389                         unsafe { o.contents.result = core::ptr::null_mut() };
2390                         CResult_ECDSASignatureNoneZPtr { result }
2391                 } else {
2392                         let _ = unsafe { Box::from_raw(o.contents.err) };
2393                         o.contents.err = core::ptr::null_mut();
2394                         CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2395                 };
2396                 Self {
2397                         contents,
2398                         result_ok: o.result_ok,
2399                 }
2400         }
2401 }
2402 impl Clone for CResult_ECDSASignatureNoneZ {
2403         fn clone(&self) -> Self {
2404                 if self.result_ok {
2405                         Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2406                                 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2407                         } }
2408                 } else {
2409                         Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2410                                 err: core::ptr::null_mut()
2411                         } }
2412                 }
2413         }
2414 }
2415 #[no_mangle]
2416 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2417 /// but with all dynamically-allocated buffers duplicated in new buffers.
2418 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2419 #[repr(C)]
2420 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2421 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2422         /// A pointer to the contents in the success state.
2423         /// Reading from this pointer when `result_ok` is not set is undefined.
2424         pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2425         /// A pointer to the contents in the error state.
2426         /// Reading from this pointer when `result_ok` is set is undefined.
2427         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2428 }
2429 #[repr(C)]
2430 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2431 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2433 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2434         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2435         /// `err` or `result` depending on the state of `result_ok`.
2436         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2437         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2438         pub result_ok: bool,
2439 }
2440 #[no_mangle]
2441 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2442 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2443         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2444                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2445                         result: Box::into_raw(Box::new(o)),
2446                 },
2447                 result_ok: true,
2448         }
2449 }
2450 #[no_mangle]
2451 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2452 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2453         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2454                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2455                         err: Box::into_raw(Box::new(e)),
2456                 },
2457                 result_ok: false,
2458         }
2459 }
2460 /// Checks if the given object is currently in the success state
2461 #[no_mangle]
2462 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2463         o.result_ok
2464 }
2465 #[no_mangle]
2466 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2467 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2468 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2469         fn drop(&mut self) {
2470                 if self.result_ok {
2471                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2472                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2473                         }
2474                 } else {
2475                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2476                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2477                         }
2478                 }
2479         }
2480 }
2481 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2482         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2483                 let contents = if o.result_ok {
2484                         let result = unsafe { o.contents.result };
2485                         unsafe { o.contents.result = core::ptr::null_mut() };
2486                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2487                 } else {
2488                         let err = unsafe { o.contents.err };
2489                         unsafe { o.contents.err = core::ptr::null_mut(); }
2490                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2491                 };
2492                 Self {
2493                         contents,
2494                         result_ok: o.result_ok,
2495                 }
2496         }
2497 }
2498 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2499         fn clone(&self) -> Self {
2500                 if self.result_ok {
2501                         Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2502                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2503                         } }
2504                 } else {
2505                         Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2506                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2507                         } }
2508                 }
2509         }
2510 }
2511 #[no_mangle]
2512 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2513 /// but with all dynamically-allocated buffers duplicated in new buffers.
2514 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2515 #[repr(C)]
2516 /// The contents of CResult_CVec_u8ZNoneZ
2517 pub union CResult_CVec_u8ZNoneZPtr {
2518         /// A pointer to the contents in the success state.
2519         /// Reading from this pointer when `result_ok` is not set is undefined.
2520         pub result: *mut crate::c_types::derived::CVec_u8Z,
2521         /// Note that this value is always NULL, as there are no contents in the Err variant
2522         pub err: *mut core::ffi::c_void,
2523 }
2524 #[repr(C)]
2525 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2526 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2528 pub struct CResult_CVec_u8ZNoneZ {
2529         /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2530         /// `err` or `result` depending on the state of `result_ok`.
2531         pub contents: CResult_CVec_u8ZNoneZPtr,
2532         /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2533         pub result_ok: bool,
2534 }
2535 #[no_mangle]
2536 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2537 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2538         CResult_CVec_u8ZNoneZ {
2539                 contents: CResult_CVec_u8ZNoneZPtr {
2540                         result: Box::into_raw(Box::new(o)),
2541                 },
2542                 result_ok: true,
2543         }
2544 }
2545 #[no_mangle]
2546 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2547 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2548         CResult_CVec_u8ZNoneZ {
2549                 contents: CResult_CVec_u8ZNoneZPtr {
2550                         err: core::ptr::null_mut(),
2551                 },
2552                 result_ok: false,
2553         }
2554 }
2555 /// Checks if the given object is currently in the success state
2556 #[no_mangle]
2557 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2558         o.result_ok
2559 }
2560 #[no_mangle]
2561 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2562 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2563 impl Drop for CResult_CVec_u8ZNoneZ {
2564         fn drop(&mut self) {
2565                 if self.result_ok {
2566                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2567                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2568                         }
2569                 } else {
2570                 }
2571         }
2572 }
2573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2574         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2575                 let contents = if o.result_ok {
2576                         let result = unsafe { o.contents.result };
2577                         unsafe { o.contents.result = core::ptr::null_mut() };
2578                         CResult_CVec_u8ZNoneZPtr { result }
2579                 } else {
2580                         let _ = unsafe { Box::from_raw(o.contents.err) };
2581                         o.contents.err = core::ptr::null_mut();
2582                         CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2583                 };
2584                 Self {
2585                         contents,
2586                         result_ok: o.result_ok,
2587                 }
2588         }
2589 }
2590 impl Clone for CResult_CVec_u8ZNoneZ {
2591         fn clone(&self) -> Self {
2592                 if self.result_ok {
2593                         Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2594                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2595                         } }
2596                 } else {
2597                         Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2598                                 err: core::ptr::null_mut()
2599                         } }
2600                 }
2601         }
2602 }
2603 #[no_mangle]
2604 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2605 /// but with all dynamically-allocated buffers duplicated in new buffers.
2606 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2607 #[repr(C)]
2608 /// The contents of CResult_ShutdownScriptNoneZ
2609 pub union CResult_ShutdownScriptNoneZPtr {
2610         /// A pointer to the contents in the success state.
2611         /// Reading from this pointer when `result_ok` is not set is undefined.
2612         pub result: *mut crate::lightning::ln::script::ShutdownScript,
2613         /// Note that this value is always NULL, as there are no contents in the Err variant
2614         pub err: *mut core::ffi::c_void,
2615 }
2616 #[repr(C)]
2617 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2618 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2620 pub struct CResult_ShutdownScriptNoneZ {
2621         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2622         /// `err` or `result` depending on the state of `result_ok`.
2623         pub contents: CResult_ShutdownScriptNoneZPtr,
2624         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2625         pub result_ok: bool,
2626 }
2627 #[no_mangle]
2628 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2629 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2630         CResult_ShutdownScriptNoneZ {
2631                 contents: CResult_ShutdownScriptNoneZPtr {
2632                         result: Box::into_raw(Box::new(o)),
2633                 },
2634                 result_ok: true,
2635         }
2636 }
2637 #[no_mangle]
2638 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2639 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2640         CResult_ShutdownScriptNoneZ {
2641                 contents: CResult_ShutdownScriptNoneZPtr {
2642                         err: core::ptr::null_mut(),
2643                 },
2644                 result_ok: false,
2645         }
2646 }
2647 /// Checks if the given object is currently in the success state
2648 #[no_mangle]
2649 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2650         o.result_ok
2651 }
2652 #[no_mangle]
2653 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2654 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2655 impl Drop for CResult_ShutdownScriptNoneZ {
2656         fn drop(&mut self) {
2657                 if self.result_ok {
2658                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2659                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2660                         }
2661                 } else {
2662                 }
2663         }
2664 }
2665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2666         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2667                 let contents = if o.result_ok {
2668                         let result = unsafe { o.contents.result };
2669                         unsafe { o.contents.result = core::ptr::null_mut() };
2670                         CResult_ShutdownScriptNoneZPtr { result }
2671                 } else {
2672                         let _ = unsafe { Box::from_raw(o.contents.err) };
2673                         o.contents.err = core::ptr::null_mut();
2674                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2675                 };
2676                 Self {
2677                         contents,
2678                         result_ok: o.result_ok,
2679                 }
2680         }
2681 }
2682 impl Clone for CResult_ShutdownScriptNoneZ {
2683         fn clone(&self) -> Self {
2684                 if self.result_ok {
2685                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2686                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2687                         } }
2688                 } else {
2689                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2690                                 err: core::ptr::null_mut()
2691                         } }
2692                 }
2693         }
2694 }
2695 #[no_mangle]
2696 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2697 /// but with all dynamically-allocated buffers duplicated in new buffers.
2698 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2699 #[repr(C)]
2700 #[derive(Clone)]
2701 /// An enum which can either contain a u16 or not
2702 pub enum COption_u16Z {
2703         /// When we're in this state, this COption_u16Z contains a u16
2704         Some(u16),
2705         /// When we're in this state, this COption_u16Z contains nothing
2706         None
2707 }
2708 impl COption_u16Z {
2709         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2710                 if let Self::None = self { false } else { true }
2711         }
2712         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2713                 !self.is_some()
2714         }
2715         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2716                 if let Self::Some(v) = self { v } else { unreachable!() }
2717         }
2718 }
2719 #[no_mangle]
2720 /// Constructs a new COption_u16Z containing a u16
2721 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2722         COption_u16Z::Some(o)
2723 }
2724 #[no_mangle]
2725 /// Constructs a new COption_u16Z containing nothing
2726 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2727         COption_u16Z::None
2728 }
2729 #[no_mangle]
2730 /// Frees any resources associated with the u16, if we are in the Some state
2731 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2732 #[no_mangle]
2733 /// Creates a new COption_u16Z which has the same data as `orig`
2734 /// but with all dynamically-allocated buffers duplicated in new buffers.
2735 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2736 #[repr(C)]
2737 #[derive(Clone)]
2738 /// An enum which can either contain a bool or not
2739 pub enum COption_boolZ {
2740         /// When we're in this state, this COption_boolZ contains a bool
2741         Some(bool),
2742         /// When we're in this state, this COption_boolZ contains nothing
2743         None
2744 }
2745 impl COption_boolZ {
2746         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2747                 if let Self::None = self { false } else { true }
2748         }
2749         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2750                 !self.is_some()
2751         }
2752         #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2753                 if let Self::Some(v) = self { v } else { unreachable!() }
2754         }
2755 }
2756 #[no_mangle]
2757 /// Constructs a new COption_boolZ containing a bool
2758 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2759         COption_boolZ::Some(o)
2760 }
2761 #[no_mangle]
2762 /// Constructs a new COption_boolZ containing nothing
2763 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2764         COption_boolZ::None
2765 }
2766 #[no_mangle]
2767 /// Frees any resources associated with the bool, if we are in the Some state
2768 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2769 #[no_mangle]
2770 /// Creates a new COption_boolZ which has the same data as `orig`
2771 /// but with all dynamically-allocated buffers duplicated in new buffers.
2772 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2773 #[repr(C)]
2774 /// The contents of CResult_WitnessNoneZ
2775 pub union CResult_WitnessNoneZPtr {
2776         /// A pointer to the contents in the success state.
2777         /// Reading from this pointer when `result_ok` is not set is undefined.
2778         pub result: *mut crate::c_types::Witness,
2779         /// Note that this value is always NULL, as there are no contents in the Err variant
2780         pub err: *mut core::ffi::c_void,
2781 }
2782 #[repr(C)]
2783 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
2784 /// containing a crate::c_types::Witness on success and a () on failure.
2785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2786 pub struct CResult_WitnessNoneZ {
2787         /// The contents of this CResult_WitnessNoneZ, accessible via either
2788         /// `err` or `result` depending on the state of `result_ok`.
2789         pub contents: CResult_WitnessNoneZPtr,
2790         /// Whether this CResult_WitnessNoneZ represents a success state.
2791         pub result_ok: bool,
2792 }
2793 #[no_mangle]
2794 /// Creates a new CResult_WitnessNoneZ in the success state.
2795 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
2796         CResult_WitnessNoneZ {
2797                 contents: CResult_WitnessNoneZPtr {
2798                         result: Box::into_raw(Box::new(o)),
2799                 },
2800                 result_ok: true,
2801         }
2802 }
2803 #[no_mangle]
2804 /// Creates a new CResult_WitnessNoneZ in the error state.
2805 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
2806         CResult_WitnessNoneZ {
2807                 contents: CResult_WitnessNoneZPtr {
2808                         err: core::ptr::null_mut(),
2809                 },
2810                 result_ok: false,
2811         }
2812 }
2813 /// Checks if the given object is currently in the success state
2814 #[no_mangle]
2815 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
2816         o.result_ok
2817 }
2818 #[no_mangle]
2819 /// Frees any resources used by the CResult_WitnessNoneZ.
2820 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
2821 impl Drop for CResult_WitnessNoneZ {
2822         fn drop(&mut self) {
2823                 if self.result_ok {
2824                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2825                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2826                         }
2827                 } else {
2828                 }
2829         }
2830 }
2831 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
2832         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
2833                 let contents = if o.result_ok {
2834                         let result = unsafe { o.contents.result };
2835                         unsafe { o.contents.result = core::ptr::null_mut() };
2836                         CResult_WitnessNoneZPtr { result }
2837                 } else {
2838                         let _ = unsafe { Box::from_raw(o.contents.err) };
2839                         o.contents.err = core::ptr::null_mut();
2840                         CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
2841                 };
2842                 Self {
2843                         contents,
2844                         result_ok: o.result_ok,
2845                 }
2846         }
2847 }
2848 impl Clone for CResult_WitnessNoneZ {
2849         fn clone(&self) -> Self {
2850                 if self.result_ok {
2851                         Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
2852                                 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
2853                         } }
2854                 } else {
2855                         Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
2856                                 err: core::ptr::null_mut()
2857                         } }
2858                 }
2859         }
2860 }
2861 #[no_mangle]
2862 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
2863 /// but with all dynamically-allocated buffers duplicated in new buffers.
2864 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
2865 #[repr(C)]
2866 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
2867 /// This corresponds to std::vector in C++
2868 pub struct CVec_ECDSASignatureZ {
2869         /// The elements in the array.
2870         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2871         pub data: *mut crate::c_types::ECDSASignature,
2872         /// The number of elements pointed to by `data`.
2873         pub datalen: usize
2874 }
2875 impl CVec_ECDSASignatureZ {
2876         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
2877                 if self.datalen == 0 { return Vec::new(); }
2878                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2879                 self.data = core::ptr::null_mut();
2880                 self.datalen = 0;
2881                 ret
2882         }
2883         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
2884                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2885         }
2886 }
2887 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
2888         fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
2889                 let datalen = v.len();
2890                 let data = Box::into_raw(v.into_boxed_slice());
2891                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2892         }
2893 }
2894 #[no_mangle]
2895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2896 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
2897 impl Drop for CVec_ECDSASignatureZ {
2898         fn drop(&mut self) {
2899                 if self.datalen == 0 { return; }
2900                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2901         }
2902 }
2903 impl Clone for CVec_ECDSASignatureZ {
2904         fn clone(&self) -> Self {
2905                 let mut res = Vec::new();
2906                 if self.datalen == 0 { return Self::from(res); }
2907                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2908                 Self::from(res)
2909         }
2910 }
2911 #[repr(C)]
2912 /// A tuple of 2 elements. See the individual fields for the types contained.
2913 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2914         /// The element at position 0
2915         pub a: crate::c_types::ECDSASignature,
2916         /// The element at position 1
2917         pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
2918 }
2919 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2920         fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
2921                 Self {
2922                         a: tup.0,
2923                         b: tup.1,
2924                 }
2925         }
2926 }
2927 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2928         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
2929                 (self.a, self.b)
2930         }
2931 }
2932 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2933         fn clone(&self) -> Self {
2934                 Self {
2935                         a: Clone::clone(&self.a),
2936                         b: Clone::clone(&self.b),
2937                 }
2938         }
2939 }
2940 #[no_mangle]
2941 /// Creates a new tuple which has the same data as `orig`
2942 /// but with all dynamically-allocated buffers duplicated in new buffers.
2943 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
2944 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
2945 #[no_mangle]
2946 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2947         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
2948 }
2949
2950 #[no_mangle]
2951 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
2952 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
2953 #[repr(C)]
2954 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
2955 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2956         /// A pointer to the contents in the success state.
2957         /// Reading from this pointer when `result_ok` is not set is undefined.
2958         pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
2959         /// Note that this value is always NULL, as there are no contents in the Err variant
2960         pub err: *mut core::ffi::c_void,
2961 }
2962 #[repr(C)]
2963 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
2964 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
2965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2966 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2967         /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
2968         /// `err` or `result` depending on the state of `result_ok`.
2969         pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
2970         /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
2971         pub result_ok: bool,
2972 }
2973 #[no_mangle]
2974 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
2975 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2976         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2977                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2978                         result: Box::into_raw(Box::new(o)),
2979                 },
2980                 result_ok: true,
2981         }
2982 }
2983 #[no_mangle]
2984 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
2985 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2986         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2987                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2988                         err: core::ptr::null_mut(),
2989                 },
2990                 result_ok: false,
2991         }
2992 }
2993 /// Checks if the given object is currently in the success state
2994 #[no_mangle]
2995 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
2996         o.result_ok
2997 }
2998 #[no_mangle]
2999 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3000 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3001 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3002         fn drop(&mut self) {
3003                 if self.result_ok {
3004                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3005                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3006                         }
3007                 } else {
3008                 }
3009         }
3010 }
3011 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3012         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3013                 let contents = if o.result_ok {
3014                         let result = unsafe { o.contents.result };
3015                         unsafe { o.contents.result = core::ptr::null_mut() };
3016                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3017                 } else {
3018                         let _ = unsafe { Box::from_raw(o.contents.err) };
3019                         o.contents.err = core::ptr::null_mut();
3020                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3021                 };
3022                 Self {
3023                         contents,
3024                         result_ok: o.result_ok,
3025                 }
3026         }
3027 }
3028 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3029         fn clone(&self) -> Self {
3030                 if self.result_ok {
3031                         Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3032                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3033                         } }
3034                 } else {
3035                         Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3036                                 err: core::ptr::null_mut()
3037                         } }
3038                 }
3039         }
3040 }
3041 #[no_mangle]
3042 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3043 /// but with all dynamically-allocated buffers duplicated in new buffers.
3044 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3045 #[repr(C)]
3046 /// The contents of CResult_InMemorySignerDecodeErrorZ
3047 pub union CResult_InMemorySignerDecodeErrorZPtr {
3048         /// A pointer to the contents in the success state.
3049         /// Reading from this pointer when `result_ok` is not set is undefined.
3050         pub result: *mut crate::lightning::sign::InMemorySigner,
3051         /// A pointer to the contents in the error state.
3052         /// Reading from this pointer when `result_ok` is set is undefined.
3053         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3054 }
3055 #[repr(C)]
3056 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3057 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3059 pub struct CResult_InMemorySignerDecodeErrorZ {
3060         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3061         /// `err` or `result` depending on the state of `result_ok`.
3062         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3063         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3064         pub result_ok: bool,
3065 }
3066 #[no_mangle]
3067 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3068 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3069         CResult_InMemorySignerDecodeErrorZ {
3070                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3071                         result: Box::into_raw(Box::new(o)),
3072                 },
3073                 result_ok: true,
3074         }
3075 }
3076 #[no_mangle]
3077 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3078 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3079         CResult_InMemorySignerDecodeErrorZ {
3080                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3081                         err: Box::into_raw(Box::new(e)),
3082                 },
3083                 result_ok: false,
3084         }
3085 }
3086 /// Checks if the given object is currently in the success state
3087 #[no_mangle]
3088 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3089         o.result_ok
3090 }
3091 #[no_mangle]
3092 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3093 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3094 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3095         fn drop(&mut self) {
3096                 if self.result_ok {
3097                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3098                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3099                         }
3100                 } else {
3101                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3102                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3103                         }
3104                 }
3105         }
3106 }
3107 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3108         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3109                 let contents = if o.result_ok {
3110                         let result = unsafe { o.contents.result };
3111                         unsafe { o.contents.result = core::ptr::null_mut() };
3112                         CResult_InMemorySignerDecodeErrorZPtr { result }
3113                 } else {
3114                         let err = unsafe { o.contents.err };
3115                         unsafe { o.contents.err = core::ptr::null_mut(); }
3116                         CResult_InMemorySignerDecodeErrorZPtr { err }
3117                 };
3118                 Self {
3119                         contents,
3120                         result_ok: o.result_ok,
3121                 }
3122         }
3123 }
3124 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3125         fn clone(&self) -> Self {
3126                 if self.result_ok {
3127                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3128                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3129                         } }
3130                 } else {
3131                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3132                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3133                         } }
3134                 }
3135         }
3136 }
3137 #[no_mangle]
3138 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3139 /// but with all dynamically-allocated buffers duplicated in new buffers.
3140 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3141 #[repr(C)]
3142 /// The contents of CResult_TransactionNoneZ
3143 pub union CResult_TransactionNoneZPtr {
3144         /// A pointer to the contents in the success state.
3145         /// Reading from this pointer when `result_ok` is not set is undefined.
3146         pub result: *mut crate::c_types::Transaction,
3147         /// Note that this value is always NULL, as there are no contents in the Err variant
3148         pub err: *mut core::ffi::c_void,
3149 }
3150 #[repr(C)]
3151 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3152 /// containing a crate::c_types::Transaction on success and a () on failure.
3153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3154 pub struct CResult_TransactionNoneZ {
3155         /// The contents of this CResult_TransactionNoneZ, accessible via either
3156         /// `err` or `result` depending on the state of `result_ok`.
3157         pub contents: CResult_TransactionNoneZPtr,
3158         /// Whether this CResult_TransactionNoneZ represents a success state.
3159         pub result_ok: bool,
3160 }
3161 #[no_mangle]
3162 /// Creates a new CResult_TransactionNoneZ in the success state.
3163 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3164         CResult_TransactionNoneZ {
3165                 contents: CResult_TransactionNoneZPtr {
3166                         result: Box::into_raw(Box::new(o)),
3167                 },
3168                 result_ok: true,
3169         }
3170 }
3171 #[no_mangle]
3172 /// Creates a new CResult_TransactionNoneZ in the error state.
3173 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3174         CResult_TransactionNoneZ {
3175                 contents: CResult_TransactionNoneZPtr {
3176                         err: core::ptr::null_mut(),
3177                 },
3178                 result_ok: false,
3179         }
3180 }
3181 /// Checks if the given object is currently in the success state
3182 #[no_mangle]
3183 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3184         o.result_ok
3185 }
3186 #[no_mangle]
3187 /// Frees any resources used by the CResult_TransactionNoneZ.
3188 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3189 impl Drop for CResult_TransactionNoneZ {
3190         fn drop(&mut self) {
3191                 if self.result_ok {
3192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3194                         }
3195                 } else {
3196                 }
3197         }
3198 }
3199 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3200         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3201                 let contents = if o.result_ok {
3202                         let result = unsafe { o.contents.result };
3203                         unsafe { o.contents.result = core::ptr::null_mut() };
3204                         CResult_TransactionNoneZPtr { result }
3205                 } else {
3206                         let _ = unsafe { Box::from_raw(o.contents.err) };
3207                         o.contents.err = core::ptr::null_mut();
3208                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3209                 };
3210                 Self {
3211                         contents,
3212                         result_ok: o.result_ok,
3213                 }
3214         }
3215 }
3216 impl Clone for CResult_TransactionNoneZ {
3217         fn clone(&self) -> Self {
3218                 if self.result_ok {
3219                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3220                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3221                         } }
3222                 } else {
3223                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3224                                 err: core::ptr::null_mut()
3225                         } }
3226                 }
3227         }
3228 }
3229 #[no_mangle]
3230 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3231 /// but with all dynamically-allocated buffers duplicated in new buffers.
3232 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3233 #[repr(C)]
3234 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3235 pub enum COption_WriteableScoreZ {
3236         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3237         Some(crate::lightning::routing::scoring::WriteableScore),
3238         /// When we're in this state, this COption_WriteableScoreZ contains nothing
3239         None
3240 }
3241 impl COption_WriteableScoreZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3254 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3255         COption_WriteableScoreZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_WriteableScoreZ containing nothing
3259 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3260         COption_WriteableScoreZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3264 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3265 #[repr(C)]
3266 /// The contents of CResult_NoneIOErrorZ
3267 pub union CResult_NoneIOErrorZPtr {
3268         /// Note that this value is always NULL, as there are no contents in the OK variant
3269         pub result: *mut core::ffi::c_void,
3270         /// A pointer to the contents in the error state.
3271         /// Reading from this pointer when `result_ok` is set is undefined.
3272         pub err: *mut crate::c_types::IOError,
3273 }
3274 #[repr(C)]
3275 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3276 /// containing a () on success and a crate::c_types::IOError on failure.
3277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3278 pub struct CResult_NoneIOErrorZ {
3279         /// The contents of this CResult_NoneIOErrorZ, accessible via either
3280         /// `err` or `result` depending on the state of `result_ok`.
3281         pub contents: CResult_NoneIOErrorZPtr,
3282         /// Whether this CResult_NoneIOErrorZ represents a success state.
3283         pub result_ok: bool,
3284 }
3285 #[no_mangle]
3286 /// Creates a new CResult_NoneIOErrorZ in the success state.
3287 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3288         CResult_NoneIOErrorZ {
3289                 contents: CResult_NoneIOErrorZPtr {
3290                         result: core::ptr::null_mut(),
3291                 },
3292                 result_ok: true,
3293         }
3294 }
3295 #[no_mangle]
3296 /// Creates a new CResult_NoneIOErrorZ in the error state.
3297 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3298         CResult_NoneIOErrorZ {
3299                 contents: CResult_NoneIOErrorZPtr {
3300                         err: Box::into_raw(Box::new(e)),
3301                 },
3302                 result_ok: false,
3303         }
3304 }
3305 /// Checks if the given object is currently in the success state
3306 #[no_mangle]
3307 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3308         o.result_ok
3309 }
3310 #[no_mangle]
3311 /// Frees any resources used by the CResult_NoneIOErrorZ.
3312 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3313 impl Drop for CResult_NoneIOErrorZ {
3314         fn drop(&mut self) {
3315                 if self.result_ok {
3316                 } else {
3317                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3318                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3319                         }
3320                 }
3321         }
3322 }
3323 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3324         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3325                 let contents = if o.result_ok {
3326                         let _ = unsafe { Box::from_raw(o.contents.result) };
3327                         o.contents.result = core::ptr::null_mut();
3328                         CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3329                 } else {
3330                         let err = unsafe { o.contents.err };
3331                         unsafe { o.contents.err = core::ptr::null_mut(); }
3332                         CResult_NoneIOErrorZPtr { err }
3333                 };
3334                 Self {
3335                         contents,
3336                         result_ok: o.result_ok,
3337                 }
3338         }
3339 }
3340 impl Clone for CResult_NoneIOErrorZ {
3341         fn clone(&self) -> Self {
3342                 if self.result_ok {
3343                         Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3344                                 result: core::ptr::null_mut()
3345                         } }
3346                 } else {
3347                         Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3348                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3349                         } }
3350                 }
3351         }
3352 }
3353 #[no_mangle]
3354 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3355 /// but with all dynamically-allocated buffers duplicated in new buffers.
3356 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3357 #[repr(C)]
3358 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3359 /// This corresponds to std::vector in C++
3360 pub struct CVec_ChannelDetailsZ {
3361         /// The elements in the array.
3362         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3363         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3364         /// The number of elements pointed to by `data`.
3365         pub datalen: usize
3366 }
3367 impl CVec_ChannelDetailsZ {
3368         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3369                 if self.datalen == 0 { return Vec::new(); }
3370                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3371                 self.data = core::ptr::null_mut();
3372                 self.datalen = 0;
3373                 ret
3374         }
3375         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3376                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3377         }
3378 }
3379 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3380         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3381                 let datalen = v.len();
3382                 let data = Box::into_raw(v.into_boxed_slice());
3383                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3384         }
3385 }
3386 #[no_mangle]
3387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3388 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3389 impl Drop for CVec_ChannelDetailsZ {
3390         fn drop(&mut self) {
3391                 if self.datalen == 0 { return; }
3392                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3393         }
3394 }
3395 impl Clone for CVec_ChannelDetailsZ {
3396         fn clone(&self) -> Self {
3397                 let mut res = Vec::new();
3398                 if self.datalen == 0 { return Self::from(res); }
3399                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3400                 Self::from(res)
3401         }
3402 }
3403 #[repr(C)]
3404 /// The contents of CResult_RouteLightningErrorZ
3405 pub union CResult_RouteLightningErrorZPtr {
3406         /// A pointer to the contents in the success state.
3407         /// Reading from this pointer when `result_ok` is not set is undefined.
3408         pub result: *mut crate::lightning::routing::router::Route,
3409         /// A pointer to the contents in the error state.
3410         /// Reading from this pointer when `result_ok` is set is undefined.
3411         pub err: *mut crate::lightning::ln::msgs::LightningError,
3412 }
3413 #[repr(C)]
3414 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3415 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3417 pub struct CResult_RouteLightningErrorZ {
3418         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3419         /// `err` or `result` depending on the state of `result_ok`.
3420         pub contents: CResult_RouteLightningErrorZPtr,
3421         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3422         pub result_ok: bool,
3423 }
3424 #[no_mangle]
3425 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3426 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3427         CResult_RouteLightningErrorZ {
3428                 contents: CResult_RouteLightningErrorZPtr {
3429                         result: Box::into_raw(Box::new(o)),
3430                 },
3431                 result_ok: true,
3432         }
3433 }
3434 #[no_mangle]
3435 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3436 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3437         CResult_RouteLightningErrorZ {
3438                 contents: CResult_RouteLightningErrorZPtr {
3439                         err: Box::into_raw(Box::new(e)),
3440                 },
3441                 result_ok: false,
3442         }
3443 }
3444 /// Checks if the given object is currently in the success state
3445 #[no_mangle]
3446 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3447         o.result_ok
3448 }
3449 #[no_mangle]
3450 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3451 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3452 impl Drop for CResult_RouteLightningErrorZ {
3453         fn drop(&mut self) {
3454                 if self.result_ok {
3455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3457                         }
3458                 } else {
3459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3461                         }
3462                 }
3463         }
3464 }
3465 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3467                 let contents = if o.result_ok {
3468                         let result = unsafe { o.contents.result };
3469                         unsafe { o.contents.result = core::ptr::null_mut() };
3470                         CResult_RouteLightningErrorZPtr { result }
3471                 } else {
3472                         let err = unsafe { o.contents.err };
3473                         unsafe { o.contents.err = core::ptr::null_mut(); }
3474                         CResult_RouteLightningErrorZPtr { err }
3475                 };
3476                 Self {
3477                         contents,
3478                         result_ok: o.result_ok,
3479                 }
3480         }
3481 }
3482 impl Clone for CResult_RouteLightningErrorZ {
3483         fn clone(&self) -> Self {
3484                 if self.result_ok {
3485                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3486                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3487                         } }
3488                 } else {
3489                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3491                         } }
3492                 }
3493         }
3494 }
3495 #[no_mangle]
3496 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3497 /// but with all dynamically-allocated buffers duplicated in new buffers.
3498 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3499 #[repr(C)]
3500 /// A tuple of 2 elements. See the individual fields for the types contained.
3501 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3502         /// The element at position 0
3503         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3504         /// The element at position 1
3505         pub b: crate::lightning::blinded_path::BlindedPath,
3506 }
3507 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3508         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3509                 Self {
3510                         a: tup.0,
3511                         b: tup.1,
3512                 }
3513         }
3514 }
3515 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3516         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3517                 (self.a, self.b)
3518         }
3519 }
3520 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3521         fn clone(&self) -> Self {
3522                 Self {
3523                         a: Clone::clone(&self.a),
3524                         b: Clone::clone(&self.b),
3525                 }
3526         }
3527 }
3528 #[no_mangle]
3529 /// Creates a new tuple which has the same data as `orig`
3530 /// but with all dynamically-allocated buffers duplicated in new buffers.
3531 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3532 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3533 #[no_mangle]
3534 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3535         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3536 }
3537
3538 #[no_mangle]
3539 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3540 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3541 #[repr(C)]
3542 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3543 /// This corresponds to std::vector in C++
3544 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3545         /// The elements in the array.
3546         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3547         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3548         /// The number of elements pointed to by `data`.
3549         pub datalen: usize
3550 }
3551 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3552         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3553                 if self.datalen == 0 { return Vec::new(); }
3554                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3555                 self.data = core::ptr::null_mut();
3556                 self.datalen = 0;
3557                 ret
3558         }
3559         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3560                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3561         }
3562 }
3563 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3564         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3565                 let datalen = v.len();
3566                 let data = Box::into_raw(v.into_boxed_slice());
3567                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3568         }
3569 }
3570 #[no_mangle]
3571 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3572 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3573 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3574         fn drop(&mut self) {
3575                 if self.datalen == 0 { return; }
3576                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3577         }
3578 }
3579 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3580         fn clone(&self) -> Self {
3581                 let mut res = Vec::new();
3582                 if self.datalen == 0 { return Self::from(res); }
3583                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3584                 Self::from(res)
3585         }
3586 }
3587 #[repr(C)]
3588 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
3589 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3590         /// A pointer to the contents in the success state.
3591         /// Reading from this pointer when `result_ok` is not set is undefined.
3592         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
3593         /// Note that this value is always NULL, as there are no contents in the Err variant
3594         pub err: *mut core::ffi::c_void,
3595 }
3596 #[repr(C)]
3597 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
3598 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
3599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3600 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3601         /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
3602         /// `err` or `result` depending on the state of `result_ok`.
3603         pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
3604         /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
3605         pub result_ok: bool,
3606 }
3607 #[no_mangle]
3608 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
3609 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3610         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3611                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3612                         result: Box::into_raw(Box::new(o)),
3613                 },
3614                 result_ok: true,
3615         }
3616 }
3617 #[no_mangle]
3618 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
3619 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3620         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3621                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3622                         err: core::ptr::null_mut(),
3623                 },
3624                 result_ok: false,
3625         }
3626 }
3627 /// Checks if the given object is currently in the success state
3628 #[no_mangle]
3629 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
3630         o.result_ok
3631 }
3632 #[no_mangle]
3633 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
3634 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
3635 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3636         fn drop(&mut self) {
3637                 if self.result_ok {
3638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3640                         }
3641                 } else {
3642                 }
3643         }
3644 }
3645 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3646         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
3647                 let contents = if o.result_ok {
3648                         let result = unsafe { o.contents.result };
3649                         unsafe { o.contents.result = core::ptr::null_mut() };
3650                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
3651                 } else {
3652                         let _ = unsafe { Box::from_raw(o.contents.err) };
3653                         o.contents.err = core::ptr::null_mut();
3654                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
3655                 };
3656                 Self {
3657                         contents,
3658                         result_ok: o.result_ok,
3659                 }
3660         }
3661 }
3662 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3663         fn clone(&self) -> Self {
3664                 if self.result_ok {
3665                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3666                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
3667                         } }
3668                 } else {
3669                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3670                                 err: core::ptr::null_mut()
3671                         } }
3672                 }
3673         }
3674 }
3675 #[no_mangle]
3676 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
3677 /// but with all dynamically-allocated buffers duplicated in new buffers.
3678 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
3679 #[repr(C)]
3680 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3681 /// This corresponds to std::vector in C++
3682 pub struct CVec_PublicKeyZ {
3683         /// The elements in the array.
3684         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3685         pub data: *mut crate::c_types::PublicKey,
3686         /// The number of elements pointed to by `data`.
3687         pub datalen: usize
3688 }
3689 impl CVec_PublicKeyZ {
3690         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3691                 if self.datalen == 0 { return Vec::new(); }
3692                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3693                 self.data = core::ptr::null_mut();
3694                 self.datalen = 0;
3695                 ret
3696         }
3697         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3698                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3699         }
3700 }
3701 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3702         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3703                 let datalen = v.len();
3704                 let data = Box::into_raw(v.into_boxed_slice());
3705                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3706         }
3707 }
3708 #[no_mangle]
3709 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3710 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3711 impl Drop for CVec_PublicKeyZ {
3712         fn drop(&mut self) {
3713                 if self.datalen == 0 { return; }
3714                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3715         }
3716 }
3717 impl Clone for CVec_PublicKeyZ {
3718         fn clone(&self) -> Self {
3719                 let mut res = Vec::new();
3720                 if self.datalen == 0 { return Self::from(res); }
3721                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3722                 Self::from(res)
3723         }
3724 }
3725 #[repr(C)]
3726 /// The contents of CResult_OnionMessagePathNoneZ
3727 pub union CResult_OnionMessagePathNoneZPtr {
3728         /// A pointer to the contents in the success state.
3729         /// Reading from this pointer when `result_ok` is not set is undefined.
3730         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
3731         /// Note that this value is always NULL, as there are no contents in the Err variant
3732         pub err: *mut core::ffi::c_void,
3733 }
3734 #[repr(C)]
3735 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
3736 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
3737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3738 pub struct CResult_OnionMessagePathNoneZ {
3739         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
3740         /// `err` or `result` depending on the state of `result_ok`.
3741         pub contents: CResult_OnionMessagePathNoneZPtr,
3742         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
3743         pub result_ok: bool,
3744 }
3745 #[no_mangle]
3746 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
3747 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
3748         CResult_OnionMessagePathNoneZ {
3749                 contents: CResult_OnionMessagePathNoneZPtr {
3750                         result: Box::into_raw(Box::new(o)),
3751                 },
3752                 result_ok: true,
3753         }
3754 }
3755 #[no_mangle]
3756 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
3757 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
3758         CResult_OnionMessagePathNoneZ {
3759                 contents: CResult_OnionMessagePathNoneZPtr {
3760                         err: core::ptr::null_mut(),
3761                 },
3762                 result_ok: false,
3763         }
3764 }
3765 /// Checks if the given object is currently in the success state
3766 #[no_mangle]
3767 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
3768         o.result_ok
3769 }
3770 #[no_mangle]
3771 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
3772 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
3773 impl Drop for CResult_OnionMessagePathNoneZ {
3774         fn drop(&mut self) {
3775                 if self.result_ok {
3776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3778                         }
3779                 } else {
3780                 }
3781         }
3782 }
3783 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
3784         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
3785                 let contents = if o.result_ok {
3786                         let result = unsafe { o.contents.result };
3787                         unsafe { o.contents.result = core::ptr::null_mut() };
3788                         CResult_OnionMessagePathNoneZPtr { result }
3789                 } else {
3790                         let _ = unsafe { Box::from_raw(o.contents.err) };
3791                         o.contents.err = core::ptr::null_mut();
3792                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
3793                 };
3794                 Self {
3795                         contents,
3796                         result_ok: o.result_ok,
3797                 }
3798         }
3799 }
3800 impl Clone for CResult_OnionMessagePathNoneZ {
3801         fn clone(&self) -> Self {
3802                 if self.result_ok {
3803                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
3804                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
3805                         } }
3806                 } else {
3807                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
3808                                 err: core::ptr::null_mut()
3809                         } }
3810                 }
3811         }
3812 }
3813 #[no_mangle]
3814 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
3815 /// but with all dynamically-allocated buffers duplicated in new buffers.
3816 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
3817 #[repr(C)]
3818 /// The contents of CResult_CVec_BlindedPathZNoneZ
3819 pub union CResult_CVec_BlindedPathZNoneZPtr {
3820         /// A pointer to the contents in the success state.
3821         /// Reading from this pointer when `result_ok` is not set is undefined.
3822         pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
3823         /// Note that this value is always NULL, as there are no contents in the Err variant
3824         pub err: *mut core::ffi::c_void,
3825 }
3826 #[repr(C)]
3827 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
3828 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
3829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3830 pub struct CResult_CVec_BlindedPathZNoneZ {
3831         /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
3832         /// `err` or `result` depending on the state of `result_ok`.
3833         pub contents: CResult_CVec_BlindedPathZNoneZPtr,
3834         /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
3835         pub result_ok: bool,
3836 }
3837 #[no_mangle]
3838 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
3839 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
3840         CResult_CVec_BlindedPathZNoneZ {
3841                 contents: CResult_CVec_BlindedPathZNoneZPtr {
3842                         result: Box::into_raw(Box::new(o)),
3843                 },
3844                 result_ok: true,
3845         }
3846 }
3847 #[no_mangle]
3848 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
3849 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
3850         CResult_CVec_BlindedPathZNoneZ {
3851                 contents: CResult_CVec_BlindedPathZNoneZPtr {
3852                         err: core::ptr::null_mut(),
3853                 },
3854                 result_ok: false,
3855         }
3856 }
3857 /// Checks if the given object is currently in the success state
3858 #[no_mangle]
3859 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
3860         o.result_ok
3861 }
3862 #[no_mangle]
3863 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
3864 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
3865 impl Drop for CResult_CVec_BlindedPathZNoneZ {
3866         fn drop(&mut self) {
3867                 if self.result_ok {
3868                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3869                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3870                         }
3871                 } else {
3872                 }
3873         }
3874 }
3875 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
3876         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
3877                 let contents = if o.result_ok {
3878                         let result = unsafe { o.contents.result };
3879                         unsafe { o.contents.result = core::ptr::null_mut() };
3880                         CResult_CVec_BlindedPathZNoneZPtr { result }
3881                 } else {
3882                         let _ = unsafe { Box::from_raw(o.contents.err) };
3883                         o.contents.err = core::ptr::null_mut();
3884                         CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
3885                 };
3886                 Self {
3887                         contents,
3888                         result_ok: o.result_ok,
3889                 }
3890         }
3891 }
3892 impl Clone for CResult_CVec_BlindedPathZNoneZ {
3893         fn clone(&self) -> Self {
3894                 if self.result_ok {
3895                         Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
3896                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
3897                         } }
3898                 } else {
3899                         Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
3900                                 err: core::ptr::null_mut()
3901                         } }
3902                 }
3903         }
3904 }
3905 #[no_mangle]
3906 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
3907 /// but with all dynamically-allocated buffers duplicated in new buffers.
3908 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
3909 #[repr(C)]
3910 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3911 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3912         /// A pointer to the contents in the success state.
3913         /// Reading from this pointer when `result_ok` is not set is undefined.
3914         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3915         /// A pointer to the contents in the error state.
3916         /// Reading from this pointer when `result_ok` is set is undefined.
3917         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3918 }
3919 #[repr(C)]
3920 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3921 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3923 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3924         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3925         /// `err` or `result` depending on the state of `result_ok`.
3926         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3927         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3928         pub result_ok: bool,
3929 }
3930 #[no_mangle]
3931 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3932 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3933         CResult_InFlightHtlcsDecodeErrorZ {
3934                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3935                         result: Box::into_raw(Box::new(o)),
3936                 },
3937                 result_ok: true,
3938         }
3939 }
3940 #[no_mangle]
3941 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3942 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3943         CResult_InFlightHtlcsDecodeErrorZ {
3944                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3945                         err: Box::into_raw(Box::new(e)),
3946                 },
3947                 result_ok: false,
3948         }
3949 }
3950 /// Checks if the given object is currently in the success state
3951 #[no_mangle]
3952 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3953         o.result_ok
3954 }
3955 #[no_mangle]
3956 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3957 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3958 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3959         fn drop(&mut self) {
3960                 if self.result_ok {
3961                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3962                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3963                         }
3964                 } else {
3965                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3966                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3967                         }
3968                 }
3969         }
3970 }
3971 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3972         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3973                 let contents = if o.result_ok {
3974                         let result = unsafe { o.contents.result };
3975                         unsafe { o.contents.result = core::ptr::null_mut() };
3976                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
3977                 } else {
3978                         let err = unsafe { o.contents.err };
3979                         unsafe { o.contents.err = core::ptr::null_mut(); }
3980                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
3981                 };
3982                 Self {
3983                         contents,
3984                         result_ok: o.result_ok,
3985                 }
3986         }
3987 }
3988 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3989         fn clone(&self) -> Self {
3990                 if self.result_ok {
3991                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3992                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3993                         } }
3994                 } else {
3995                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3996                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3997                         } }
3998                 }
3999         }
4000 }
4001 #[no_mangle]
4002 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4003 /// but with all dynamically-allocated buffers duplicated in new buffers.
4004 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4005 #[repr(C)]
4006 /// The contents of CResult_RouteHopDecodeErrorZ
4007 pub union CResult_RouteHopDecodeErrorZPtr {
4008         /// A pointer to the contents in the success state.
4009         /// Reading from this pointer when `result_ok` is not set is undefined.
4010         pub result: *mut crate::lightning::routing::router::RouteHop,
4011         /// A pointer to the contents in the error state.
4012         /// Reading from this pointer when `result_ok` is set is undefined.
4013         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4014 }
4015 #[repr(C)]
4016 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4017 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4018 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4019 pub struct CResult_RouteHopDecodeErrorZ {
4020         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4021         /// `err` or `result` depending on the state of `result_ok`.
4022         pub contents: CResult_RouteHopDecodeErrorZPtr,
4023         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4024         pub result_ok: bool,
4025 }
4026 #[no_mangle]
4027 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4028 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4029         CResult_RouteHopDecodeErrorZ {
4030                 contents: CResult_RouteHopDecodeErrorZPtr {
4031                         result: Box::into_raw(Box::new(o)),
4032                 },
4033                 result_ok: true,
4034         }
4035 }
4036 #[no_mangle]
4037 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4038 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4039         CResult_RouteHopDecodeErrorZ {
4040                 contents: CResult_RouteHopDecodeErrorZPtr {
4041                         err: Box::into_raw(Box::new(e)),
4042                 },
4043                 result_ok: false,
4044         }
4045 }
4046 /// Checks if the given object is currently in the success state
4047 #[no_mangle]
4048 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4049         o.result_ok
4050 }
4051 #[no_mangle]
4052 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4053 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4054 impl Drop for CResult_RouteHopDecodeErrorZ {
4055         fn drop(&mut self) {
4056                 if self.result_ok {
4057                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4058                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4059                         }
4060                 } else {
4061                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4062                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4063                         }
4064                 }
4065         }
4066 }
4067 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4068         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4069                 let contents = if o.result_ok {
4070                         let result = unsafe { o.contents.result };
4071                         unsafe { o.contents.result = core::ptr::null_mut() };
4072                         CResult_RouteHopDecodeErrorZPtr { result }
4073                 } else {
4074                         let err = unsafe { o.contents.err };
4075                         unsafe { o.contents.err = core::ptr::null_mut(); }
4076                         CResult_RouteHopDecodeErrorZPtr { err }
4077                 };
4078                 Self {
4079                         contents,
4080                         result_ok: o.result_ok,
4081                 }
4082         }
4083 }
4084 impl Clone for CResult_RouteHopDecodeErrorZ {
4085         fn clone(&self) -> Self {
4086                 if self.result_ok {
4087                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4088                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4089                         } }
4090                 } else {
4091                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4092                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4093                         } }
4094                 }
4095         }
4096 }
4097 #[no_mangle]
4098 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4099 /// but with all dynamically-allocated buffers duplicated in new buffers.
4100 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4101 #[repr(C)]
4102 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4103 /// This corresponds to std::vector in C++
4104 pub struct CVec_BlindedHopZ {
4105         /// The elements in the array.
4106         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4107         pub data: *mut crate::lightning::blinded_path::BlindedHop,
4108         /// The number of elements pointed to by `data`.
4109         pub datalen: usize
4110 }
4111 impl CVec_BlindedHopZ {
4112         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4113                 if self.datalen == 0 { return Vec::new(); }
4114                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4115                 self.data = core::ptr::null_mut();
4116                 self.datalen = 0;
4117                 ret
4118         }
4119         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4120                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4121         }
4122 }
4123 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4124         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4125                 let datalen = v.len();
4126                 let data = Box::into_raw(v.into_boxed_slice());
4127                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4128         }
4129 }
4130 #[no_mangle]
4131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4132 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4133 impl Drop for CVec_BlindedHopZ {
4134         fn drop(&mut self) {
4135                 if self.datalen == 0 { return; }
4136                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4137         }
4138 }
4139 impl Clone for CVec_BlindedHopZ {
4140         fn clone(&self) -> Self {
4141                 let mut res = Vec::new();
4142                 if self.datalen == 0 { return Self::from(res); }
4143                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4144                 Self::from(res)
4145         }
4146 }
4147 #[repr(C)]
4148 /// The contents of CResult_BlindedTailDecodeErrorZ
4149 pub union CResult_BlindedTailDecodeErrorZPtr {
4150         /// A pointer to the contents in the success state.
4151         /// Reading from this pointer when `result_ok` is not set is undefined.
4152         pub result: *mut crate::lightning::routing::router::BlindedTail,
4153         /// A pointer to the contents in the error state.
4154         /// Reading from this pointer when `result_ok` is set is undefined.
4155         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4156 }
4157 #[repr(C)]
4158 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4159 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4161 pub struct CResult_BlindedTailDecodeErrorZ {
4162         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4163         /// `err` or `result` depending on the state of `result_ok`.
4164         pub contents: CResult_BlindedTailDecodeErrorZPtr,
4165         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4166         pub result_ok: bool,
4167 }
4168 #[no_mangle]
4169 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4170 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4171         CResult_BlindedTailDecodeErrorZ {
4172                 contents: CResult_BlindedTailDecodeErrorZPtr {
4173                         result: Box::into_raw(Box::new(o)),
4174                 },
4175                 result_ok: true,
4176         }
4177 }
4178 #[no_mangle]
4179 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4180 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4181         CResult_BlindedTailDecodeErrorZ {
4182                 contents: CResult_BlindedTailDecodeErrorZPtr {
4183                         err: Box::into_raw(Box::new(e)),
4184                 },
4185                 result_ok: false,
4186         }
4187 }
4188 /// Checks if the given object is currently in the success state
4189 #[no_mangle]
4190 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4191         o.result_ok
4192 }
4193 #[no_mangle]
4194 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4195 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4196 impl Drop for CResult_BlindedTailDecodeErrorZ {
4197         fn drop(&mut self) {
4198                 if self.result_ok {
4199                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4200                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4201                         }
4202                 } else {
4203                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4204                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4205                         }
4206                 }
4207         }
4208 }
4209 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4210         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4211                 let contents = if o.result_ok {
4212                         let result = unsafe { o.contents.result };
4213                         unsafe { o.contents.result = core::ptr::null_mut() };
4214                         CResult_BlindedTailDecodeErrorZPtr { result }
4215                 } else {
4216                         let err = unsafe { o.contents.err };
4217                         unsafe { o.contents.err = core::ptr::null_mut(); }
4218                         CResult_BlindedTailDecodeErrorZPtr { err }
4219                 };
4220                 Self {
4221                         contents,
4222                         result_ok: o.result_ok,
4223                 }
4224         }
4225 }
4226 impl Clone for CResult_BlindedTailDecodeErrorZ {
4227         fn clone(&self) -> Self {
4228                 if self.result_ok {
4229                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4230                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4231                         } }
4232                 } else {
4233                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4234                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4235                         } }
4236                 }
4237         }
4238 }
4239 #[no_mangle]
4240 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4241 /// but with all dynamically-allocated buffers duplicated in new buffers.
4242 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4243 #[repr(C)]
4244 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4245 /// This corresponds to std::vector in C++
4246 pub struct CVec_RouteHopZ {
4247         /// The elements in the array.
4248         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4249         pub data: *mut crate::lightning::routing::router::RouteHop,
4250         /// The number of elements pointed to by `data`.
4251         pub datalen: usize
4252 }
4253 impl CVec_RouteHopZ {
4254         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4255                 if self.datalen == 0 { return Vec::new(); }
4256                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4257                 self.data = core::ptr::null_mut();
4258                 self.datalen = 0;
4259                 ret
4260         }
4261         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4262                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4263         }
4264 }
4265 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4266         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4267                 let datalen = v.len();
4268                 let data = Box::into_raw(v.into_boxed_slice());
4269                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4270         }
4271 }
4272 #[no_mangle]
4273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4274 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4275 impl Drop for CVec_RouteHopZ {
4276         fn drop(&mut self) {
4277                 if self.datalen == 0 { return; }
4278                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4279         }
4280 }
4281 impl Clone for CVec_RouteHopZ {
4282         fn clone(&self) -> Self {
4283                 let mut res = Vec::new();
4284                 if self.datalen == 0 { return Self::from(res); }
4285                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4286                 Self::from(res)
4287         }
4288 }
4289 #[repr(C)]
4290 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4291 /// This corresponds to std::vector in C++
4292 pub struct CVec_PathZ {
4293         /// The elements in the array.
4294         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4295         pub data: *mut crate::lightning::routing::router::Path,
4296         /// The number of elements pointed to by `data`.
4297         pub datalen: usize
4298 }
4299 impl CVec_PathZ {
4300         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4301                 if self.datalen == 0 { return Vec::new(); }
4302                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4303                 self.data = core::ptr::null_mut();
4304                 self.datalen = 0;
4305                 ret
4306         }
4307         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4308                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4309         }
4310 }
4311 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4312         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4313                 let datalen = v.len();
4314                 let data = Box::into_raw(v.into_boxed_slice());
4315                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4316         }
4317 }
4318 #[no_mangle]
4319 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4320 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4321 impl Drop for CVec_PathZ {
4322         fn drop(&mut self) {
4323                 if self.datalen == 0 { return; }
4324                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4325         }
4326 }
4327 impl Clone for CVec_PathZ {
4328         fn clone(&self) -> Self {
4329                 let mut res = Vec::new();
4330                 if self.datalen == 0 { return Self::from(res); }
4331                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4332                 Self::from(res)
4333         }
4334 }
4335 #[repr(C)]
4336 /// The contents of CResult_RouteDecodeErrorZ
4337 pub union CResult_RouteDecodeErrorZPtr {
4338         /// A pointer to the contents in the success state.
4339         /// Reading from this pointer when `result_ok` is not set is undefined.
4340         pub result: *mut crate::lightning::routing::router::Route,
4341         /// A pointer to the contents in the error state.
4342         /// Reading from this pointer when `result_ok` is set is undefined.
4343         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4344 }
4345 #[repr(C)]
4346 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4347 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4349 pub struct CResult_RouteDecodeErrorZ {
4350         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4351         /// `err` or `result` depending on the state of `result_ok`.
4352         pub contents: CResult_RouteDecodeErrorZPtr,
4353         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4354         pub result_ok: bool,
4355 }
4356 #[no_mangle]
4357 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4358 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4359         CResult_RouteDecodeErrorZ {
4360                 contents: CResult_RouteDecodeErrorZPtr {
4361                         result: Box::into_raw(Box::new(o)),
4362                 },
4363                 result_ok: true,
4364         }
4365 }
4366 #[no_mangle]
4367 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4368 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4369         CResult_RouteDecodeErrorZ {
4370                 contents: CResult_RouteDecodeErrorZPtr {
4371                         err: Box::into_raw(Box::new(e)),
4372                 },
4373                 result_ok: false,
4374         }
4375 }
4376 /// Checks if the given object is currently in the success state
4377 #[no_mangle]
4378 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4379         o.result_ok
4380 }
4381 #[no_mangle]
4382 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4383 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4384 impl Drop for CResult_RouteDecodeErrorZ {
4385         fn drop(&mut self) {
4386                 if self.result_ok {
4387                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4388                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4389                         }
4390                 } else {
4391                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4392                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4393                         }
4394                 }
4395         }
4396 }
4397 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4398         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4399                 let contents = if o.result_ok {
4400                         let result = unsafe { o.contents.result };
4401                         unsafe { o.contents.result = core::ptr::null_mut() };
4402                         CResult_RouteDecodeErrorZPtr { result }
4403                 } else {
4404                         let err = unsafe { o.contents.err };
4405                         unsafe { o.contents.err = core::ptr::null_mut(); }
4406                         CResult_RouteDecodeErrorZPtr { err }
4407                 };
4408                 Self {
4409                         contents,
4410                         result_ok: o.result_ok,
4411                 }
4412         }
4413 }
4414 impl Clone for CResult_RouteDecodeErrorZ {
4415         fn clone(&self) -> Self {
4416                 if self.result_ok {
4417                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4418                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4419                         } }
4420                 } else {
4421                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4422                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4423                         } }
4424                 }
4425         }
4426 }
4427 #[no_mangle]
4428 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4429 /// but with all dynamically-allocated buffers duplicated in new buffers.
4430 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4431 #[repr(C)]
4432 /// The contents of CResult_RouteParametersDecodeErrorZ
4433 pub union CResult_RouteParametersDecodeErrorZPtr {
4434         /// A pointer to the contents in the success state.
4435         /// Reading from this pointer when `result_ok` is not set is undefined.
4436         pub result: *mut crate::lightning::routing::router::RouteParameters,
4437         /// A pointer to the contents in the error state.
4438         /// Reading from this pointer when `result_ok` is set is undefined.
4439         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4440 }
4441 #[repr(C)]
4442 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4443 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4445 pub struct CResult_RouteParametersDecodeErrorZ {
4446         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4447         /// `err` or `result` depending on the state of `result_ok`.
4448         pub contents: CResult_RouteParametersDecodeErrorZPtr,
4449         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4450         pub result_ok: bool,
4451 }
4452 #[no_mangle]
4453 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4454 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4455         CResult_RouteParametersDecodeErrorZ {
4456                 contents: CResult_RouteParametersDecodeErrorZPtr {
4457                         result: Box::into_raw(Box::new(o)),
4458                 },
4459                 result_ok: true,
4460         }
4461 }
4462 #[no_mangle]
4463 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4464 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4465         CResult_RouteParametersDecodeErrorZ {
4466                 contents: CResult_RouteParametersDecodeErrorZPtr {
4467                         err: Box::into_raw(Box::new(e)),
4468                 },
4469                 result_ok: false,
4470         }
4471 }
4472 /// Checks if the given object is currently in the success state
4473 #[no_mangle]
4474 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4475         o.result_ok
4476 }
4477 #[no_mangle]
4478 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4479 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4480 impl Drop for CResult_RouteParametersDecodeErrorZ {
4481         fn drop(&mut self) {
4482                 if self.result_ok {
4483                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4484                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4485                         }
4486                 } else {
4487                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4488                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4489                         }
4490                 }
4491         }
4492 }
4493 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4494         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4495                 let contents = if o.result_ok {
4496                         let result = unsafe { o.contents.result };
4497                         unsafe { o.contents.result = core::ptr::null_mut() };
4498                         CResult_RouteParametersDecodeErrorZPtr { result }
4499                 } else {
4500                         let err = unsafe { o.contents.err };
4501                         unsafe { o.contents.err = core::ptr::null_mut(); }
4502                         CResult_RouteParametersDecodeErrorZPtr { err }
4503                 };
4504                 Self {
4505                         contents,
4506                         result_ok: o.result_ok,
4507                 }
4508         }
4509 }
4510 impl Clone for CResult_RouteParametersDecodeErrorZ {
4511         fn clone(&self) -> Self {
4512                 if self.result_ok {
4513                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4514                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4515                         } }
4516                 } else {
4517                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4518                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4519                         } }
4520                 }
4521         }
4522 }
4523 #[no_mangle]
4524 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4525 /// but with all dynamically-allocated buffers duplicated in new buffers.
4526 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4527 #[repr(C)]
4528 /// A dynamically-allocated array of u64s of arbitrary size.
4529 /// This corresponds to std::vector in C++
4530 pub struct CVec_u64Z {
4531         /// The elements in the array.
4532         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4533         pub data: *mut u64,
4534         /// The number of elements pointed to by `data`.
4535         pub datalen: usize
4536 }
4537 impl CVec_u64Z {
4538         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4539                 if self.datalen == 0 { return Vec::new(); }
4540                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4541                 self.data = core::ptr::null_mut();
4542                 self.datalen = 0;
4543                 ret
4544         }
4545         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4546                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4547         }
4548 }
4549 impl From<Vec<u64>> for CVec_u64Z {
4550         fn from(v: Vec<u64>) -> Self {
4551                 let datalen = v.len();
4552                 let data = Box::into_raw(v.into_boxed_slice());
4553                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4554         }
4555 }
4556 #[no_mangle]
4557 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4558 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4559 impl Drop for CVec_u64Z {
4560         fn drop(&mut self) {
4561                 if self.datalen == 0 { return; }
4562                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4563         }
4564 }
4565 impl Clone for CVec_u64Z {
4566         fn clone(&self) -> Self {
4567                 let mut res = Vec::new();
4568                 if self.datalen == 0 { return Self::from(res); }
4569                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4570                 Self::from(res)
4571         }
4572 }
4573 #[repr(C)]
4574 /// The contents of CResult_PaymentParametersDecodeErrorZ
4575 pub union CResult_PaymentParametersDecodeErrorZPtr {
4576         /// A pointer to the contents in the success state.
4577         /// Reading from this pointer when `result_ok` is not set is undefined.
4578         pub result: *mut crate::lightning::routing::router::PaymentParameters,
4579         /// A pointer to the contents in the error state.
4580         /// Reading from this pointer when `result_ok` is set is undefined.
4581         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4582 }
4583 #[repr(C)]
4584 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4585 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4587 pub struct CResult_PaymentParametersDecodeErrorZ {
4588         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4589         /// `err` or `result` depending on the state of `result_ok`.
4590         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4591         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4592         pub result_ok: bool,
4593 }
4594 #[no_mangle]
4595 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4596 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4597         CResult_PaymentParametersDecodeErrorZ {
4598                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4599                         result: Box::into_raw(Box::new(o)),
4600                 },
4601                 result_ok: true,
4602         }
4603 }
4604 #[no_mangle]
4605 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4606 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4607         CResult_PaymentParametersDecodeErrorZ {
4608                 contents: CResult_PaymentParametersDecodeErrorZPtr {
4609                         err: Box::into_raw(Box::new(e)),
4610                 },
4611                 result_ok: false,
4612         }
4613 }
4614 /// Checks if the given object is currently in the success state
4615 #[no_mangle]
4616 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4617         o.result_ok
4618 }
4619 #[no_mangle]
4620 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4621 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4622 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4623         fn drop(&mut self) {
4624                 if self.result_ok {
4625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4627                         }
4628                 } else {
4629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4631                         }
4632                 }
4633         }
4634 }
4635 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4637                 let contents = if o.result_ok {
4638                         let result = unsafe { o.contents.result };
4639                         unsafe { o.contents.result = core::ptr::null_mut() };
4640                         CResult_PaymentParametersDecodeErrorZPtr { result }
4641                 } else {
4642                         let err = unsafe { o.contents.err };
4643                         unsafe { o.contents.err = core::ptr::null_mut(); }
4644                         CResult_PaymentParametersDecodeErrorZPtr { err }
4645                 };
4646                 Self {
4647                         contents,
4648                         result_ok: o.result_ok,
4649                 }
4650         }
4651 }
4652 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4653         fn clone(&self) -> Self {
4654                 if self.result_ok {
4655                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4656                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4657                         } }
4658                 } else {
4659                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4661                         } }
4662                 }
4663         }
4664 }
4665 #[no_mangle]
4666 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4667 /// but with all dynamically-allocated buffers duplicated in new buffers.
4668 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4669 #[repr(C)]
4670 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4671 /// This corresponds to std::vector in C++
4672 pub struct CVec_RouteHintZ {
4673         /// The elements in the array.
4674         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4675         pub data: *mut crate::lightning::routing::router::RouteHint,
4676         /// The number of elements pointed to by `data`.
4677         pub datalen: usize
4678 }
4679 impl CVec_RouteHintZ {
4680         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4681                 if self.datalen == 0 { return Vec::new(); }
4682                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4683                 self.data = core::ptr::null_mut();
4684                 self.datalen = 0;
4685                 ret
4686         }
4687         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4688                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4689         }
4690 }
4691 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4692         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4693                 let datalen = v.len();
4694                 let data = Box::into_raw(v.into_boxed_slice());
4695                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4696         }
4697 }
4698 #[no_mangle]
4699 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4700 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4701 impl Drop for CVec_RouteHintZ {
4702         fn drop(&mut self) {
4703                 if self.datalen == 0 { return; }
4704                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4705         }
4706 }
4707 impl Clone for CVec_RouteHintZ {
4708         fn clone(&self) -> Self {
4709                 let mut res = Vec::new();
4710                 if self.datalen == 0 { return Self::from(res); }
4711                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4712                 Self::from(res)
4713         }
4714 }
4715 #[repr(C)]
4716 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4717 /// This corresponds to std::vector in C++
4718 pub struct CVec_RouteHintHopZ {
4719         /// The elements in the array.
4720         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4721         pub data: *mut crate::lightning::routing::router::RouteHintHop,
4722         /// The number of elements pointed to by `data`.
4723         pub datalen: usize
4724 }
4725 impl CVec_RouteHintHopZ {
4726         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4727                 if self.datalen == 0 { return Vec::new(); }
4728                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4729                 self.data = core::ptr::null_mut();
4730                 self.datalen = 0;
4731                 ret
4732         }
4733         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4734                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4735         }
4736 }
4737 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4738         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4739                 let datalen = v.len();
4740                 let data = Box::into_raw(v.into_boxed_slice());
4741                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4742         }
4743 }
4744 #[no_mangle]
4745 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4746 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4747 impl Drop for CVec_RouteHintHopZ {
4748         fn drop(&mut self) {
4749                 if self.datalen == 0 { return; }
4750                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4751         }
4752 }
4753 impl Clone for CVec_RouteHintHopZ {
4754         fn clone(&self) -> Self {
4755                 let mut res = Vec::new();
4756                 if self.datalen == 0 { return Self::from(res); }
4757                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4758                 Self::from(res)
4759         }
4760 }
4761 #[repr(C)]
4762 /// The contents of CResult_RouteHintDecodeErrorZ
4763 pub union CResult_RouteHintDecodeErrorZPtr {
4764         /// A pointer to the contents in the success state.
4765         /// Reading from this pointer when `result_ok` is not set is undefined.
4766         pub result: *mut crate::lightning::routing::router::RouteHint,
4767         /// A pointer to the contents in the error state.
4768         /// Reading from this pointer when `result_ok` is set is undefined.
4769         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4770 }
4771 #[repr(C)]
4772 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4773 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4775 pub struct CResult_RouteHintDecodeErrorZ {
4776         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4777         /// `err` or `result` depending on the state of `result_ok`.
4778         pub contents: CResult_RouteHintDecodeErrorZPtr,
4779         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4780         pub result_ok: bool,
4781 }
4782 #[no_mangle]
4783 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4784 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4785         CResult_RouteHintDecodeErrorZ {
4786                 contents: CResult_RouteHintDecodeErrorZPtr {
4787                         result: Box::into_raw(Box::new(o)),
4788                 },
4789                 result_ok: true,
4790         }
4791 }
4792 #[no_mangle]
4793 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4794 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4795         CResult_RouteHintDecodeErrorZ {
4796                 contents: CResult_RouteHintDecodeErrorZPtr {
4797                         err: Box::into_raw(Box::new(e)),
4798                 },
4799                 result_ok: false,
4800         }
4801 }
4802 /// Checks if the given object is currently in the success state
4803 #[no_mangle]
4804 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4805         o.result_ok
4806 }
4807 #[no_mangle]
4808 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4809 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4810 impl Drop for CResult_RouteHintDecodeErrorZ {
4811         fn drop(&mut self) {
4812                 if self.result_ok {
4813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4815                         }
4816                 } else {
4817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4819                         }
4820                 }
4821         }
4822 }
4823 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4824         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4825                 let contents = if o.result_ok {
4826                         let result = unsafe { o.contents.result };
4827                         unsafe { o.contents.result = core::ptr::null_mut() };
4828                         CResult_RouteHintDecodeErrorZPtr { result }
4829                 } else {
4830                         let err = unsafe { o.contents.err };
4831                         unsafe { o.contents.err = core::ptr::null_mut(); }
4832                         CResult_RouteHintDecodeErrorZPtr { err }
4833                 };
4834                 Self {
4835                         contents,
4836                         result_ok: o.result_ok,
4837                 }
4838         }
4839 }
4840 impl Clone for CResult_RouteHintDecodeErrorZ {
4841         fn clone(&self) -> Self {
4842                 if self.result_ok {
4843                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4844                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4845                         } }
4846                 } else {
4847                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4848                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4849                         } }
4850                 }
4851         }
4852 }
4853 #[no_mangle]
4854 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4855 /// but with all dynamically-allocated buffers duplicated in new buffers.
4856 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4857 #[repr(C)]
4858 /// The contents of CResult_RouteHintHopDecodeErrorZ
4859 pub union CResult_RouteHintHopDecodeErrorZPtr {
4860         /// A pointer to the contents in the success state.
4861         /// Reading from this pointer when `result_ok` is not set is undefined.
4862         pub result: *mut crate::lightning::routing::router::RouteHintHop,
4863         /// A pointer to the contents in the error state.
4864         /// Reading from this pointer when `result_ok` is set is undefined.
4865         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4866 }
4867 #[repr(C)]
4868 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4869 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4871 pub struct CResult_RouteHintHopDecodeErrorZ {
4872         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4873         /// `err` or `result` depending on the state of `result_ok`.
4874         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4875         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4876         pub result_ok: bool,
4877 }
4878 #[no_mangle]
4879 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4880 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4881         CResult_RouteHintHopDecodeErrorZ {
4882                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4883                         result: Box::into_raw(Box::new(o)),
4884                 },
4885                 result_ok: true,
4886         }
4887 }
4888 #[no_mangle]
4889 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4890 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4891         CResult_RouteHintHopDecodeErrorZ {
4892                 contents: CResult_RouteHintHopDecodeErrorZPtr {
4893                         err: Box::into_raw(Box::new(e)),
4894                 },
4895                 result_ok: false,
4896         }
4897 }
4898 /// Checks if the given object is currently in the success state
4899 #[no_mangle]
4900 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4901         o.result_ok
4902 }
4903 #[no_mangle]
4904 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4905 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4906 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4907         fn drop(&mut self) {
4908                 if self.result_ok {
4909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4911                         }
4912                 } else {
4913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4915                         }
4916                 }
4917         }
4918 }
4919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4921                 let contents = if o.result_ok {
4922                         let result = unsafe { o.contents.result };
4923                         unsafe { o.contents.result = core::ptr::null_mut() };
4924                         CResult_RouteHintHopDecodeErrorZPtr { result }
4925                 } else {
4926                         let err = unsafe { o.contents.err };
4927                         unsafe { o.contents.err = core::ptr::null_mut(); }
4928                         CResult_RouteHintHopDecodeErrorZPtr { err }
4929                 };
4930                 Self {
4931                         contents,
4932                         result_ok: o.result_ok,
4933                 }
4934         }
4935 }
4936 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4937         fn clone(&self) -> Self {
4938                 if self.result_ok {
4939                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4940                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4941                         } }
4942                 } else {
4943                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4944                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4945                         } }
4946                 }
4947         }
4948 }
4949 #[no_mangle]
4950 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4951 /// but with all dynamically-allocated buffers duplicated in new buffers.
4952 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4953 #[repr(C)]
4954 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4955 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4956         /// A pointer to the contents in the success state.
4957         /// Reading from this pointer when `result_ok` is not set is undefined.
4958         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4959         /// A pointer to the contents in the error state.
4960         /// Reading from this pointer when `result_ok` is set is undefined.
4961         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4962 }
4963 #[repr(C)]
4964 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4965 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4968         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4969         /// `err` or `result` depending on the state of `result_ok`.
4970         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4971         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4972         pub result_ok: bool,
4973 }
4974 #[no_mangle]
4975 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4976 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4977         CResult_FixedPenaltyScorerDecodeErrorZ {
4978                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4979                         result: Box::into_raw(Box::new(o)),
4980                 },
4981                 result_ok: true,
4982         }
4983 }
4984 #[no_mangle]
4985 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4986 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4987         CResult_FixedPenaltyScorerDecodeErrorZ {
4988                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4989                         err: Box::into_raw(Box::new(e)),
4990                 },
4991                 result_ok: false,
4992         }
4993 }
4994 /// Checks if the given object is currently in the success state
4995 #[no_mangle]
4996 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4997         o.result_ok
4998 }
4999 #[no_mangle]
5000 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5001 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5002 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5003         fn drop(&mut self) {
5004                 if self.result_ok {
5005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5007                         }
5008                 } else {
5009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5011                         }
5012                 }
5013         }
5014 }
5015 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5016         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5017                 let contents = if o.result_ok {
5018                         let result = unsafe { o.contents.result };
5019                         unsafe { o.contents.result = core::ptr::null_mut() };
5020                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5021                 } else {
5022                         let err = unsafe { o.contents.err };
5023                         unsafe { o.contents.err = core::ptr::null_mut(); }
5024                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5025                 };
5026                 Self {
5027                         contents,
5028                         result_ok: o.result_ok,
5029                 }
5030         }
5031 }
5032 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5033         fn clone(&self) -> Self {
5034                 if self.result_ok {
5035                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5036                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5037                         } }
5038                 } else {
5039                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5040                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5041                         } }
5042                 }
5043         }
5044 }
5045 #[no_mangle]
5046 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5047 /// but with all dynamically-allocated buffers duplicated in new buffers.
5048 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5049 #[repr(C)]
5050 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_NodeIdZ {
5053         /// The elements in the array.
5054         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055         pub data: *mut crate::lightning::routing::gossip::NodeId,
5056         /// The number of elements pointed to by `data`.
5057         pub datalen: usize
5058 }
5059 impl CVec_NodeIdZ {
5060         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5061                 if self.datalen == 0 { return Vec::new(); }
5062                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063                 self.data = core::ptr::null_mut();
5064                 self.datalen = 0;
5065                 ret
5066         }
5067         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5068                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5069         }
5070 }
5071 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5072         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5073                 let datalen = v.len();
5074                 let data = Box::into_raw(v.into_boxed_slice());
5075                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5076         }
5077 }
5078 #[no_mangle]
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5081 impl Drop for CVec_NodeIdZ {
5082         fn drop(&mut self) {
5083                 if self.datalen == 0 { return; }
5084                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5085         }
5086 }
5087 impl Clone for CVec_NodeIdZ {
5088         fn clone(&self) -> Self {
5089                 let mut res = Vec::new();
5090                 if self.datalen == 0 { return Self::from(res); }
5091                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5092                 Self::from(res)
5093         }
5094 }
5095 #[repr(C)]
5096 /// A tuple of 2 elements. See the individual fields for the types contained.
5097 pub struct C2Tuple_u64u64Z {
5098         /// The element at position 0
5099         pub a: u64,
5100         /// The element at position 1
5101         pub b: u64,
5102 }
5103 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5104         fn from (tup: (u64, u64)) -> Self {
5105                 Self {
5106                         a: tup.0,
5107                         b: tup.1,
5108                 }
5109         }
5110 }
5111 impl C2Tuple_u64u64Z {
5112         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5113                 (self.a, self.b)
5114         }
5115 }
5116 impl Clone for C2Tuple_u64u64Z {
5117         fn clone(&self) -> Self {
5118                 Self {
5119                         a: Clone::clone(&self.a),
5120                         b: Clone::clone(&self.b),
5121                 }
5122         }
5123 }
5124 #[no_mangle]
5125 /// Creates a new tuple which has the same data as `orig`
5126 /// but with all dynamically-allocated buffers duplicated in new buffers.
5127 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5128 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5129 #[no_mangle]
5130 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5131         C2Tuple_u64u64Z { a, b, }
5132 }
5133
5134 #[no_mangle]
5135 /// Frees any resources used by the C2Tuple_u64u64Z.
5136 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5137 #[repr(C)]
5138 #[derive(Clone)]
5139 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5140 pub enum COption_C2Tuple_u64u64ZZ {
5141         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5142         Some(crate::c_types::derived::C2Tuple_u64u64Z),
5143         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5144         None
5145 }
5146 impl COption_C2Tuple_u64u64ZZ {
5147         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5148                 if let Self::None = self { false } else { true }
5149         }
5150         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5151                 !self.is_some()
5152         }
5153         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5154                 if let Self::Some(v) = self { v } else { unreachable!() }
5155         }
5156 }
5157 #[no_mangle]
5158 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5159 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5160         COption_C2Tuple_u64u64ZZ::Some(o)
5161 }
5162 #[no_mangle]
5163 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5164 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5165         COption_C2Tuple_u64u64ZZ::None
5166 }
5167 #[no_mangle]
5168 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5169 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5170 #[no_mangle]
5171 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5172 /// but with all dynamically-allocated buffers duplicated in new buffers.
5173 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5174 #[repr(C)]
5175 /// A tuple of 2 elements. See the individual fields for the types contained.
5176 pub struct C2Tuple_Z {
5177         /// The element at position 0
5178         pub a: crate::c_types::ThirtyTwoU16s,
5179         /// The element at position 1
5180         pub b: crate::c_types::ThirtyTwoU16s,
5181 }
5182 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5183         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5184                 Self {
5185                         a: tup.0,
5186                         b: tup.1,
5187                 }
5188         }
5189 }
5190 impl C2Tuple_Z {
5191         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5192                 (self.a, self.b)
5193         }
5194 }
5195 /// Creates a new C2Tuple_Z from the contained elements.
5196 #[no_mangle]
5197 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5198         C2Tuple_Z { a, b, }
5199 }
5200
5201 #[no_mangle]
5202 /// Frees any resources used by the C2Tuple_Z.
5203 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5204 #[repr(C)]
5205 /// A tuple of 2 elements. See the individual fields for the types contained.
5206 pub struct C2Tuple__u1632_u1632Z {
5207         /// The element at position 0
5208         pub a: crate::c_types::ThirtyTwoU16s,
5209         /// The element at position 1
5210         pub b: crate::c_types::ThirtyTwoU16s,
5211 }
5212 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5213         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5214                 Self {
5215                         a: tup.0,
5216                         b: tup.1,
5217                 }
5218         }
5219 }
5220 impl C2Tuple__u1632_u1632Z {
5221         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5222                 (self.a, self.b)
5223         }
5224 }
5225 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5226 #[no_mangle]
5227 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5228         C2Tuple__u1632_u1632Z { a, b, }
5229 }
5230
5231 #[no_mangle]
5232 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5233 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5234 #[repr(C)]
5235 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5236 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5237         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5238         Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5239         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5240         None
5241 }
5242 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5243         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5244                 if let Self::None = self { false } else { true }
5245         }
5246         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5247                 !self.is_some()
5248         }
5249         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5250                 if let Self::Some(v) = self { v } else { unreachable!() }
5251         }
5252 }
5253 #[no_mangle]
5254 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5255 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5256         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5257 }
5258 #[no_mangle]
5259 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5260 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5261         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5262 }
5263 #[no_mangle]
5264 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5265 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5266 #[repr(C)]
5267 #[derive(Clone)]
5268 /// An enum which can either contain a f64 or not
5269 pub enum COption_f64Z {
5270         /// When we're in this state, this COption_f64Z contains a f64
5271         Some(f64),
5272         /// When we're in this state, this COption_f64Z contains nothing
5273         None
5274 }
5275 impl COption_f64Z {
5276         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5277                 if let Self::None = self { false } else { true }
5278         }
5279         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5280                 !self.is_some()
5281         }
5282         #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5283                 if let Self::Some(v) = self { v } else { unreachable!() }
5284         }
5285 }
5286 #[no_mangle]
5287 /// Constructs a new COption_f64Z containing a f64
5288 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5289         COption_f64Z::Some(o)
5290 }
5291 #[no_mangle]
5292 /// Constructs a new COption_f64Z containing nothing
5293 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5294         COption_f64Z::None
5295 }
5296 #[no_mangle]
5297 /// Frees any resources associated with the f64, if we are in the Some state
5298 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5299 #[no_mangle]
5300 /// Creates a new COption_f64Z which has the same data as `orig`
5301 /// but with all dynamically-allocated buffers duplicated in new buffers.
5302 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5303 #[repr(C)]
5304 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5305 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5306         /// A pointer to the contents in the success state.
5307         /// Reading from this pointer when `result_ok` is not set is undefined.
5308         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5309         /// A pointer to the contents in the error state.
5310         /// Reading from this pointer when `result_ok` is set is undefined.
5311         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5312 }
5313 #[repr(C)]
5314 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5315 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5316 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5317 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5318         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5319         /// `err` or `result` depending on the state of `result_ok`.
5320         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5321         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5322         pub result_ok: bool,
5323 }
5324 #[no_mangle]
5325 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5326 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5327         CResult_ProbabilisticScorerDecodeErrorZ {
5328                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5329                         result: Box::into_raw(Box::new(o)),
5330                 },
5331                 result_ok: true,
5332         }
5333 }
5334 #[no_mangle]
5335 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5336 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5337         CResult_ProbabilisticScorerDecodeErrorZ {
5338                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5339                         err: Box::into_raw(Box::new(e)),
5340                 },
5341                 result_ok: false,
5342         }
5343 }
5344 /// Checks if the given object is currently in the success state
5345 #[no_mangle]
5346 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5347         o.result_ok
5348 }
5349 #[no_mangle]
5350 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5351 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5352 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5353         fn drop(&mut self) {
5354                 if self.result_ok {
5355                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5356                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5357                         }
5358                 } else {
5359                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5360                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5361                         }
5362                 }
5363         }
5364 }
5365 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5366         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5367                 let contents = if o.result_ok {
5368                         let result = unsafe { o.contents.result };
5369                         unsafe { o.contents.result = core::ptr::null_mut() };
5370                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5371                 } else {
5372                         let err = unsafe { o.contents.err };
5373                         unsafe { o.contents.err = core::ptr::null_mut(); }
5374                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5375                 };
5376                 Self {
5377                         contents,
5378                         result_ok: o.result_ok,
5379                 }
5380         }
5381 }
5382 #[repr(C)]
5383 /// A tuple of 2 elements. See the individual fields for the types contained.
5384 pub struct C2Tuple_usizeTransactionZ {
5385         /// The element at position 0
5386         pub a: usize,
5387         /// The element at position 1
5388         pub b: crate::c_types::Transaction,
5389 }
5390 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5391         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5392                 Self {
5393                         a: tup.0,
5394                         b: tup.1,
5395                 }
5396         }
5397 }
5398 impl C2Tuple_usizeTransactionZ {
5399         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5400                 (self.a, self.b)
5401         }
5402 }
5403 impl Clone for C2Tuple_usizeTransactionZ {
5404         fn clone(&self) -> Self {
5405                 Self {
5406                         a: Clone::clone(&self.a),
5407                         b: Clone::clone(&self.b),
5408                 }
5409         }
5410 }
5411 #[no_mangle]
5412 /// Creates a new tuple which has the same data as `orig`
5413 /// but with all dynamically-allocated buffers duplicated in new buffers.
5414 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5415 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5416 #[no_mangle]
5417 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5418         C2Tuple_usizeTransactionZ { a, b, }
5419 }
5420
5421 #[no_mangle]
5422 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5423 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5424 #[repr(C)]
5425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5426 /// This corresponds to std::vector in C++
5427 pub struct CVec_C2Tuple_usizeTransactionZZ {
5428         /// The elements in the array.
5429         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5430         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5431         /// The number of elements pointed to by `data`.
5432         pub datalen: usize
5433 }
5434 impl CVec_C2Tuple_usizeTransactionZZ {
5435         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5436                 if self.datalen == 0 { return Vec::new(); }
5437                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5438                 self.data = core::ptr::null_mut();
5439                 self.datalen = 0;
5440                 ret
5441         }
5442         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5443                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5444         }
5445 }
5446 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5447         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5448                 let datalen = v.len();
5449                 let data = Box::into_raw(v.into_boxed_slice());
5450                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5451         }
5452 }
5453 #[no_mangle]
5454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5455 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5456 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5457         fn drop(&mut self) {
5458                 if self.datalen == 0 { return; }
5459                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5460         }
5461 }
5462 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5463         fn clone(&self) -> Self {
5464                 let mut res = Vec::new();
5465                 if self.datalen == 0 { return Self::from(res); }
5466                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5467                 Self::from(res)
5468         }
5469 }
5470 #[repr(C)]
5471 /// A tuple of 3 elements. See the individual fields for the types contained.
5472 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5473         /// The element at position 0
5474         pub a: crate::c_types::ThirtyTwoBytes,
5475         /// The element at position 1
5476         pub b: u32,
5477         /// The element at position 2
5478         pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5479 }
5480 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5481         fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5482                 Self {
5483                         a: tup.0,
5484                         b: tup.1,
5485                         c: tup.2,
5486                 }
5487         }
5488 }
5489 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5490         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5491                 (self.a, self.b, self.c)
5492         }
5493 }
5494 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5495         fn clone(&self) -> Self {
5496                 Self {
5497                         a: Clone::clone(&self.a),
5498                         b: Clone::clone(&self.b),
5499                         c: Clone::clone(&self.c),
5500                 }
5501         }
5502 }
5503 #[no_mangle]
5504 /// Creates a new tuple which has the same data as `orig`
5505 /// but with all dynamically-allocated buffers duplicated in new buffers.
5506 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5507 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
5508 #[no_mangle]
5509 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5510         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
5511 }
5512
5513 #[no_mangle]
5514 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
5515 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
5516 #[repr(C)]
5517 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
5518 /// This corresponds to std::vector in C++
5519 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5520         /// The elements in the array.
5521         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5522         pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
5523         /// The number of elements pointed to by `data`.
5524         pub datalen: usize
5525 }
5526 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5527         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
5528                 if self.datalen == 0 { return Vec::new(); }
5529                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5530                 self.data = core::ptr::null_mut();
5531                 self.datalen = 0;
5532                 ret
5533         }
5534         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
5535                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5536         }
5537 }
5538 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5539         fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
5540                 let datalen = v.len();
5541                 let data = Box::into_raw(v.into_boxed_slice());
5542                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5543         }
5544 }
5545 #[no_mangle]
5546 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5547 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
5548 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5549         fn drop(&mut self) {
5550                 if self.datalen == 0 { return; }
5551                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5552         }
5553 }
5554 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5555         fn clone(&self) -> Self {
5556                 let mut res = Vec::new();
5557                 if self.datalen == 0 { return Self::from(res); }
5558                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5559                 Self::from(res)
5560         }
5561 }
5562 #[repr(C)]
5563 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5564 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5565         /// A pointer to the contents in the success state.
5566         /// Reading from this pointer when `result_ok` is not set is undefined.
5567         pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5568         /// Note that this value is always NULL, as there are no contents in the Err variant
5569         pub err: *mut core::ffi::c_void,
5570 }
5571 #[repr(C)]
5572 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5573 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5575 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5576         /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5577         /// `err` or `result` depending on the state of `result_ok`.
5578         pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5579         /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5580         pub result_ok: bool,
5581 }
5582 #[no_mangle]
5583 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5584 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5585         CResult_ChannelMonitorUpdateStatusNoneZ {
5586                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5587                         result: Box::into_raw(Box::new(o)),
5588                 },
5589                 result_ok: true,
5590         }
5591 }
5592 #[no_mangle]
5593 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5594 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5595         CResult_ChannelMonitorUpdateStatusNoneZ {
5596                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5597                         err: core::ptr::null_mut(),
5598                 },
5599                 result_ok: false,
5600         }
5601 }
5602 /// Checks if the given object is currently in the success state
5603 #[no_mangle]
5604 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5605         o.result_ok
5606 }
5607 #[no_mangle]
5608 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5609 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5610 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5611         fn drop(&mut self) {
5612                 if self.result_ok {
5613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5615                         }
5616                 } else {
5617                 }
5618         }
5619 }
5620 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> 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_ChannelMonitorUpdateStatusNoneZPtr { result }
5626                 } else {
5627                         let _ = unsafe { Box::from_raw(o.contents.err) };
5628                         o.contents.err = core::ptr::null_mut();
5629                         CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5630                 };
5631                 Self {
5632                         contents,
5633                         result_ok: o.result_ok,
5634                 }
5635         }
5636 }
5637 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5638         fn clone(&self) -> Self {
5639                 if self.result_ok {
5640                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5641                                 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5642                         } }
5643                 } else {
5644                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5645                                 err: core::ptr::null_mut()
5646                         } }
5647                 }
5648         }
5649 }
5650 #[no_mangle]
5651 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5654 #[repr(C)]
5655 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5656 /// This corresponds to std::vector in C++
5657 pub struct CVec_MonitorEventZ {
5658         /// The elements in the array.
5659         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5660         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5661         /// The number of elements pointed to by `data`.
5662         pub datalen: usize
5663 }
5664 impl CVec_MonitorEventZ {
5665         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5666                 if self.datalen == 0 { return Vec::new(); }
5667                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5668                 self.data = core::ptr::null_mut();
5669                 self.datalen = 0;
5670                 ret
5671         }
5672         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5673                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5674         }
5675 }
5676 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5677         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5678                 let datalen = v.len();
5679                 let data = Box::into_raw(v.into_boxed_slice());
5680                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5681         }
5682 }
5683 #[no_mangle]
5684 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5685 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5686 impl Drop for CVec_MonitorEventZ {
5687         fn drop(&mut self) {
5688                 if self.datalen == 0 { return; }
5689                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5690         }
5691 }
5692 impl Clone for CVec_MonitorEventZ {
5693         fn clone(&self) -> Self {
5694                 let mut res = Vec::new();
5695                 if self.datalen == 0 { return Self::from(res); }
5696                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5697                 Self::from(res)
5698         }
5699 }
5700 #[repr(C)]
5701 /// A tuple of 3 elements. See the individual fields for the types contained.
5702 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5703         /// The element at position 0
5704         pub a: crate::lightning::chain::transaction::OutPoint,
5705         /// The element at position 1
5706         pub b: crate::c_types::derived::CVec_MonitorEventZ,
5707         /// The element at position 2
5708         pub c: crate::c_types::PublicKey,
5709 }
5710 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5711         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5712                 Self {
5713                         a: tup.0,
5714                         b: tup.1,
5715                         c: tup.2,
5716                 }
5717         }
5718 }
5719 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5720         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5721                 (self.a, self.b, self.c)
5722         }
5723 }
5724 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5725         fn clone(&self) -> Self {
5726                 Self {
5727                         a: Clone::clone(&self.a),
5728                         b: Clone::clone(&self.b),
5729                         c: Clone::clone(&self.c),
5730                 }
5731         }
5732 }
5733 #[no_mangle]
5734 /// Creates a new tuple which has the same data as `orig`
5735 /// but with all dynamically-allocated buffers duplicated in new buffers.
5736 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5737 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5738 #[no_mangle]
5739 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 {
5740         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5741 }
5742
5743 #[no_mangle]
5744 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5745 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5746 #[repr(C)]
5747 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5748 /// This corresponds to std::vector in C++
5749 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5750         /// The elements in the array.
5751         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5752         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5753         /// The number of elements pointed to by `data`.
5754         pub datalen: usize
5755 }
5756 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5757         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5758                 if self.datalen == 0 { return Vec::new(); }
5759                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5760                 self.data = core::ptr::null_mut();
5761                 self.datalen = 0;
5762                 ret
5763         }
5764         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5765                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5766         }
5767 }
5768 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5769         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5770                 let datalen = v.len();
5771                 let data = Box::into_raw(v.into_boxed_slice());
5772                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5773         }
5774 }
5775 #[no_mangle]
5776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5777 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5778 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5779         fn drop(&mut self) {
5780                 if self.datalen == 0 { return; }
5781                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5782         }
5783 }
5784 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5785         fn clone(&self) -> Self {
5786                 let mut res = Vec::new();
5787                 if self.datalen == 0 { return Self::from(res); }
5788                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5789                 Self::from(res)
5790         }
5791 }
5792 #[repr(C)]
5793 /// The contents of CResult_InitFeaturesDecodeErrorZ
5794 pub union CResult_InitFeaturesDecodeErrorZPtr {
5795         /// A pointer to the contents in the success state.
5796         /// Reading from this pointer when `result_ok` is not set is undefined.
5797         pub result: *mut crate::lightning::ln::features::InitFeatures,
5798         /// A pointer to the contents in the error state.
5799         /// Reading from this pointer when `result_ok` is set is undefined.
5800         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5801 }
5802 #[repr(C)]
5803 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5804 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5806 pub struct CResult_InitFeaturesDecodeErrorZ {
5807         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5808         /// `err` or `result` depending on the state of `result_ok`.
5809         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5810         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5811         pub result_ok: bool,
5812 }
5813 #[no_mangle]
5814 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5815 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5816         CResult_InitFeaturesDecodeErrorZ {
5817                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5818                         result: Box::into_raw(Box::new(o)),
5819                 },
5820                 result_ok: true,
5821         }
5822 }
5823 #[no_mangle]
5824 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5825 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5826         CResult_InitFeaturesDecodeErrorZ {
5827                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5828                         err: Box::into_raw(Box::new(e)),
5829                 },
5830                 result_ok: false,
5831         }
5832 }
5833 /// Checks if the given object is currently in the success state
5834 #[no_mangle]
5835 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5836         o.result_ok
5837 }
5838 #[no_mangle]
5839 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5840 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5841 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5842         fn drop(&mut self) {
5843                 if self.result_ok {
5844                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5845                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5846                         }
5847                 } else {
5848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5850                         }
5851                 }
5852         }
5853 }
5854 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5855         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5856                 let contents = if o.result_ok {
5857                         let result = unsafe { o.contents.result };
5858                         unsafe { o.contents.result = core::ptr::null_mut() };
5859                         CResult_InitFeaturesDecodeErrorZPtr { result }
5860                 } else {
5861                         let err = unsafe { o.contents.err };
5862                         unsafe { o.contents.err = core::ptr::null_mut(); }
5863                         CResult_InitFeaturesDecodeErrorZPtr { err }
5864                 };
5865                 Self {
5866                         contents,
5867                         result_ok: o.result_ok,
5868                 }
5869         }
5870 }
5871 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5872         fn clone(&self) -> Self {
5873                 if self.result_ok {
5874                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5875                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5876                         } }
5877                 } else {
5878                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5879                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5880                         } }
5881                 }
5882         }
5883 }
5884 #[no_mangle]
5885 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5886 /// but with all dynamically-allocated buffers duplicated in new buffers.
5887 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5888 #[repr(C)]
5889 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5890 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5891         /// A pointer to the contents in the success state.
5892         /// Reading from this pointer when `result_ok` is not set is undefined.
5893         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5894         /// A pointer to the contents in the error state.
5895         /// Reading from this pointer when `result_ok` is set is undefined.
5896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5897 }
5898 #[repr(C)]
5899 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5900 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5902 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5903         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5904         /// `err` or `result` depending on the state of `result_ok`.
5905         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5906         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5907         pub result_ok: bool,
5908 }
5909 #[no_mangle]
5910 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5911 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5912         CResult_ChannelFeaturesDecodeErrorZ {
5913                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5914                         result: Box::into_raw(Box::new(o)),
5915                 },
5916                 result_ok: true,
5917         }
5918 }
5919 #[no_mangle]
5920 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5921 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5922         CResult_ChannelFeaturesDecodeErrorZ {
5923                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5924                         err: Box::into_raw(Box::new(e)),
5925                 },
5926                 result_ok: false,
5927         }
5928 }
5929 /// Checks if the given object is currently in the success state
5930 #[no_mangle]
5931 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5932         o.result_ok
5933 }
5934 #[no_mangle]
5935 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5936 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5937 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5938         fn drop(&mut self) {
5939                 if self.result_ok {
5940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5942                         }
5943                 } else {
5944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5946                         }
5947                 }
5948         }
5949 }
5950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5952                 let contents = if o.result_ok {
5953                         let result = unsafe { o.contents.result };
5954                         unsafe { o.contents.result = core::ptr::null_mut() };
5955                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5956                 } else {
5957                         let err = unsafe { o.contents.err };
5958                         unsafe { o.contents.err = core::ptr::null_mut(); }
5959                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5960                 };
5961                 Self {
5962                         contents,
5963                         result_ok: o.result_ok,
5964                 }
5965         }
5966 }
5967 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5968         fn clone(&self) -> Self {
5969                 if self.result_ok {
5970                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5971                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5972                         } }
5973                 } else {
5974                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5976                         } }
5977                 }
5978         }
5979 }
5980 #[no_mangle]
5981 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5982 /// but with all dynamically-allocated buffers duplicated in new buffers.
5983 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5984 #[repr(C)]
5985 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5986 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5987         /// A pointer to the contents in the success state.
5988         /// Reading from this pointer when `result_ok` is not set is undefined.
5989         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5990         /// A pointer to the contents in the error state.
5991         /// Reading from this pointer when `result_ok` is set is undefined.
5992         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5993 }
5994 #[repr(C)]
5995 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5996 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5998 pub struct CResult_NodeFeaturesDecodeErrorZ {
5999         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6000         /// `err` or `result` depending on the state of `result_ok`.
6001         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6002         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6003         pub result_ok: bool,
6004 }
6005 #[no_mangle]
6006 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6007 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6008         CResult_NodeFeaturesDecodeErrorZ {
6009                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6010                         result: Box::into_raw(Box::new(o)),
6011                 },
6012                 result_ok: true,
6013         }
6014 }
6015 #[no_mangle]
6016 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6017 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6018         CResult_NodeFeaturesDecodeErrorZ {
6019                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6020                         err: Box::into_raw(Box::new(e)),
6021                 },
6022                 result_ok: false,
6023         }
6024 }
6025 /// Checks if the given object is currently in the success state
6026 #[no_mangle]
6027 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6028         o.result_ok
6029 }
6030 #[no_mangle]
6031 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6032 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6033 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6034         fn drop(&mut self) {
6035                 if self.result_ok {
6036                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6037                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6038                         }
6039                 } else {
6040                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6041                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6042                         }
6043                 }
6044         }
6045 }
6046 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6047         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6048                 let contents = if o.result_ok {
6049                         let result = unsafe { o.contents.result };
6050                         unsafe { o.contents.result = core::ptr::null_mut() };
6051                         CResult_NodeFeaturesDecodeErrorZPtr { result }
6052                 } else {
6053                         let err = unsafe { o.contents.err };
6054                         unsafe { o.contents.err = core::ptr::null_mut(); }
6055                         CResult_NodeFeaturesDecodeErrorZPtr { err }
6056                 };
6057                 Self {
6058                         contents,
6059                         result_ok: o.result_ok,
6060                 }
6061         }
6062 }
6063 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6064         fn clone(&self) -> Self {
6065                 if self.result_ok {
6066                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6067                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6068                         } }
6069                 } else {
6070                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6071                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6072                         } }
6073                 }
6074         }
6075 }
6076 #[no_mangle]
6077 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6078 /// but with all dynamically-allocated buffers duplicated in new buffers.
6079 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6080 #[repr(C)]
6081 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6082 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6083         /// A pointer to the contents in the success state.
6084         /// Reading from this pointer when `result_ok` is not set is undefined.
6085         pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6086         /// A pointer to the contents in the error state.
6087         /// Reading from this pointer when `result_ok` is set is undefined.
6088         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6089 }
6090 #[repr(C)]
6091 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6092 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6094 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6095         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6096         /// `err` or `result` depending on the state of `result_ok`.
6097         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6098         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6099         pub result_ok: bool,
6100 }
6101 #[no_mangle]
6102 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6103 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6104         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6105                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6106                         result: Box::into_raw(Box::new(o)),
6107                 },
6108                 result_ok: true,
6109         }
6110 }
6111 #[no_mangle]
6112 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6113 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6114         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6115                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6116                         err: Box::into_raw(Box::new(e)),
6117                 },
6118                 result_ok: false,
6119         }
6120 }
6121 /// Checks if the given object is currently in the success state
6122 #[no_mangle]
6123 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6124         o.result_ok
6125 }
6126 #[no_mangle]
6127 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6128 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6129 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6130         fn drop(&mut self) {
6131                 if self.result_ok {
6132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6134                         }
6135                 } else {
6136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6138                         }
6139                 }
6140         }
6141 }
6142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6143         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6144                 let contents = if o.result_ok {
6145                         let result = unsafe { o.contents.result };
6146                         unsafe { o.contents.result = core::ptr::null_mut() };
6147                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6148                 } else {
6149                         let err = unsafe { o.contents.err };
6150                         unsafe { o.contents.err = core::ptr::null_mut(); }
6151                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6152                 };
6153                 Self {
6154                         contents,
6155                         result_ok: o.result_ok,
6156                 }
6157         }
6158 }
6159 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6160         fn clone(&self) -> Self {
6161                 if self.result_ok {
6162                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6163                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6164                         } }
6165                 } else {
6166                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6167                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6168                         } }
6169                 }
6170         }
6171 }
6172 #[no_mangle]
6173 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6174 /// but with all dynamically-allocated buffers duplicated in new buffers.
6175 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6176 #[repr(C)]
6177 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6178 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6179         /// A pointer to the contents in the success state.
6180         /// Reading from this pointer when `result_ok` is not set is undefined.
6181         pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6182         /// A pointer to the contents in the error state.
6183         /// Reading from this pointer when `result_ok` is set is undefined.
6184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6185 }
6186 #[repr(C)]
6187 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6188 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6190 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6191         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6192         /// `err` or `result` depending on the state of `result_ok`.
6193         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6194         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6195         pub result_ok: bool,
6196 }
6197 #[no_mangle]
6198 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6199 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6200         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6201                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6202                         result: Box::into_raw(Box::new(o)),
6203                 },
6204                 result_ok: true,
6205         }
6206 }
6207 #[no_mangle]
6208 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6209 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6210         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6211                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6212                         err: Box::into_raw(Box::new(e)),
6213                 },
6214                 result_ok: false,
6215         }
6216 }
6217 /// Checks if the given object is currently in the success state
6218 #[no_mangle]
6219 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6220         o.result_ok
6221 }
6222 #[no_mangle]
6223 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6224 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6225 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6226         fn drop(&mut self) {
6227                 if self.result_ok {
6228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6230                         }
6231                 } else {
6232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6234                         }
6235                 }
6236         }
6237 }
6238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6240                 let contents = if o.result_ok {
6241                         let result = unsafe { o.contents.result };
6242                         unsafe { o.contents.result = core::ptr::null_mut() };
6243                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6244                 } else {
6245                         let err = unsafe { o.contents.err };
6246                         unsafe { o.contents.err = core::ptr::null_mut(); }
6247                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6248                 };
6249                 Self {
6250                         contents,
6251                         result_ok: o.result_ok,
6252                 }
6253         }
6254 }
6255 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6256         fn clone(&self) -> Self {
6257                 if self.result_ok {
6258                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6259                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6260                         } }
6261                 } else {
6262                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6264                         } }
6265                 }
6266         }
6267 }
6268 #[no_mangle]
6269 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6270 /// but with all dynamically-allocated buffers duplicated in new buffers.
6271 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6272 #[repr(C)]
6273 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6274 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6275         /// A pointer to the contents in the success state.
6276         /// Reading from this pointer when `result_ok` is not set is undefined.
6277         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6278         /// A pointer to the contents in the error state.
6279         /// Reading from this pointer when `result_ok` is set is undefined.
6280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6281 }
6282 #[repr(C)]
6283 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6284 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6286 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6287         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6288         /// `err` or `result` depending on the state of `result_ok`.
6289         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6290         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6291         pub result_ok: bool,
6292 }
6293 #[no_mangle]
6294 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6295 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6296         CResult_BlindedHopFeaturesDecodeErrorZ {
6297                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6298                         result: Box::into_raw(Box::new(o)),
6299                 },
6300                 result_ok: true,
6301         }
6302 }
6303 #[no_mangle]
6304 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6305 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6306         CResult_BlindedHopFeaturesDecodeErrorZ {
6307                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6308                         err: Box::into_raw(Box::new(e)),
6309                 },
6310                 result_ok: false,
6311         }
6312 }
6313 /// Checks if the given object is currently in the success state
6314 #[no_mangle]
6315 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6316         o.result_ok
6317 }
6318 #[no_mangle]
6319 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6320 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6321 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6322         fn drop(&mut self) {
6323                 if self.result_ok {
6324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6326                         }
6327                 } else {
6328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6330                         }
6331                 }
6332         }
6333 }
6334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6336                 let contents = if o.result_ok {
6337                         let result = unsafe { o.contents.result };
6338                         unsafe { o.contents.result = core::ptr::null_mut() };
6339                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6340                 } else {
6341                         let err = unsafe { o.contents.err };
6342                         unsafe { o.contents.err = core::ptr::null_mut(); }
6343                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6344                 };
6345                 Self {
6346                         contents,
6347                         result_ok: o.result_ok,
6348                 }
6349         }
6350 }
6351 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6352         fn clone(&self) -> Self {
6353                 if self.result_ok {
6354                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6355                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6356                         } }
6357                 } else {
6358                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6360                         } }
6361                 }
6362         }
6363 }
6364 #[no_mangle]
6365 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6366 /// but with all dynamically-allocated buffers duplicated in new buffers.
6367 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6368 #[repr(C)]
6369 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6370 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6371         /// A pointer to the contents in the success state.
6372         /// Reading from this pointer when `result_ok` is not set is undefined.
6373         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6374         /// A pointer to the contents in the error state.
6375         /// Reading from this pointer when `result_ok` is set is undefined.
6376         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6377 }
6378 #[repr(C)]
6379 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6380 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6382 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6383         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6384         /// `err` or `result` depending on the state of `result_ok`.
6385         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6386         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6387         pub result_ok: bool,
6388 }
6389 #[no_mangle]
6390 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6391 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6392         CResult_ChannelTypeFeaturesDecodeErrorZ {
6393                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6394                         result: Box::into_raw(Box::new(o)),
6395                 },
6396                 result_ok: true,
6397         }
6398 }
6399 #[no_mangle]
6400 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6401 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6402         CResult_ChannelTypeFeaturesDecodeErrorZ {
6403                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6404                         err: Box::into_raw(Box::new(e)),
6405                 },
6406                 result_ok: false,
6407         }
6408 }
6409 /// Checks if the given object is currently in the success state
6410 #[no_mangle]
6411 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6412         o.result_ok
6413 }
6414 #[no_mangle]
6415 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6416 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6417 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6418         fn drop(&mut self) {
6419                 if self.result_ok {
6420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6422                         }
6423                 } else {
6424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6426                         }
6427                 }
6428         }
6429 }
6430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6432                 let contents = if o.result_ok {
6433                         let result = unsafe { o.contents.result };
6434                         unsafe { o.contents.result = core::ptr::null_mut() };
6435                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6436                 } else {
6437                         let err = unsafe { o.contents.err };
6438                         unsafe { o.contents.err = core::ptr::null_mut(); }
6439                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6440                 };
6441                 Self {
6442                         contents,
6443                         result_ok: o.result_ok,
6444                 }
6445         }
6446 }
6447 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6448         fn clone(&self) -> Self {
6449                 if self.result_ok {
6450                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6451                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6452                         } }
6453                 } else {
6454                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6455                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6456                         } }
6457                 }
6458         }
6459 }
6460 #[no_mangle]
6461 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6462 /// but with all dynamically-allocated buffers duplicated in new buffers.
6463 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6464 #[repr(C)]
6465 /// The contents of CResult_OfferBolt12ParseErrorZ
6466 pub union CResult_OfferBolt12ParseErrorZPtr {
6467         /// A pointer to the contents in the success state.
6468         /// Reading from this pointer when `result_ok` is not set is undefined.
6469         pub result: *mut crate::lightning::offers::offer::Offer,
6470         /// A pointer to the contents in the error state.
6471         /// Reading from this pointer when `result_ok` is set is undefined.
6472         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
6473 }
6474 #[repr(C)]
6475 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6476 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6478 pub struct CResult_OfferBolt12ParseErrorZ {
6479         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6480         /// `err` or `result` depending on the state of `result_ok`.
6481         pub contents: CResult_OfferBolt12ParseErrorZPtr,
6482         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6483         pub result_ok: bool,
6484 }
6485 #[no_mangle]
6486 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6487 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6488         CResult_OfferBolt12ParseErrorZ {
6489                 contents: CResult_OfferBolt12ParseErrorZPtr {
6490                         result: Box::into_raw(Box::new(o)),
6491                 },
6492                 result_ok: true,
6493         }
6494 }
6495 #[no_mangle]
6496 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6497 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6498         CResult_OfferBolt12ParseErrorZ {
6499                 contents: CResult_OfferBolt12ParseErrorZPtr {
6500                         err: Box::into_raw(Box::new(e)),
6501                 },
6502                 result_ok: false,
6503         }
6504 }
6505 /// Checks if the given object is currently in the success state
6506 #[no_mangle]
6507 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6508         o.result_ok
6509 }
6510 #[no_mangle]
6511 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6512 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6513 impl Drop for CResult_OfferBolt12ParseErrorZ {
6514         fn drop(&mut self) {
6515                 if self.result_ok {
6516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6518                         }
6519                 } else {
6520                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6521                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6522                         }
6523                 }
6524         }
6525 }
6526 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6527         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
6528                 let contents = if o.result_ok {
6529                         let result = unsafe { o.contents.result };
6530                         unsafe { o.contents.result = core::ptr::null_mut() };
6531                         CResult_OfferBolt12ParseErrorZPtr { result }
6532                 } else {
6533                         let err = unsafe { o.contents.err };
6534                         unsafe { o.contents.err = core::ptr::null_mut(); }
6535                         CResult_OfferBolt12ParseErrorZPtr { err }
6536                 };
6537                 Self {
6538                         contents,
6539                         result_ok: o.result_ok,
6540                 }
6541         }
6542 }
6543 impl Clone for CResult_OfferBolt12ParseErrorZ {
6544         fn clone(&self) -> Self {
6545                 if self.result_ok {
6546                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6547                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6548                         } }
6549                 } else {
6550                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6551                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6552                         } }
6553                 }
6554         }
6555 }
6556 #[no_mangle]
6557 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6558 /// but with all dynamically-allocated buffers duplicated in new buffers.
6559 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6560 #[repr(C)]
6561 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6562 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6563         /// A pointer to the contents in the success state.
6564         /// Reading from this pointer when `result_ok` is not set is undefined.
6565         pub result: *mut crate::c_types::PublicKey,
6566         /// A pointer to the contents in the error state.
6567         /// Reading from this pointer when `result_ok` is set is undefined.
6568         pub err: *mut crate::c_types::Secp256k1Error,
6569 }
6570 #[repr(C)]
6571 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6572 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6574 pub struct CResult_PublicKeySecp256k1ErrorZ {
6575         /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6576         /// `err` or `result` depending on the state of `result_ok`.
6577         pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6578         /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6579         pub result_ok: bool,
6580 }
6581 #[no_mangle]
6582 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6583 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6584         CResult_PublicKeySecp256k1ErrorZ {
6585                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6586                         result: Box::into_raw(Box::new(o)),
6587                 },
6588                 result_ok: true,
6589         }
6590 }
6591 #[no_mangle]
6592 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6593 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6594         CResult_PublicKeySecp256k1ErrorZ {
6595                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6596                         err: Box::into_raw(Box::new(e)),
6597                 },
6598                 result_ok: false,
6599         }
6600 }
6601 /// Checks if the given object is currently in the success state
6602 #[no_mangle]
6603 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6604         o.result_ok
6605 }
6606 #[no_mangle]
6607 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6608 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6609 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6610         fn drop(&mut self) {
6611                 if self.result_ok {
6612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6614                         }
6615                 } else {
6616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6618                         }
6619                 }
6620         }
6621 }
6622 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6623         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6624                 let contents = if o.result_ok {
6625                         let result = unsafe { o.contents.result };
6626                         unsafe { o.contents.result = core::ptr::null_mut() };
6627                         CResult_PublicKeySecp256k1ErrorZPtr { result }
6628                 } else {
6629                         let err = unsafe { o.contents.err };
6630                         unsafe { o.contents.err = core::ptr::null_mut(); }
6631                         CResult_PublicKeySecp256k1ErrorZPtr { err }
6632                 };
6633                 Self {
6634                         contents,
6635                         result_ok: o.result_ok,
6636                 }
6637         }
6638 }
6639 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6640         fn clone(&self) -> Self {
6641                 if self.result_ok {
6642                         Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6643                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6644                         } }
6645                 } else {
6646                         Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6647                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6648                         } }
6649                 }
6650         }
6651 }
6652 #[no_mangle]
6653 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6654 /// but with all dynamically-allocated buffers duplicated in new buffers.
6655 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6656 #[repr(C)]
6657 /// The contents of CResult_NodeIdDecodeErrorZ
6658 pub union CResult_NodeIdDecodeErrorZPtr {
6659         /// A pointer to the contents in the success state.
6660         /// Reading from this pointer when `result_ok` is not set is undefined.
6661         pub result: *mut crate::lightning::routing::gossip::NodeId,
6662         /// A pointer to the contents in the error state.
6663         /// Reading from this pointer when `result_ok` is set is undefined.
6664         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6665 }
6666 #[repr(C)]
6667 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6668 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_NodeIdDecodeErrorZ {
6671         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6672         /// `err` or `result` depending on the state of `result_ok`.
6673         pub contents: CResult_NodeIdDecodeErrorZPtr,
6674         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6675         pub result_ok: bool,
6676 }
6677 #[no_mangle]
6678 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6679 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6680         CResult_NodeIdDecodeErrorZ {
6681                 contents: CResult_NodeIdDecodeErrorZPtr {
6682                         result: Box::into_raw(Box::new(o)),
6683                 },
6684                 result_ok: true,
6685         }
6686 }
6687 #[no_mangle]
6688 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6689 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6690         CResult_NodeIdDecodeErrorZ {
6691                 contents: CResult_NodeIdDecodeErrorZPtr {
6692                         err: Box::into_raw(Box::new(e)),
6693                 },
6694                 result_ok: false,
6695         }
6696 }
6697 /// Checks if the given object is currently in the success state
6698 #[no_mangle]
6699 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6700         o.result_ok
6701 }
6702 #[no_mangle]
6703 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6704 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6705 impl Drop for CResult_NodeIdDecodeErrorZ {
6706         fn drop(&mut self) {
6707                 if self.result_ok {
6708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6710                         }
6711                 } else {
6712                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6713                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6714                         }
6715                 }
6716         }
6717 }
6718 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6719         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6720                 let contents = if o.result_ok {
6721                         let result = unsafe { o.contents.result };
6722                         unsafe { o.contents.result = core::ptr::null_mut() };
6723                         CResult_NodeIdDecodeErrorZPtr { result }
6724                 } else {
6725                         let err = unsafe { o.contents.err };
6726                         unsafe { o.contents.err = core::ptr::null_mut(); }
6727                         CResult_NodeIdDecodeErrorZPtr { err }
6728                 };
6729                 Self {
6730                         contents,
6731                         result_ok: o.result_ok,
6732                 }
6733         }
6734 }
6735 impl Clone for CResult_NodeIdDecodeErrorZ {
6736         fn clone(&self) -> Self {
6737                 if self.result_ok {
6738                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6739                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6740                         } }
6741                 } else {
6742                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6743                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6744                         } }
6745                 }
6746         }
6747 }
6748 #[no_mangle]
6749 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6750 /// but with all dynamically-allocated buffers duplicated in new buffers.
6751 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6752 #[repr(C)]
6753 #[derive(Clone)]
6754 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6755 pub enum COption_NetworkUpdateZ {
6756         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6757         Some(crate::lightning::routing::gossip::NetworkUpdate),
6758         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6759         None
6760 }
6761 impl COption_NetworkUpdateZ {
6762         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6763                 if let Self::None = self { false } else { true }
6764         }
6765         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6766                 !self.is_some()
6767         }
6768         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6769                 if let Self::Some(v) = self { v } else { unreachable!() }
6770         }
6771 }
6772 #[no_mangle]
6773 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6774 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6775         COption_NetworkUpdateZ::Some(o)
6776 }
6777 #[no_mangle]
6778 /// Constructs a new COption_NetworkUpdateZ containing nothing
6779 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6780         COption_NetworkUpdateZ::None
6781 }
6782 #[no_mangle]
6783 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6784 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6785 #[no_mangle]
6786 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6787 /// but with all dynamically-allocated buffers duplicated in new buffers.
6788 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6789 #[repr(C)]
6790 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6791 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6792         /// A pointer to the contents in the success state.
6793         /// Reading from this pointer when `result_ok` is not set is undefined.
6794         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6795         /// A pointer to the contents in the error state.
6796         /// Reading from this pointer when `result_ok` is set is undefined.
6797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6798 }
6799 #[repr(C)]
6800 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6801 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6803 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6804         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6805         /// `err` or `result` depending on the state of `result_ok`.
6806         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6807         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6808         pub result_ok: bool,
6809 }
6810 #[no_mangle]
6811 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6812 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6813         CResult_COption_NetworkUpdateZDecodeErrorZ {
6814                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6815                         result: Box::into_raw(Box::new(o)),
6816                 },
6817                 result_ok: true,
6818         }
6819 }
6820 #[no_mangle]
6821 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6822 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6823         CResult_COption_NetworkUpdateZDecodeErrorZ {
6824                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6825                         err: Box::into_raw(Box::new(e)),
6826                 },
6827                 result_ok: false,
6828         }
6829 }
6830 /// Checks if the given object is currently in the success state
6831 #[no_mangle]
6832 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6833         o.result_ok
6834 }
6835 #[no_mangle]
6836 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6837 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6838 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6839         fn drop(&mut self) {
6840                 if self.result_ok {
6841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6843                         }
6844                 } else {
6845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6847                         }
6848                 }
6849         }
6850 }
6851 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6852         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6853                 let contents = if o.result_ok {
6854                         let result = unsafe { o.contents.result };
6855                         unsafe { o.contents.result = core::ptr::null_mut() };
6856                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6857                 } else {
6858                         let err = unsafe { o.contents.err };
6859                         unsafe { o.contents.err = core::ptr::null_mut(); }
6860                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6861                 };
6862                 Self {
6863                         contents,
6864                         result_ok: o.result_ok,
6865                 }
6866         }
6867 }
6868 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6869         fn clone(&self) -> Self {
6870                 if self.result_ok {
6871                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6872                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6873                         } }
6874                 } else {
6875                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6876                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6877                         } }
6878                 }
6879         }
6880 }
6881 #[no_mangle]
6882 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6883 /// but with all dynamically-allocated buffers duplicated in new buffers.
6884 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6885 #[repr(C)]
6886 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6887 pub enum COption_UtxoLookupZ {
6888         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6889         Some(crate::lightning::routing::utxo::UtxoLookup),
6890         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6891         None
6892 }
6893 impl COption_UtxoLookupZ {
6894         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6895                 if let Self::None = self { false } else { true }
6896         }
6897         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6898                 !self.is_some()
6899         }
6900         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6901                 if let Self::Some(v) = self { v } else { unreachable!() }
6902         }
6903 }
6904 #[no_mangle]
6905 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6906 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6907         COption_UtxoLookupZ::Some(o)
6908 }
6909 #[no_mangle]
6910 /// Constructs a new COption_UtxoLookupZ containing nothing
6911 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6912         COption_UtxoLookupZ::None
6913 }
6914 #[no_mangle]
6915 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6916 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6917 #[repr(C)]
6918 /// The contents of CResult_NoneLightningErrorZ
6919 pub union CResult_NoneLightningErrorZPtr {
6920         /// Note that this value is always NULL, as there are no contents in the OK variant
6921         pub result: *mut core::ffi::c_void,
6922         /// A pointer to the contents in the error state.
6923         /// Reading from this pointer when `result_ok` is set is undefined.
6924         pub err: *mut crate::lightning::ln::msgs::LightningError,
6925 }
6926 #[repr(C)]
6927 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6928 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6930 pub struct CResult_NoneLightningErrorZ {
6931         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6932         /// `err` or `result` depending on the state of `result_ok`.
6933         pub contents: CResult_NoneLightningErrorZPtr,
6934         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6935         pub result_ok: bool,
6936 }
6937 #[no_mangle]
6938 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6939 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6940         CResult_NoneLightningErrorZ {
6941                 contents: CResult_NoneLightningErrorZPtr {
6942                         result: core::ptr::null_mut(),
6943                 },
6944                 result_ok: true,
6945         }
6946 }
6947 #[no_mangle]
6948 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6949 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6950         CResult_NoneLightningErrorZ {
6951                 contents: CResult_NoneLightningErrorZPtr {
6952                         err: Box::into_raw(Box::new(e)),
6953                 },
6954                 result_ok: false,
6955         }
6956 }
6957 /// Checks if the given object is currently in the success state
6958 #[no_mangle]
6959 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6960         o.result_ok
6961 }
6962 #[no_mangle]
6963 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6964 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6965 impl Drop for CResult_NoneLightningErrorZ {
6966         fn drop(&mut self) {
6967                 if self.result_ok {
6968                 } else {
6969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6971                         }
6972                 }
6973         }
6974 }
6975 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6976         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6977                 let contents = if o.result_ok {
6978                         let _ = unsafe { Box::from_raw(o.contents.result) };
6979                         o.contents.result = core::ptr::null_mut();
6980                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6981                 } else {
6982                         let err = unsafe { o.contents.err };
6983                         unsafe { o.contents.err = core::ptr::null_mut(); }
6984                         CResult_NoneLightningErrorZPtr { err }
6985                 };
6986                 Self {
6987                         contents,
6988                         result_ok: o.result_ok,
6989                 }
6990         }
6991 }
6992 impl Clone for CResult_NoneLightningErrorZ {
6993         fn clone(&self) -> Self {
6994                 if self.result_ok {
6995                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6996                                 result: core::ptr::null_mut()
6997                         } }
6998                 } else {
6999                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7000                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7001                         } }
7002                 }
7003         }
7004 }
7005 #[no_mangle]
7006 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7007 /// but with all dynamically-allocated buffers duplicated in new buffers.
7008 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7009 #[repr(C)]
7010 /// The contents of CResult_boolLightningErrorZ
7011 pub union CResult_boolLightningErrorZPtr {
7012         /// A pointer to the contents in the success state.
7013         /// Reading from this pointer when `result_ok` is not set is undefined.
7014         pub result: *mut bool,
7015         /// A pointer to the contents in the error state.
7016         /// Reading from this pointer when `result_ok` is set is undefined.
7017         pub err: *mut crate::lightning::ln::msgs::LightningError,
7018 }
7019 #[repr(C)]
7020 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7021 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7023 pub struct CResult_boolLightningErrorZ {
7024         /// The contents of this CResult_boolLightningErrorZ, accessible via either
7025         /// `err` or `result` depending on the state of `result_ok`.
7026         pub contents: CResult_boolLightningErrorZPtr,
7027         /// Whether this CResult_boolLightningErrorZ represents a success state.
7028         pub result_ok: bool,
7029 }
7030 #[no_mangle]
7031 /// Creates a new CResult_boolLightningErrorZ in the success state.
7032 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7033         CResult_boolLightningErrorZ {
7034                 contents: CResult_boolLightningErrorZPtr {
7035                         result: Box::into_raw(Box::new(o)),
7036                 },
7037                 result_ok: true,
7038         }
7039 }
7040 #[no_mangle]
7041 /// Creates a new CResult_boolLightningErrorZ in the error state.
7042 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7043         CResult_boolLightningErrorZ {
7044                 contents: CResult_boolLightningErrorZPtr {
7045                         err: Box::into_raw(Box::new(e)),
7046                 },
7047                 result_ok: false,
7048         }
7049 }
7050 /// Checks if the given object is currently in the success state
7051 #[no_mangle]
7052 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
7053         o.result_ok
7054 }
7055 #[no_mangle]
7056 /// Frees any resources used by the CResult_boolLightningErrorZ.
7057 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7058 impl Drop for CResult_boolLightningErrorZ {
7059         fn drop(&mut self) {
7060                 if self.result_ok {
7061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7063                         }
7064                 } else {
7065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7067                         }
7068                 }
7069         }
7070 }
7071 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7072         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7073                 let contents = if o.result_ok {
7074                         let result = unsafe { o.contents.result };
7075                         unsafe { o.contents.result = core::ptr::null_mut() };
7076                         CResult_boolLightningErrorZPtr { result }
7077                 } else {
7078                         let err = unsafe { o.contents.err };
7079                         unsafe { o.contents.err = core::ptr::null_mut(); }
7080                         CResult_boolLightningErrorZPtr { err }
7081                 };
7082                 Self {
7083                         contents,
7084                         result_ok: o.result_ok,
7085                 }
7086         }
7087 }
7088 impl Clone for CResult_boolLightningErrorZ {
7089         fn clone(&self) -> Self {
7090                 if self.result_ok {
7091                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7092                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7093                         } }
7094                 } else {
7095                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7096                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7097                         } }
7098                 }
7099         }
7100 }
7101 #[no_mangle]
7102 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7103 /// but with all dynamically-allocated buffers duplicated in new buffers.
7104 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7105 #[repr(C)]
7106 /// A tuple of 3 elements. See the individual fields for the types contained.
7107 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7108         /// The element at position 0
7109         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7110         /// The element at position 1
7111         pub b: crate::lightning::ln::msgs::ChannelUpdate,
7112         /// The element at position 2
7113         pub c: crate::lightning::ln::msgs::ChannelUpdate,
7114 }
7115 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7116         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7117                 Self {
7118                         a: tup.0,
7119                         b: tup.1,
7120                         c: tup.2,
7121                 }
7122         }
7123 }
7124 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7125         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7126                 (self.a, self.b, self.c)
7127         }
7128 }
7129 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7130         fn clone(&self) -> Self {
7131                 Self {
7132                         a: Clone::clone(&self.a),
7133                         b: Clone::clone(&self.b),
7134                         c: Clone::clone(&self.c),
7135                 }
7136         }
7137 }
7138 #[no_mangle]
7139 /// Creates a new tuple which has the same data as `orig`
7140 /// but with all dynamically-allocated buffers duplicated in new buffers.
7141 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7142 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7143 #[no_mangle]
7144 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 {
7145         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7146 }
7147
7148 #[no_mangle]
7149 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7150 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7151 #[repr(C)]
7152 #[derive(Clone)]
7153 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
7154 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7155         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7156         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
7157         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
7158         None
7159 }
7160 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7161         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7162                 if let Self::None = self { false } else { true }
7163         }
7164         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7165                 !self.is_some()
7166         }
7167         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7168                 if let Self::Some(v) = self { v } else { unreachable!() }
7169         }
7170 }
7171 #[no_mangle]
7172 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7173 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7174         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
7175 }
7176 #[no_mangle]
7177 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
7178 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7179         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
7180 }
7181 #[no_mangle]
7182 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
7183 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7184 #[no_mangle]
7185 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
7186 /// but with all dynamically-allocated buffers duplicated in new buffers.
7187 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
7188 #[repr(C)]
7189 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
7190 /// This corresponds to std::vector in C++
7191 pub struct CVec_MessageSendEventZ {
7192         /// The elements in the array.
7193         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7194         pub data: *mut crate::lightning::events::MessageSendEvent,
7195         /// The number of elements pointed to by `data`.
7196         pub datalen: usize
7197 }
7198 impl CVec_MessageSendEventZ {
7199         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
7200                 if self.datalen == 0 { return Vec::new(); }
7201                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7202                 self.data = core::ptr::null_mut();
7203                 self.datalen = 0;
7204                 ret
7205         }
7206         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
7207                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7208         }
7209 }
7210 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
7211         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
7212                 let datalen = v.len();
7213                 let data = Box::into_raw(v.into_boxed_slice());
7214                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7215         }
7216 }
7217 #[no_mangle]
7218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7219 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
7220 impl Drop for CVec_MessageSendEventZ {
7221         fn drop(&mut self) {
7222                 if self.datalen == 0 { return; }
7223                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7224         }
7225 }
7226 impl Clone for CVec_MessageSendEventZ {
7227         fn clone(&self) -> Self {
7228                 let mut res = Vec::new();
7229                 if self.datalen == 0 { return Self::from(res); }
7230                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7231                 Self::from(res)
7232         }
7233 }
7234 #[repr(C)]
7235 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
7236 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
7237         /// A pointer to the contents in the success state.
7238         /// Reading from this pointer when `result_ok` is not set is undefined.
7239         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
7240         /// A pointer to the contents in the error state.
7241         /// Reading from this pointer when `result_ok` is set is undefined.
7242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7243 }
7244 #[repr(C)]
7245 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
7246 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7248 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
7249         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
7250         /// `err` or `result` depending on the state of `result_ok`.
7251         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
7252         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
7253         pub result_ok: bool,
7254 }
7255 #[no_mangle]
7256 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
7257 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7258         CResult_ChannelUpdateInfoDecodeErrorZ {
7259                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7260                         result: Box::into_raw(Box::new(o)),
7261                 },
7262                 result_ok: true,
7263         }
7264 }
7265 #[no_mangle]
7266 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
7267 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7268         CResult_ChannelUpdateInfoDecodeErrorZ {
7269                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7270                         err: Box::into_raw(Box::new(e)),
7271                 },
7272                 result_ok: false,
7273         }
7274 }
7275 /// Checks if the given object is currently in the success state
7276 #[no_mangle]
7277 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
7278         o.result_ok
7279 }
7280 #[no_mangle]
7281 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
7282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
7283 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
7284         fn drop(&mut self) {
7285                 if self.result_ok {
7286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7288                         }
7289                 } else {
7290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7292                         }
7293                 }
7294         }
7295 }
7296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
7297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7298                 let contents = if o.result_ok {
7299                         let result = unsafe { o.contents.result };
7300                         unsafe { o.contents.result = core::ptr::null_mut() };
7301                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
7302                 } else {
7303                         let err = unsafe { o.contents.err };
7304                         unsafe { o.contents.err = core::ptr::null_mut(); }
7305                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
7306                 };
7307                 Self {
7308                         contents,
7309                         result_ok: o.result_ok,
7310                 }
7311         }
7312 }
7313 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
7314         fn clone(&self) -> Self {
7315                 if self.result_ok {
7316                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7317                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
7318                         } }
7319                 } else {
7320                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7322                         } }
7323                 }
7324         }
7325 }
7326 #[no_mangle]
7327 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
7328 /// but with all dynamically-allocated buffers duplicated in new buffers.
7329 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
7330 #[repr(C)]
7331 /// The contents of CResult_ChannelInfoDecodeErrorZ
7332 pub union CResult_ChannelInfoDecodeErrorZPtr {
7333         /// A pointer to the contents in the success state.
7334         /// Reading from this pointer when `result_ok` is not set is undefined.
7335         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
7336         /// A pointer to the contents in the error state.
7337         /// Reading from this pointer when `result_ok` is set is undefined.
7338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7339 }
7340 #[repr(C)]
7341 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7342 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7344 pub struct CResult_ChannelInfoDecodeErrorZ {
7345         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7346         /// `err` or `result` depending on the state of `result_ok`.
7347         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7348         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7349         pub result_ok: bool,
7350 }
7351 #[no_mangle]
7352 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7353 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7354         CResult_ChannelInfoDecodeErrorZ {
7355                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7356                         result: Box::into_raw(Box::new(o)),
7357                 },
7358                 result_ok: true,
7359         }
7360 }
7361 #[no_mangle]
7362 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7363 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7364         CResult_ChannelInfoDecodeErrorZ {
7365                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7366                         err: Box::into_raw(Box::new(e)),
7367                 },
7368                 result_ok: false,
7369         }
7370 }
7371 /// Checks if the given object is currently in the success state
7372 #[no_mangle]
7373 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
7374         o.result_ok
7375 }
7376 #[no_mangle]
7377 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7379 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7380         fn drop(&mut self) {
7381                 if self.result_ok {
7382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7384                         }
7385                 } else {
7386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7388                         }
7389                 }
7390         }
7391 }
7392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7393         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7394                 let contents = if o.result_ok {
7395                         let result = unsafe { o.contents.result };
7396                         unsafe { o.contents.result = core::ptr::null_mut() };
7397                         CResult_ChannelInfoDecodeErrorZPtr { result }
7398                 } else {
7399                         let err = unsafe { o.contents.err };
7400                         unsafe { o.contents.err = core::ptr::null_mut(); }
7401                         CResult_ChannelInfoDecodeErrorZPtr { err }
7402                 };
7403                 Self {
7404                         contents,
7405                         result_ok: o.result_ok,
7406                 }
7407         }
7408 }
7409 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7410         fn clone(&self) -> Self {
7411                 if self.result_ok {
7412                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7413                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7414                         } }
7415                 } else {
7416                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7417                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7418                         } }
7419                 }
7420         }
7421 }
7422 #[no_mangle]
7423 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7424 /// but with all dynamically-allocated buffers duplicated in new buffers.
7425 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7426 #[repr(C)]
7427 /// The contents of CResult_RoutingFeesDecodeErrorZ
7428 pub union CResult_RoutingFeesDecodeErrorZPtr {
7429         /// A pointer to the contents in the success state.
7430         /// Reading from this pointer when `result_ok` is not set is undefined.
7431         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7432         /// A pointer to the contents in the error state.
7433         /// Reading from this pointer when `result_ok` is set is undefined.
7434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7435 }
7436 #[repr(C)]
7437 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7438 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7440 pub struct CResult_RoutingFeesDecodeErrorZ {
7441         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7442         /// `err` or `result` depending on the state of `result_ok`.
7443         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7444         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7445         pub result_ok: bool,
7446 }
7447 #[no_mangle]
7448 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7449 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7450         CResult_RoutingFeesDecodeErrorZ {
7451                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7452                         result: Box::into_raw(Box::new(o)),
7453                 },
7454                 result_ok: true,
7455         }
7456 }
7457 #[no_mangle]
7458 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7459 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7460         CResult_RoutingFeesDecodeErrorZ {
7461                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7462                         err: Box::into_raw(Box::new(e)),
7463                 },
7464                 result_ok: false,
7465         }
7466 }
7467 /// Checks if the given object is currently in the success state
7468 #[no_mangle]
7469 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7470         o.result_ok
7471 }
7472 #[no_mangle]
7473 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7475 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7476         fn drop(&mut self) {
7477                 if self.result_ok {
7478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7480                         }
7481                 } else {
7482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7484                         }
7485                 }
7486         }
7487 }
7488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7489         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7490                 let contents = if o.result_ok {
7491                         let result = unsafe { o.contents.result };
7492                         unsafe { o.contents.result = core::ptr::null_mut() };
7493                         CResult_RoutingFeesDecodeErrorZPtr { result }
7494                 } else {
7495                         let err = unsafe { o.contents.err };
7496                         unsafe { o.contents.err = core::ptr::null_mut(); }
7497                         CResult_RoutingFeesDecodeErrorZPtr { err }
7498                 };
7499                 Self {
7500                         contents,
7501                         result_ok: o.result_ok,
7502                 }
7503         }
7504 }
7505 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7506         fn clone(&self) -> Self {
7507                 if self.result_ok {
7508                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7509                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7510                         } }
7511                 } else {
7512                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7513                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7514                         } }
7515                 }
7516         }
7517 }
7518 #[no_mangle]
7519 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7520 /// but with all dynamically-allocated buffers duplicated in new buffers.
7521 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7522 #[repr(C)]
7523 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7524 /// This corresponds to std::vector in C++
7525 pub struct CVec_SocketAddressZ {
7526         /// The elements in the array.
7527         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7528         pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7529         /// The number of elements pointed to by `data`.
7530         pub datalen: usize
7531 }
7532 impl CVec_SocketAddressZ {
7533         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7534                 if self.datalen == 0 { return Vec::new(); }
7535                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7536                 self.data = core::ptr::null_mut();
7537                 self.datalen = 0;
7538                 ret
7539         }
7540         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7541                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7542         }
7543 }
7544 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7545         fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7546                 let datalen = v.len();
7547                 let data = Box::into_raw(v.into_boxed_slice());
7548                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7549         }
7550 }
7551 #[no_mangle]
7552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7553 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7554 impl Drop for CVec_SocketAddressZ {
7555         fn drop(&mut self) {
7556                 if self.datalen == 0 { return; }
7557                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7558         }
7559 }
7560 impl Clone for CVec_SocketAddressZ {
7561         fn clone(&self) -> Self {
7562                 let mut res = Vec::new();
7563                 if self.datalen == 0 { return Self::from(res); }
7564                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7565                 Self::from(res)
7566         }
7567 }
7568 #[repr(C)]
7569 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7570 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7571         /// A pointer to the contents in the success state.
7572         /// Reading from this pointer when `result_ok` is not set is undefined.
7573         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
7574         /// A pointer to the contents in the error state.
7575         /// Reading from this pointer when `result_ok` is set is undefined.
7576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7577 }
7578 #[repr(C)]
7579 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7580 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7582 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7583         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7584         /// `err` or `result` depending on the state of `result_ok`.
7585         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7586         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7587         pub result_ok: bool,
7588 }
7589 #[no_mangle]
7590 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7591 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7592         CResult_NodeAnnouncementInfoDecodeErrorZ {
7593                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7594                         result: Box::into_raw(Box::new(o)),
7595                 },
7596                 result_ok: true,
7597         }
7598 }
7599 #[no_mangle]
7600 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7601 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7602         CResult_NodeAnnouncementInfoDecodeErrorZ {
7603                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7604                         err: Box::into_raw(Box::new(e)),
7605                 },
7606                 result_ok: false,
7607         }
7608 }
7609 /// Checks if the given object is currently in the success state
7610 #[no_mangle]
7611 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7612         o.result_ok
7613 }
7614 #[no_mangle]
7615 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7617 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7618         fn drop(&mut self) {
7619                 if self.result_ok {
7620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7622                         }
7623                 } else {
7624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7626                         }
7627                 }
7628         }
7629 }
7630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7632                 let contents = if o.result_ok {
7633                         let result = unsafe { o.contents.result };
7634                         unsafe { o.contents.result = core::ptr::null_mut() };
7635                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7636                 } else {
7637                         let err = unsafe { o.contents.err };
7638                         unsafe { o.contents.err = core::ptr::null_mut(); }
7639                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7640                 };
7641                 Self {
7642                         contents,
7643                         result_ok: o.result_ok,
7644                 }
7645         }
7646 }
7647 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7648         fn clone(&self) -> Self {
7649                 if self.result_ok {
7650                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7651                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7652                         } }
7653                 } else {
7654                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7656                         } }
7657                 }
7658         }
7659 }
7660 #[no_mangle]
7661 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7662 /// but with all dynamically-allocated buffers duplicated in new buffers.
7663 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7664 #[repr(C)]
7665 /// The contents of CResult_NodeAliasDecodeErrorZ
7666 pub union CResult_NodeAliasDecodeErrorZPtr {
7667         /// A pointer to the contents in the success state.
7668         /// Reading from this pointer when `result_ok` is not set is undefined.
7669         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
7670         /// A pointer to the contents in the error state.
7671         /// Reading from this pointer when `result_ok` is set is undefined.
7672         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7673 }
7674 #[repr(C)]
7675 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7676 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7678 pub struct CResult_NodeAliasDecodeErrorZ {
7679         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7680         /// `err` or `result` depending on the state of `result_ok`.
7681         pub contents: CResult_NodeAliasDecodeErrorZPtr,
7682         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7683         pub result_ok: bool,
7684 }
7685 #[no_mangle]
7686 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7687 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7688         CResult_NodeAliasDecodeErrorZ {
7689                 contents: CResult_NodeAliasDecodeErrorZPtr {
7690                         result: Box::into_raw(Box::new(o)),
7691                 },
7692                 result_ok: true,
7693         }
7694 }
7695 #[no_mangle]
7696 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7697 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7698         CResult_NodeAliasDecodeErrorZ {
7699                 contents: CResult_NodeAliasDecodeErrorZPtr {
7700                         err: Box::into_raw(Box::new(e)),
7701                 },
7702                 result_ok: false,
7703         }
7704 }
7705 /// Checks if the given object is currently in the success state
7706 #[no_mangle]
7707 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7708         o.result_ok
7709 }
7710 #[no_mangle]
7711 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7713 impl Drop for CResult_NodeAliasDecodeErrorZ {
7714         fn drop(&mut self) {
7715                 if self.result_ok {
7716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7718                         }
7719                 } else {
7720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7722                         }
7723                 }
7724         }
7725 }
7726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
7728                 let contents = if o.result_ok {
7729                         let result = unsafe { o.contents.result };
7730                         unsafe { o.contents.result = core::ptr::null_mut() };
7731                         CResult_NodeAliasDecodeErrorZPtr { result }
7732                 } else {
7733                         let err = unsafe { o.contents.err };
7734                         unsafe { o.contents.err = core::ptr::null_mut(); }
7735                         CResult_NodeAliasDecodeErrorZPtr { err }
7736                 };
7737                 Self {
7738                         contents,
7739                         result_ok: o.result_ok,
7740                 }
7741         }
7742 }
7743 impl Clone for CResult_NodeAliasDecodeErrorZ {
7744         fn clone(&self) -> Self {
7745                 if self.result_ok {
7746                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7747                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7748                         } }
7749                 } else {
7750                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7752                         } }
7753                 }
7754         }
7755 }
7756 #[no_mangle]
7757 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7758 /// but with all dynamically-allocated buffers duplicated in new buffers.
7759 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7760 #[repr(C)]
7761 /// The contents of CResult_NodeInfoDecodeErrorZ
7762 pub union CResult_NodeInfoDecodeErrorZPtr {
7763         /// A pointer to the contents in the success state.
7764         /// Reading from this pointer when `result_ok` is not set is undefined.
7765         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7766         /// A pointer to the contents in the error state.
7767         /// Reading from this pointer when `result_ok` is set is undefined.
7768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7769 }
7770 #[repr(C)]
7771 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7772 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7774 pub struct CResult_NodeInfoDecodeErrorZ {
7775         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7776         /// `err` or `result` depending on the state of `result_ok`.
7777         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7778         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7779         pub result_ok: bool,
7780 }
7781 #[no_mangle]
7782 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7783 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7784         CResult_NodeInfoDecodeErrorZ {
7785                 contents: CResult_NodeInfoDecodeErrorZPtr {
7786                         result: Box::into_raw(Box::new(o)),
7787                 },
7788                 result_ok: true,
7789         }
7790 }
7791 #[no_mangle]
7792 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7793 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7794         CResult_NodeInfoDecodeErrorZ {
7795                 contents: CResult_NodeInfoDecodeErrorZPtr {
7796                         err: Box::into_raw(Box::new(e)),
7797                 },
7798                 result_ok: false,
7799         }
7800 }
7801 /// Checks if the given object is currently in the success state
7802 #[no_mangle]
7803 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7804         o.result_ok
7805 }
7806 #[no_mangle]
7807 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7808 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7809 impl Drop for CResult_NodeInfoDecodeErrorZ {
7810         fn drop(&mut self) {
7811                 if self.result_ok {
7812                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7813                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7814                         }
7815                 } else {
7816                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7817                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7818                         }
7819                 }
7820         }
7821 }
7822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7824                 let contents = if o.result_ok {
7825                         let result = unsafe { o.contents.result };
7826                         unsafe { o.contents.result = core::ptr::null_mut() };
7827                         CResult_NodeInfoDecodeErrorZPtr { result }
7828                 } else {
7829                         let err = unsafe { o.contents.err };
7830                         unsafe { o.contents.err = core::ptr::null_mut(); }
7831                         CResult_NodeInfoDecodeErrorZPtr { err }
7832                 };
7833                 Self {
7834                         contents,
7835                         result_ok: o.result_ok,
7836                 }
7837         }
7838 }
7839 impl Clone for CResult_NodeInfoDecodeErrorZ {
7840         fn clone(&self) -> Self {
7841                 if self.result_ok {
7842                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7843                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7844                         } }
7845                 } else {
7846                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7847                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7848                         } }
7849                 }
7850         }
7851 }
7852 #[no_mangle]
7853 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7854 /// but with all dynamically-allocated buffers duplicated in new buffers.
7855 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7856 #[repr(C)]
7857 /// The contents of CResult_NetworkGraphDecodeErrorZ
7858 pub union CResult_NetworkGraphDecodeErrorZPtr {
7859         /// A pointer to the contents in the success state.
7860         /// Reading from this pointer when `result_ok` is not set is undefined.
7861         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7862         /// A pointer to the contents in the error state.
7863         /// Reading from this pointer when `result_ok` is set is undefined.
7864         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7865 }
7866 #[repr(C)]
7867 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7868 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7870 pub struct CResult_NetworkGraphDecodeErrorZ {
7871         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7872         /// `err` or `result` depending on the state of `result_ok`.
7873         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7874         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7875         pub result_ok: bool,
7876 }
7877 #[no_mangle]
7878 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7879 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7880         CResult_NetworkGraphDecodeErrorZ {
7881                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7882                         result: Box::into_raw(Box::new(o)),
7883                 },
7884                 result_ok: true,
7885         }
7886 }
7887 #[no_mangle]
7888 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7889 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7890         CResult_NetworkGraphDecodeErrorZ {
7891                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7892                         err: Box::into_raw(Box::new(e)),
7893                 },
7894                 result_ok: false,
7895         }
7896 }
7897 /// Checks if the given object is currently in the success state
7898 #[no_mangle]
7899 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7900         o.result_ok
7901 }
7902 #[no_mangle]
7903 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7904 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7905 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7906         fn drop(&mut self) {
7907                 if self.result_ok {
7908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7910                         }
7911                 } else {
7912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7914                         }
7915                 }
7916         }
7917 }
7918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7920                 let contents = if o.result_ok {
7921                         let result = unsafe { o.contents.result };
7922                         unsafe { o.contents.result = core::ptr::null_mut() };
7923                         CResult_NetworkGraphDecodeErrorZPtr { result }
7924                 } else {
7925                         let err = unsafe { o.contents.err };
7926                         unsafe { o.contents.err = core::ptr::null_mut(); }
7927                         CResult_NetworkGraphDecodeErrorZPtr { err }
7928                 };
7929                 Self {
7930                         contents,
7931                         result_ok: o.result_ok,
7932                 }
7933         }
7934 }
7935 #[repr(C)]
7936 #[derive(Clone)]
7937 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7938 pub enum COption_CVec_SocketAddressZZ {
7939         /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7940         Some(crate::c_types::derived::CVec_SocketAddressZ),
7941         /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7942         None
7943 }
7944 impl COption_CVec_SocketAddressZZ {
7945         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7946                 if let Self::None = self { false } else { true }
7947         }
7948         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7949                 !self.is_some()
7950         }
7951         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7952                 if let Self::Some(v) = self { v } else { unreachable!() }
7953         }
7954 }
7955 #[no_mangle]
7956 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7957 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7958         COption_CVec_SocketAddressZZ::Some(o)
7959 }
7960 #[no_mangle]
7961 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7962 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7963         COption_CVec_SocketAddressZZ::None
7964 }
7965 #[no_mangle]
7966 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7967 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7968 #[no_mangle]
7969 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7970 /// but with all dynamically-allocated buffers duplicated in new buffers.
7971 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
7972 #[repr(C)]
7973 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
7974 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
7975         /// A pointer to the contents in the success state.
7976         /// Reading from this pointer when `result_ok` is not set is undefined.
7977         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
7978         /// A pointer to the contents in the error state.
7979         /// Reading from this pointer when `result_ok` is set is undefined.
7980         pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
7981 }
7982 #[repr(C)]
7983 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
7984 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
7985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7986 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
7987         /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
7988         /// `err` or `result` depending on the state of `result_ok`.
7989         pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
7990         /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
7991         pub result_ok: bool,
7992 }
7993 #[no_mangle]
7994 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
7995 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
7996         CResult_PendingHTLCInfoInboundHTLCErrZ {
7997                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
7998                         result: Box::into_raw(Box::new(o)),
7999                 },
8000                 result_ok: true,
8001         }
8002 }
8003 #[no_mangle]
8004 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
8005 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8006         CResult_PendingHTLCInfoInboundHTLCErrZ {
8007                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8008                         err: Box::into_raw(Box::new(e)),
8009                 },
8010                 result_ok: false,
8011         }
8012 }
8013 /// Checks if the given object is currently in the success state
8014 #[no_mangle]
8015 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
8016         o.result_ok
8017 }
8018 #[no_mangle]
8019 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
8020 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
8021 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
8022         fn drop(&mut self) {
8023                 if self.result_ok {
8024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8026                         }
8027                 } else {
8028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8030                         }
8031                 }
8032         }
8033 }
8034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
8035         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
8036                 let contents = if o.result_ok {
8037                         let result = unsafe { o.contents.result };
8038                         unsafe { o.contents.result = core::ptr::null_mut() };
8039                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
8040                 } else {
8041                         let err = unsafe { o.contents.err };
8042                         unsafe { o.contents.err = core::ptr::null_mut(); }
8043                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
8044                 };
8045                 Self {
8046                         contents,
8047                         result_ok: o.result_ok,
8048                 }
8049         }
8050 }
8051 #[repr(C)]
8052 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
8053 /// This corresponds to std::vector in C++
8054 pub struct CVec_HTLCOutputInCommitmentZ {
8055         /// The elements in the array.
8056         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8057         pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
8058         /// The number of elements pointed to by `data`.
8059         pub datalen: usize
8060 }
8061 impl CVec_HTLCOutputInCommitmentZ {
8062         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
8063                 if self.datalen == 0 { return Vec::new(); }
8064                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8065                 self.data = core::ptr::null_mut();
8066                 self.datalen = 0;
8067                 ret
8068         }
8069         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
8070                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8071         }
8072 }
8073 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
8074         fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
8075                 let datalen = v.len();
8076                 let data = Box::into_raw(v.into_boxed_slice());
8077                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8078         }
8079 }
8080 #[no_mangle]
8081 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8082 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
8083 impl Drop for CVec_HTLCOutputInCommitmentZ {
8084         fn drop(&mut self) {
8085                 if self.datalen == 0 { return; }
8086                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8087         }
8088 }
8089 impl Clone for CVec_HTLCOutputInCommitmentZ {
8090         fn clone(&self) -> Self {
8091                 let mut res = Vec::new();
8092                 if self.datalen == 0 { return Self::from(res); }
8093                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8094                 Self::from(res)
8095         }
8096 }
8097 #[repr(C)]
8098 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
8099 /// This corresponds to std::vector in C++
8100 pub struct CVec_HTLCDescriptorZ {
8101         /// The elements in the array.
8102         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8103         pub data: *mut crate::lightning::sign::HTLCDescriptor,
8104         /// The number of elements pointed to by `data`.
8105         pub datalen: usize
8106 }
8107 impl CVec_HTLCDescriptorZ {
8108         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
8109                 if self.datalen == 0 { return Vec::new(); }
8110                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8111                 self.data = core::ptr::null_mut();
8112                 self.datalen = 0;
8113                 ret
8114         }
8115         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
8116                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8117         }
8118 }
8119 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
8120         fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
8121                 let datalen = v.len();
8122                 let data = Box::into_raw(v.into_boxed_slice());
8123                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8124         }
8125 }
8126 #[no_mangle]
8127 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8128 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
8129 impl Drop for CVec_HTLCDescriptorZ {
8130         fn drop(&mut self) {
8131                 if self.datalen == 0 { return; }
8132                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8133         }
8134 }
8135 impl Clone for CVec_HTLCDescriptorZ {
8136         fn clone(&self) -> Self {
8137                 let mut res = Vec::new();
8138                 if self.datalen == 0 { return Self::from(res); }
8139                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8140                 Self::from(res)
8141         }
8142 }
8143 #[repr(C)]
8144 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
8145 /// This corresponds to std::vector in C++
8146 pub struct CVec_UtxoZ {
8147         /// The elements in the array.
8148         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8149         pub data: *mut crate::lightning::events::bump_transaction::Utxo,
8150         /// The number of elements pointed to by `data`.
8151         pub datalen: usize
8152 }
8153 impl CVec_UtxoZ {
8154         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
8155                 if self.datalen == 0 { return Vec::new(); }
8156                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8157                 self.data = core::ptr::null_mut();
8158                 self.datalen = 0;
8159                 ret
8160         }
8161         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
8162                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8163         }
8164 }
8165 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
8166         fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
8167                 let datalen = v.len();
8168                 let data = Box::into_raw(v.into_boxed_slice());
8169                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8170         }
8171 }
8172 #[no_mangle]
8173 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8174 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
8175 impl Drop for CVec_UtxoZ {
8176         fn drop(&mut self) {
8177                 if self.datalen == 0 { return; }
8178                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8179         }
8180 }
8181 impl Clone for CVec_UtxoZ {
8182         fn clone(&self) -> Self {
8183                 let mut res = Vec::new();
8184                 if self.datalen == 0 { return Self::from(res); }
8185                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8186                 Self::from(res)
8187         }
8188 }
8189 #[repr(C)]
8190 #[derive(Clone)]
8191 /// An enum which can either contain a crate::c_types::TxOut or not
8192 pub enum COption_TxOutZ {
8193         /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
8194         Some(crate::c_types::TxOut),
8195         /// When we're in this state, this COption_TxOutZ contains nothing
8196         None
8197 }
8198 impl COption_TxOutZ {
8199         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8200                 if let Self::None = self { false } else { true }
8201         }
8202         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8203                 !self.is_some()
8204         }
8205         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
8206                 if let Self::Some(v) = self { v } else { unreachable!() }
8207         }
8208 }
8209 #[no_mangle]
8210 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
8211 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
8212         COption_TxOutZ::Some(o)
8213 }
8214 #[no_mangle]
8215 /// Constructs a new COption_TxOutZ containing nothing
8216 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
8217         COption_TxOutZ::None
8218 }
8219 #[no_mangle]
8220 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
8221 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
8222 #[no_mangle]
8223 /// Creates a new COption_TxOutZ which has the same data as `orig`
8224 /// but with all dynamically-allocated buffers duplicated in new buffers.
8225 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
8226 #[repr(C)]
8227 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
8228 /// This corresponds to std::vector in C++
8229 pub struct CVec_InputZ {
8230         /// The elements in the array.
8231         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8232         pub data: *mut crate::lightning::events::bump_transaction::Input,
8233         /// The number of elements pointed to by `data`.
8234         pub datalen: usize
8235 }
8236 impl CVec_InputZ {
8237         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
8238                 if self.datalen == 0 { return Vec::new(); }
8239                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8240                 self.data = core::ptr::null_mut();
8241                 self.datalen = 0;
8242                 ret
8243         }
8244         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
8245                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8246         }
8247 }
8248 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
8249         fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
8250                 let datalen = v.len();
8251                 let data = Box::into_raw(v.into_boxed_slice());
8252                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8253         }
8254 }
8255 #[no_mangle]
8256 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8257 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
8258 impl Drop for CVec_InputZ {
8259         fn drop(&mut self) {
8260                 if self.datalen == 0 { return; }
8261                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8262         }
8263 }
8264 impl Clone for CVec_InputZ {
8265         fn clone(&self) -> Self {
8266                 let mut res = Vec::new();
8267                 if self.datalen == 0 { return Self::from(res); }
8268                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8269                 Self::from(res)
8270         }
8271 }
8272 #[repr(C)]
8273 /// The contents of CResult_CoinSelectionNoneZ
8274 pub union CResult_CoinSelectionNoneZPtr {
8275         /// A pointer to the contents in the success state.
8276         /// Reading from this pointer when `result_ok` is not set is undefined.
8277         pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
8278         /// Note that this value is always NULL, as there are no contents in the Err variant
8279         pub err: *mut core::ffi::c_void,
8280 }
8281 #[repr(C)]
8282 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
8283 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
8284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8285 pub struct CResult_CoinSelectionNoneZ {
8286         /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
8287         /// `err` or `result` depending on the state of `result_ok`.
8288         pub contents: CResult_CoinSelectionNoneZPtr,
8289         /// Whether this CResult_CoinSelectionNoneZ represents a success state.
8290         pub result_ok: bool,
8291 }
8292 #[no_mangle]
8293 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
8294 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
8295         CResult_CoinSelectionNoneZ {
8296                 contents: CResult_CoinSelectionNoneZPtr {
8297                         result: Box::into_raw(Box::new(o)),
8298                 },
8299                 result_ok: true,
8300         }
8301 }
8302 #[no_mangle]
8303 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
8304 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
8305         CResult_CoinSelectionNoneZ {
8306                 contents: CResult_CoinSelectionNoneZPtr {
8307                         err: core::ptr::null_mut(),
8308                 },
8309                 result_ok: false,
8310         }
8311 }
8312 /// Checks if the given object is currently in the success state
8313 #[no_mangle]
8314 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
8315         o.result_ok
8316 }
8317 #[no_mangle]
8318 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
8319 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
8320 impl Drop for CResult_CoinSelectionNoneZ {
8321         fn drop(&mut self) {
8322                 if self.result_ok {
8323                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8324                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8325                         }
8326                 } else {
8327                 }
8328         }
8329 }
8330 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
8331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
8332                 let contents = if o.result_ok {
8333                         let result = unsafe { o.contents.result };
8334                         unsafe { o.contents.result = core::ptr::null_mut() };
8335                         CResult_CoinSelectionNoneZPtr { result }
8336                 } else {
8337                         let _ = unsafe { Box::from_raw(o.contents.err) };
8338                         o.contents.err = core::ptr::null_mut();
8339                         CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
8340                 };
8341                 Self {
8342                         contents,
8343                         result_ok: o.result_ok,
8344                 }
8345         }
8346 }
8347 impl Clone for CResult_CoinSelectionNoneZ {
8348         fn clone(&self) -> Self {
8349                 if self.result_ok {
8350                         Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
8351                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
8352                         } }
8353                 } else {
8354                         Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
8355                                 err: core::ptr::null_mut()
8356                         } }
8357                 }
8358         }
8359 }
8360 #[no_mangle]
8361 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
8362 /// but with all dynamically-allocated buffers duplicated in new buffers.
8363 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
8364 #[repr(C)]
8365 /// The contents of CResult_CVec_UtxoZNoneZ
8366 pub union CResult_CVec_UtxoZNoneZPtr {
8367         /// A pointer to the contents in the success state.
8368         /// Reading from this pointer when `result_ok` is not set is undefined.
8369         pub result: *mut crate::c_types::derived::CVec_UtxoZ,
8370         /// Note that this value is always NULL, as there are no contents in the Err variant
8371         pub err: *mut core::ffi::c_void,
8372 }
8373 #[repr(C)]
8374 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
8375 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
8376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8377 pub struct CResult_CVec_UtxoZNoneZ {
8378         /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
8379         /// `err` or `result` depending on the state of `result_ok`.
8380         pub contents: CResult_CVec_UtxoZNoneZPtr,
8381         /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
8382         pub result_ok: bool,
8383 }
8384 #[no_mangle]
8385 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
8386 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
8387         CResult_CVec_UtxoZNoneZ {
8388                 contents: CResult_CVec_UtxoZNoneZPtr {
8389                         result: Box::into_raw(Box::new(o)),
8390                 },
8391                 result_ok: true,
8392         }
8393 }
8394 #[no_mangle]
8395 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
8396 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
8397         CResult_CVec_UtxoZNoneZ {
8398                 contents: CResult_CVec_UtxoZNoneZPtr {
8399                         err: core::ptr::null_mut(),
8400                 },
8401                 result_ok: false,
8402         }
8403 }
8404 /// Checks if the given object is currently in the success state
8405 #[no_mangle]
8406 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
8407         o.result_ok
8408 }
8409 #[no_mangle]
8410 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
8411 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
8412 impl Drop for CResult_CVec_UtxoZNoneZ {
8413         fn drop(&mut self) {
8414                 if self.result_ok {
8415                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8416                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8417                         }
8418                 } else {
8419                 }
8420         }
8421 }
8422 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
8423         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
8424                 let contents = if o.result_ok {
8425                         let result = unsafe { o.contents.result };
8426                         unsafe { o.contents.result = core::ptr::null_mut() };
8427                         CResult_CVec_UtxoZNoneZPtr { result }
8428                 } else {
8429                         let _ = unsafe { Box::from_raw(o.contents.err) };
8430                         o.contents.err = core::ptr::null_mut();
8431                         CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
8432                 };
8433                 Self {
8434                         contents,
8435                         result_ok: o.result_ok,
8436                 }
8437         }
8438 }
8439 impl Clone for CResult_CVec_UtxoZNoneZ {
8440         fn clone(&self) -> Self {
8441                 if self.result_ok {
8442                         Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
8443                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
8444                         } }
8445                 } else {
8446                         Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
8447                                 err: core::ptr::null_mut()
8448                         } }
8449                 }
8450         }
8451 }
8452 #[no_mangle]
8453 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
8454 /// but with all dynamically-allocated buffers duplicated in new buffers.
8455 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
8456 #[repr(C)]
8457 /// A tuple of 2 elements. See the individual fields for the types contained.
8458 pub struct C2Tuple_u64u16Z {
8459         /// The element at position 0
8460         pub a: u64,
8461         /// The element at position 1
8462         pub b: u16,
8463 }
8464 impl From<(u64, u16)> for C2Tuple_u64u16Z {
8465         fn from (tup: (u64, u16)) -> Self {
8466                 Self {
8467                         a: tup.0,
8468                         b: tup.1,
8469                 }
8470         }
8471 }
8472 impl C2Tuple_u64u16Z {
8473         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
8474                 (self.a, self.b)
8475         }
8476 }
8477 impl Clone for C2Tuple_u64u16Z {
8478         fn clone(&self) -> Self {
8479                 Self {
8480                         a: Clone::clone(&self.a),
8481                         b: Clone::clone(&self.b),
8482                 }
8483         }
8484 }
8485 #[no_mangle]
8486 /// Creates a new tuple which has the same data as `orig`
8487 /// but with all dynamically-allocated buffers duplicated in new buffers.
8488 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
8489 /// Creates a new C2Tuple_u64u16Z from the contained elements.
8490 #[no_mangle]
8491 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
8492         C2Tuple_u64u16Z { a, b, }
8493 }
8494
8495 #[no_mangle]
8496 /// Frees any resources used by the C2Tuple_u64u16Z.
8497 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
8498 #[repr(C)]
8499 #[derive(Clone)]
8500 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
8501 pub enum COption_C2Tuple_u64u16ZZ {
8502         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
8503         Some(crate::c_types::derived::C2Tuple_u64u16Z),
8504         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
8505         None
8506 }
8507 impl COption_C2Tuple_u64u16ZZ {
8508         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8509                 if let Self::None = self { false } else { true }
8510         }
8511         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8512                 !self.is_some()
8513         }
8514         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
8515                 if let Self::Some(v) = self { v } else { unreachable!() }
8516         }
8517 }
8518 #[no_mangle]
8519 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
8520 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
8521         COption_C2Tuple_u64u16ZZ::Some(o)
8522 }
8523 #[no_mangle]
8524 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
8525 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
8526         COption_C2Tuple_u64u16ZZ::None
8527 }
8528 #[no_mangle]
8529 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
8530 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
8531 #[no_mangle]
8532 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
8533 /// but with all dynamically-allocated buffers duplicated in new buffers.
8534 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
8535 #[repr(C)]
8536 #[derive(Clone)]
8537 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
8538 pub enum COption_ChannelShutdownStateZ {
8539         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
8540         Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
8541         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
8542         None
8543 }
8544 impl COption_ChannelShutdownStateZ {
8545         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8546                 if let Self::None = self { false } else { true }
8547         }
8548         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8549                 !self.is_some()
8550         }
8551         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
8552                 if let Self::Some(v) = self { v } else { unreachable!() }
8553         }
8554 }
8555 #[no_mangle]
8556 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
8557 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
8558         COption_ChannelShutdownStateZ::Some(o)
8559 }
8560 #[no_mangle]
8561 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
8562 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
8563         COption_ChannelShutdownStateZ::None
8564 }
8565 #[no_mangle]
8566 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
8567 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
8568 #[no_mangle]
8569 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
8570 /// but with all dynamically-allocated buffers duplicated in new buffers.
8571 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
8572 #[repr(C)]
8573 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
8574 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
8575         /// A pointer to the contents in the success state.
8576         /// Reading from this pointer when `result_ok` is not set is undefined.
8577         pub result: *mut crate::c_types::ThirtyTwoBytes,
8578         /// A pointer to the contents in the error state.
8579         /// Reading from this pointer when `result_ok` is set is undefined.
8580         pub err: *mut crate::lightning::util::errors::APIError,
8581 }
8582 #[repr(C)]
8583 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
8584 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8586 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
8587         /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
8588         /// `err` or `result` depending on the state of `result_ok`.
8589         pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
8590         /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
8591         pub result_ok: bool,
8592 }
8593 #[no_mangle]
8594 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
8595 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
8596         CResult_ThirtyTwoBytesAPIErrorZ {
8597                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8598                         result: Box::into_raw(Box::new(o)),
8599                 },
8600                 result_ok: true,
8601         }
8602 }
8603 #[no_mangle]
8604 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
8605 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
8606         CResult_ThirtyTwoBytesAPIErrorZ {
8607                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8608                         err: Box::into_raw(Box::new(e)),
8609                 },
8610                 result_ok: false,
8611         }
8612 }
8613 /// Checks if the given object is currently in the success state
8614 #[no_mangle]
8615 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
8616         o.result_ok
8617 }
8618 #[no_mangle]
8619 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
8620 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
8621 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
8622         fn drop(&mut self) {
8623                 if self.result_ok {
8624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8626                         }
8627                 } else {
8628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8630                         }
8631                 }
8632         }
8633 }
8634 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
8635         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8636                 let contents = if o.result_ok {
8637                         let result = unsafe { o.contents.result };
8638                         unsafe { o.contents.result = core::ptr::null_mut() };
8639                         CResult_ThirtyTwoBytesAPIErrorZPtr { result }
8640                 } else {
8641                         let err = unsafe { o.contents.err };
8642                         unsafe { o.contents.err = core::ptr::null_mut(); }
8643                         CResult_ThirtyTwoBytesAPIErrorZPtr { err }
8644                 };
8645                 Self {
8646                         contents,
8647                         result_ok: o.result_ok,
8648                 }
8649         }
8650 }
8651 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
8652         fn clone(&self) -> Self {
8653                 if self.result_ok {
8654                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8655                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8656                         } }
8657                 } else {
8658                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8659                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8660                         } }
8661                 }
8662         }
8663 }
8664 #[no_mangle]
8665 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
8666 /// but with all dynamically-allocated buffers duplicated in new buffers.
8667 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
8668 #[repr(C)]
8669 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8670 /// This corresponds to std::vector in C++
8671 pub struct CVec_RecentPaymentDetailsZ {
8672         /// The elements in the array.
8673         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8674         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8675         /// The number of elements pointed to by `data`.
8676         pub datalen: usize
8677 }
8678 impl CVec_RecentPaymentDetailsZ {
8679         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8680                 if self.datalen == 0 { return Vec::new(); }
8681                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8682                 self.data = core::ptr::null_mut();
8683                 self.datalen = 0;
8684                 ret
8685         }
8686         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8687                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8688         }
8689 }
8690 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8691         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8692                 let datalen = v.len();
8693                 let data = Box::into_raw(v.into_boxed_slice());
8694                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8695         }
8696 }
8697 #[no_mangle]
8698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8699 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8700 impl Drop for CVec_RecentPaymentDetailsZ {
8701         fn drop(&mut self) {
8702                 if self.datalen == 0 { return; }
8703                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8704         }
8705 }
8706 #[repr(C)]
8707 /// The contents of CResult_NonePaymentSendFailureZ
8708 pub union CResult_NonePaymentSendFailureZPtr {
8709         /// Note that this value is always NULL, as there are no contents in the OK variant
8710         pub result: *mut core::ffi::c_void,
8711         /// A pointer to the contents in the error state.
8712         /// Reading from this pointer when `result_ok` is set is undefined.
8713         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8714 }
8715 #[repr(C)]
8716 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8717 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8719 pub struct CResult_NonePaymentSendFailureZ {
8720         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8721         /// `err` or `result` depending on the state of `result_ok`.
8722         pub contents: CResult_NonePaymentSendFailureZPtr,
8723         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8724         pub result_ok: bool,
8725 }
8726 #[no_mangle]
8727 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8728 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8729         CResult_NonePaymentSendFailureZ {
8730                 contents: CResult_NonePaymentSendFailureZPtr {
8731                         result: core::ptr::null_mut(),
8732                 },
8733                 result_ok: true,
8734         }
8735 }
8736 #[no_mangle]
8737 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8738 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8739         CResult_NonePaymentSendFailureZ {
8740                 contents: CResult_NonePaymentSendFailureZPtr {
8741                         err: Box::into_raw(Box::new(e)),
8742                 },
8743                 result_ok: false,
8744         }
8745 }
8746 /// Checks if the given object is currently in the success state
8747 #[no_mangle]
8748 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8749         o.result_ok
8750 }
8751 #[no_mangle]
8752 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8753 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8754 impl Drop for CResult_NonePaymentSendFailureZ {
8755         fn drop(&mut self) {
8756                 if self.result_ok {
8757                 } else {
8758                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8759                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8760                         }
8761                 }
8762         }
8763 }
8764 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8765         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8766                 let contents = if o.result_ok {
8767                         let _ = unsafe { Box::from_raw(o.contents.result) };
8768                         o.contents.result = core::ptr::null_mut();
8769                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8770                 } else {
8771                         let err = unsafe { o.contents.err };
8772                         unsafe { o.contents.err = core::ptr::null_mut(); }
8773                         CResult_NonePaymentSendFailureZPtr { err }
8774                 };
8775                 Self {
8776                         contents,
8777                         result_ok: o.result_ok,
8778                 }
8779         }
8780 }
8781 impl Clone for CResult_NonePaymentSendFailureZ {
8782         fn clone(&self) -> Self {
8783                 if self.result_ok {
8784                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8785                                 result: core::ptr::null_mut()
8786                         } }
8787                 } else {
8788                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8789                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8790                         } }
8791                 }
8792         }
8793 }
8794 #[no_mangle]
8795 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8796 /// but with all dynamically-allocated buffers duplicated in new buffers.
8797 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8798 #[repr(C)]
8799 /// The contents of CResult_NoneRetryableSendFailureZ
8800 pub union CResult_NoneRetryableSendFailureZPtr {
8801         /// Note that this value is always NULL, as there are no contents in the OK variant
8802         pub result: *mut core::ffi::c_void,
8803         /// A pointer to the contents in the error state.
8804         /// Reading from this pointer when `result_ok` is set is undefined.
8805         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8806 }
8807 #[repr(C)]
8808 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8809 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8811 pub struct CResult_NoneRetryableSendFailureZ {
8812         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8813         /// `err` or `result` depending on the state of `result_ok`.
8814         pub contents: CResult_NoneRetryableSendFailureZPtr,
8815         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8816         pub result_ok: bool,
8817 }
8818 #[no_mangle]
8819 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8820 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8821         CResult_NoneRetryableSendFailureZ {
8822                 contents: CResult_NoneRetryableSendFailureZPtr {
8823                         result: core::ptr::null_mut(),
8824                 },
8825                 result_ok: true,
8826         }
8827 }
8828 #[no_mangle]
8829 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8830 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8831         CResult_NoneRetryableSendFailureZ {
8832                 contents: CResult_NoneRetryableSendFailureZPtr {
8833                         err: Box::into_raw(Box::new(e)),
8834                 },
8835                 result_ok: false,
8836         }
8837 }
8838 /// Checks if the given object is currently in the success state
8839 #[no_mangle]
8840 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8841         o.result_ok
8842 }
8843 #[no_mangle]
8844 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8845 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8846 impl Drop for CResult_NoneRetryableSendFailureZ {
8847         fn drop(&mut self) {
8848                 if self.result_ok {
8849                 } else {
8850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8852                         }
8853                 }
8854         }
8855 }
8856 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8857         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8858                 let contents = if o.result_ok {
8859                         let _ = unsafe { Box::from_raw(o.contents.result) };
8860                         o.contents.result = core::ptr::null_mut();
8861                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8862                 } else {
8863                         let err = unsafe { o.contents.err };
8864                         unsafe { o.contents.err = core::ptr::null_mut(); }
8865                         CResult_NoneRetryableSendFailureZPtr { err }
8866                 };
8867                 Self {
8868                         contents,
8869                         result_ok: o.result_ok,
8870                 }
8871         }
8872 }
8873 impl Clone for CResult_NoneRetryableSendFailureZ {
8874         fn clone(&self) -> Self {
8875                 if self.result_ok {
8876                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8877                                 result: core::ptr::null_mut()
8878                         } }
8879                 } else {
8880                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8881                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8882                         } }
8883                 }
8884         }
8885 }
8886 #[no_mangle]
8887 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8888 /// but with all dynamically-allocated buffers duplicated in new buffers.
8889 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8890 #[repr(C)]
8891 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
8892 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8893         /// A pointer to the contents in the success state.
8894         /// Reading from this pointer when `result_ok` is not set is undefined.
8895         pub result: *mut crate::c_types::ThirtyTwoBytes,
8896         /// A pointer to the contents in the error state.
8897         /// Reading from this pointer when `result_ok` is set is undefined.
8898         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8899 }
8900 #[repr(C)]
8901 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
8902 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8904 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
8905         /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
8906         /// `err` or `result` depending on the state of `result_ok`.
8907         pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
8908         /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
8909         pub result_ok: bool,
8910 }
8911 #[no_mangle]
8912 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
8913 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8914         CResult_ThirtyTwoBytesPaymentSendFailureZ {
8915                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8916                         result: Box::into_raw(Box::new(o)),
8917                 },
8918                 result_ok: true,
8919         }
8920 }
8921 #[no_mangle]
8922 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
8923 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8924         CResult_ThirtyTwoBytesPaymentSendFailureZ {
8925                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8926                         err: Box::into_raw(Box::new(e)),
8927                 },
8928                 result_ok: false,
8929         }
8930 }
8931 /// Checks if the given object is currently in the success state
8932 #[no_mangle]
8933 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
8934         o.result_ok
8935 }
8936 #[no_mangle]
8937 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
8938 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
8939 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8940         fn drop(&mut self) {
8941                 if self.result_ok {
8942                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8943                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8944                         }
8945                 } else {
8946                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8947                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8948                         }
8949                 }
8950         }
8951 }
8952 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8953         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8954                 let contents = if o.result_ok {
8955                         let result = unsafe { o.contents.result };
8956                         unsafe { o.contents.result = core::ptr::null_mut() };
8957                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
8958                 } else {
8959                         let err = unsafe { o.contents.err };
8960                         unsafe { o.contents.err = core::ptr::null_mut(); }
8961                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
8962                 };
8963                 Self {
8964                         contents,
8965                         result_ok: o.result_ok,
8966                 }
8967         }
8968 }
8969 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8970         fn clone(&self) -> Self {
8971                 if self.result_ok {
8972                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8973                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8974                         } }
8975                 } else {
8976                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8977                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8978                         } }
8979                 }
8980         }
8981 }
8982 #[no_mangle]
8983 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
8984 /// but with all dynamically-allocated buffers duplicated in new buffers.
8985 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
8986 #[repr(C)]
8987 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
8988 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8989         /// A pointer to the contents in the success state.
8990         /// Reading from this pointer when `result_ok` is not set is undefined.
8991         pub result: *mut crate::c_types::ThirtyTwoBytes,
8992         /// A pointer to the contents in the error state.
8993         /// Reading from this pointer when `result_ok` is set is undefined.
8994         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8995 }
8996 #[repr(C)]
8997 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
8998 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9000 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
9001         /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
9002         /// `err` or `result` depending on the state of `result_ok`.
9003         pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
9004         /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
9005         pub result_ok: bool,
9006 }
9007 #[no_mangle]
9008 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
9009 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9010         CResult_ThirtyTwoBytesRetryableSendFailureZ {
9011                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9012                         result: Box::into_raw(Box::new(o)),
9013                 },
9014                 result_ok: true,
9015         }
9016 }
9017 #[no_mangle]
9018 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
9019 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9020         CResult_ThirtyTwoBytesRetryableSendFailureZ {
9021                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9022                         err: Box::into_raw(Box::new(e)),
9023                 },
9024                 result_ok: false,
9025         }
9026 }
9027 /// Checks if the given object is currently in the success state
9028 #[no_mangle]
9029 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
9030         o.result_ok
9031 }
9032 #[no_mangle]
9033 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
9034 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
9035 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9036         fn drop(&mut self) {
9037                 if self.result_ok {
9038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9040                         }
9041                 } else {
9042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9044                         }
9045                 }
9046         }
9047 }
9048 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9049         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9050                 let contents = if o.result_ok {
9051                         let result = unsafe { o.contents.result };
9052                         unsafe { o.contents.result = core::ptr::null_mut() };
9053                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
9054                 } else {
9055                         let err = unsafe { o.contents.err };
9056                         unsafe { o.contents.err = core::ptr::null_mut(); }
9057                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
9058                 };
9059                 Self {
9060                         contents,
9061                         result_ok: o.result_ok,
9062                 }
9063         }
9064 }
9065 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9066         fn clone(&self) -> Self {
9067                 if self.result_ok {
9068                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9069                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9070                         } }
9071                 } else {
9072                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9074                         } }
9075                 }
9076         }
9077 }
9078 #[no_mangle]
9079 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
9080 /// but with all dynamically-allocated buffers duplicated in new buffers.
9081 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
9082 #[repr(C)]
9083 /// A tuple of 2 elements. See the individual fields for the types contained.
9084 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9085         /// The element at position 0
9086         pub a: crate::c_types::ThirtyTwoBytes,
9087         /// The element at position 1
9088         pub b: crate::c_types::ThirtyTwoBytes,
9089 }
9090 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9091         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9092                 Self {
9093                         a: tup.0,
9094                         b: tup.1,
9095                 }
9096         }
9097 }
9098 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9099         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9100                 (self.a, self.b)
9101         }
9102 }
9103 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9104         fn clone(&self) -> Self {
9105                 Self {
9106                         a: Clone::clone(&self.a),
9107                         b: Clone::clone(&self.b),
9108                 }
9109         }
9110 }
9111 #[no_mangle]
9112 /// Creates a new tuple which has the same data as `orig`
9113 /// but with all dynamically-allocated buffers duplicated in new buffers.
9114 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
9115 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
9116 #[no_mangle]
9117 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9118         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
9119 }
9120
9121 #[no_mangle]
9122 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
9123 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
9124 #[repr(C)]
9125 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
9126 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9127         /// A pointer to the contents in the success state.
9128         /// Reading from this pointer when `result_ok` is not set is undefined.
9129         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9130         /// A pointer to the contents in the error state.
9131         /// Reading from this pointer when `result_ok` is set is undefined.
9132         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9133 }
9134 #[repr(C)]
9135 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
9136 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9138 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9139         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
9140         /// `err` or `result` depending on the state of `result_ok`.
9141         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
9142         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
9143         pub result_ok: bool,
9144 }
9145 #[no_mangle]
9146 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
9147 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9148         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9149                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9150                         result: Box::into_raw(Box::new(o)),
9151                 },
9152                 result_ok: true,
9153         }
9154 }
9155 #[no_mangle]
9156 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
9157 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9158         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9159                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9160                         err: Box::into_raw(Box::new(e)),
9161                 },
9162                 result_ok: false,
9163         }
9164 }
9165 /// Checks if the given object is currently in the success state
9166 #[no_mangle]
9167 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
9168         o.result_ok
9169 }
9170 #[no_mangle]
9171 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
9172 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
9173 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9174         fn drop(&mut self) {
9175                 if self.result_ok {
9176                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9177                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9178                         }
9179                 } else {
9180                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9181                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9182                         }
9183                 }
9184         }
9185 }
9186 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9187         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9188                 let contents = if o.result_ok {
9189                         let result = unsafe { o.contents.result };
9190                         unsafe { o.contents.result = core::ptr::null_mut() };
9191                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
9192                 } else {
9193                         let err = unsafe { o.contents.err };
9194                         unsafe { o.contents.err = core::ptr::null_mut(); }
9195                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
9196                 };
9197                 Self {
9198                         contents,
9199                         result_ok: o.result_ok,
9200                 }
9201         }
9202 }
9203 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9204         fn clone(&self) -> Self {
9205                 if self.result_ok {
9206                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9207                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9208                         } }
9209                 } else {
9210                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9211                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9212                         } }
9213                 }
9214         }
9215 }
9216 #[no_mangle]
9217 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
9218 /// but with all dynamically-allocated buffers duplicated in new buffers.
9219 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
9220 #[repr(C)]
9221 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
9222 /// This corresponds to std::vector in C++
9223 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9224         /// The elements in the array.
9225         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9226         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9227         /// The number of elements pointed to by `data`.
9228         pub datalen: usize
9229 }
9230 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9231         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
9232                 if self.datalen == 0 { return Vec::new(); }
9233                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9234                 self.data = core::ptr::null_mut();
9235                 self.datalen = 0;
9236                 ret
9237         }
9238         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
9239                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9240         }
9241 }
9242 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9243         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
9244                 let datalen = v.len();
9245                 let data = Box::into_raw(v.into_boxed_slice());
9246                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9247         }
9248 }
9249 #[no_mangle]
9250 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9251 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
9252 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9253         fn drop(&mut self) {
9254                 if self.datalen == 0 { return; }
9255                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9256         }
9257 }
9258 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9259         fn clone(&self) -> Self {
9260                 let mut res = Vec::new();
9261                 if self.datalen == 0 { return Self::from(res); }
9262                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9263                 Self::from(res)
9264         }
9265 }
9266 #[repr(C)]
9267 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
9268 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
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::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
9272         /// A pointer to the contents in the error state.
9273         /// Reading from this pointer when `result_ok` is set is undefined.
9274         pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
9275 }
9276 #[repr(C)]
9277 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
9278 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
9279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9280 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9281         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
9282         /// `err` or `result` depending on the state of `result_ok`.
9283         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
9284         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
9285         pub result_ok: bool,
9286 }
9287 #[no_mangle]
9288 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
9289 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9290         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9291                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9292                         result: Box::into_raw(Box::new(o)),
9293                 },
9294                 result_ok: true,
9295         }
9296 }
9297 #[no_mangle]
9298 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
9299 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9300         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9301                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9302                         err: Box::into_raw(Box::new(e)),
9303                 },
9304                 result_ok: false,
9305         }
9306 }
9307 /// Checks if the given object is currently in the success state
9308 #[no_mangle]
9309 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
9310         o.result_ok
9311 }
9312 #[no_mangle]
9313 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
9314 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
9315 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9316         fn drop(&mut self) {
9317                 if self.result_ok {
9318                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9319                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9320                         }
9321                 } else {
9322                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9323                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9324                         }
9325                 }
9326         }
9327 }
9328 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9329         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
9330                 let contents = if o.result_ok {
9331                         let result = unsafe { o.contents.result };
9332                         unsafe { o.contents.result = core::ptr::null_mut() };
9333                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
9334                 } else {
9335                         let err = unsafe { o.contents.err };
9336                         unsafe { o.contents.err = core::ptr::null_mut(); }
9337                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
9338                 };
9339                 Self {
9340                         contents,
9341                         result_ok: o.result_ok,
9342                 }
9343         }
9344 }
9345 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9346         fn clone(&self) -> Self {
9347                 if self.result_ok {
9348                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9349                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
9350                         } }
9351                 } else {
9352                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9353                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
9354                         } }
9355                 }
9356         }
9357 }
9358 #[no_mangle]
9359 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
9360 /// but with all dynamically-allocated buffers duplicated in new buffers.
9361 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
9362 #[repr(C)]
9363 /// A tuple of 2 elements. See the individual fields for the types contained.
9364 pub struct C2Tuple_ThirtyTwoBytesPublicKeyZ {
9365         /// The element at position 0
9366         pub a: crate::c_types::ThirtyTwoBytes,
9367         /// The element at position 1
9368         pub b: crate::c_types::PublicKey,
9369 }
9370 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)> for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9371         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)) -> Self {
9372                 Self {
9373                         a: tup.0,
9374                         b: tup.1,
9375                 }
9376         }
9377 }
9378 impl C2Tuple_ThirtyTwoBytesPublicKeyZ {
9379         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey) {
9380                 (self.a, self.b)
9381         }
9382 }
9383 impl Clone for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9384         fn clone(&self) -> Self {
9385                 Self {
9386                         a: Clone::clone(&self.a),
9387                         b: Clone::clone(&self.b),
9388                 }
9389         }
9390 }
9391 #[no_mangle]
9392 /// Creates a new tuple which has the same data as `orig`
9393 /// but with all dynamically-allocated buffers duplicated in new buffers.
9394 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig: &C2Tuple_ThirtyTwoBytesPublicKeyZ) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { Clone::clone(&orig) }
9395 /// Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements.
9396 #[no_mangle]
9397 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::PublicKey) -> C2Tuple_ThirtyTwoBytesPublicKeyZ {
9398         C2Tuple_ThirtyTwoBytesPublicKeyZ { a, b, }
9399 }
9400
9401 #[no_mangle]
9402 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ.
9403 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res: C2Tuple_ThirtyTwoBytesPublicKeyZ) { }
9404 #[repr(C)]
9405 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size.
9406 /// This corresponds to std::vector in C++
9407 pub struct CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9408         /// The elements in the array.
9409         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9410         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ,
9411         /// The number of elements pointed to by `data`.
9412         pub datalen: usize
9413 }
9414 impl CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9415         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ> {
9416                 if self.datalen == 0 { return Vec::new(); }
9417                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9418                 self.data = core::ptr::null_mut();
9419                 self.datalen = 0;
9420                 ret
9421         }
9422         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ] {
9423                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9424         }
9425 }
9426 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>> for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9427         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>) -> Self {
9428                 let datalen = v.len();
9429                 let data = Box::into_raw(v.into_boxed_slice());
9430                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9431         }
9432 }
9433 #[no_mangle]
9434 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9435 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ) { }
9436 impl Drop for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9437         fn drop(&mut self) {
9438                 if self.datalen == 0 { return; }
9439                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9440         }
9441 }
9442 impl Clone for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9443         fn clone(&self) -> Self {
9444                 let mut res = Vec::new();
9445                 if self.datalen == 0 { return Self::from(res); }
9446                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9447                 Self::from(res)
9448         }
9449 }
9450 #[repr(C)]
9451 #[derive(Clone)]
9452 /// An enum which can either contain a crate::c_types::Str or not
9453 pub enum COption_StrZ {
9454         /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
9455         Some(crate::c_types::Str),
9456         /// When we're in this state, this COption_StrZ contains nothing
9457         None
9458 }
9459 impl COption_StrZ {
9460         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9461                 if let Self::None = self { false } else { true }
9462         }
9463         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9464                 !self.is_some()
9465         }
9466         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
9467                 if let Self::Some(v) = self { v } else { unreachable!() }
9468         }
9469 }
9470 #[no_mangle]
9471 /// Constructs a new COption_StrZ containing a crate::c_types::Str
9472 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
9473         COption_StrZ::Some(o)
9474 }
9475 #[no_mangle]
9476 /// Constructs a new COption_StrZ containing nothing
9477 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
9478         COption_StrZ::None
9479 }
9480 #[no_mangle]
9481 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
9482 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
9483 #[no_mangle]
9484 /// Creates a new COption_StrZ which has the same data as `orig`
9485 /// but with all dynamically-allocated buffers duplicated in new buffers.
9486 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
9487 #[repr(C)]
9488 /// The contents of CResult_NoneBolt12SemanticErrorZ
9489 pub union CResult_NoneBolt12SemanticErrorZPtr {
9490         /// Note that this value is always NULL, as there are no contents in the OK variant
9491         pub result: *mut core::ffi::c_void,
9492         /// A pointer to the contents in the error state.
9493         /// Reading from this pointer when `result_ok` is set is undefined.
9494         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
9495 }
9496 #[repr(C)]
9497 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
9498 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
9499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9500 pub struct CResult_NoneBolt12SemanticErrorZ {
9501         /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
9502         /// `err` or `result` depending on the state of `result_ok`.
9503         pub contents: CResult_NoneBolt12SemanticErrorZPtr,
9504         /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
9505         pub result_ok: bool,
9506 }
9507 #[no_mangle]
9508 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
9509 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
9510         CResult_NoneBolt12SemanticErrorZ {
9511                 contents: CResult_NoneBolt12SemanticErrorZPtr {
9512                         result: core::ptr::null_mut(),
9513                 },
9514                 result_ok: true,
9515         }
9516 }
9517 #[no_mangle]
9518 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
9519 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
9520         CResult_NoneBolt12SemanticErrorZ {
9521                 contents: CResult_NoneBolt12SemanticErrorZPtr {
9522                         err: Box::into_raw(Box::new(e)),
9523                 },
9524                 result_ok: false,
9525         }
9526 }
9527 /// Checks if the given object is currently in the success state
9528 #[no_mangle]
9529 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
9530         o.result_ok
9531 }
9532 #[no_mangle]
9533 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
9534 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
9535 impl Drop for CResult_NoneBolt12SemanticErrorZ {
9536         fn drop(&mut self) {
9537                 if self.result_ok {
9538                 } else {
9539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9541                         }
9542                 }
9543         }
9544 }
9545 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
9546         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
9547                 let contents = if o.result_ok {
9548                         let _ = unsafe { Box::from_raw(o.contents.result) };
9549                         o.contents.result = core::ptr::null_mut();
9550                         CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
9551                 } else {
9552                         let err = unsafe { o.contents.err };
9553                         unsafe { o.contents.err = core::ptr::null_mut(); }
9554                         CResult_NoneBolt12SemanticErrorZPtr { err }
9555                 };
9556                 Self {
9557                         contents,
9558                         result_ok: o.result_ok,
9559                 }
9560         }
9561 }
9562 impl Clone for CResult_NoneBolt12SemanticErrorZ {
9563         fn clone(&self) -> Self {
9564                 if self.result_ok {
9565                         Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
9566                                 result: core::ptr::null_mut()
9567                         } }
9568                 } else {
9569                         Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
9570                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
9571                         } }
9572                 }
9573         }
9574 }
9575 #[no_mangle]
9576 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
9577 /// but with all dynamically-allocated buffers duplicated in new buffers.
9578 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
9579 #[repr(C)]
9580 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9581 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9582         /// A pointer to the contents in the success state.
9583         /// Reading from this pointer when `result_ok` is not set is undefined.
9584         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9585         /// Note that this value is always NULL, as there are no contents in the Err variant
9586         pub err: *mut core::ffi::c_void,
9587 }
9588 #[repr(C)]
9589 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9590 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9592 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9593         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9594         /// `err` or `result` depending on the state of `result_ok`.
9595         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9596         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9597         pub result_ok: bool,
9598 }
9599 #[no_mangle]
9600 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9601 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9602         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9603                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9604                         result: Box::into_raw(Box::new(o)),
9605                 },
9606                 result_ok: true,
9607         }
9608 }
9609 #[no_mangle]
9610 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9611 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9612         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9613                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9614                         err: core::ptr::null_mut(),
9615                 },
9616                 result_ok: false,
9617         }
9618 }
9619 /// Checks if the given object is currently in the success state
9620 #[no_mangle]
9621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9622         o.result_ok
9623 }
9624 #[no_mangle]
9625 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9626 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9627 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9628         fn drop(&mut self) {
9629                 if self.result_ok {
9630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9632                         }
9633                 } else {
9634                 }
9635         }
9636 }
9637 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9638         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9639                 let contents = if o.result_ok {
9640                         let result = unsafe { o.contents.result };
9641                         unsafe { o.contents.result = core::ptr::null_mut() };
9642                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9643                 } else {
9644                         let _ = unsafe { Box::from_raw(o.contents.err) };
9645                         o.contents.err = core::ptr::null_mut();
9646                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9647                 };
9648                 Self {
9649                         contents,
9650                         result_ok: o.result_ok,
9651                 }
9652         }
9653 }
9654 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9655         fn clone(&self) -> Self {
9656                 if self.result_ok {
9657                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9658                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9659                         } }
9660                 } else {
9661                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9662                                 err: core::ptr::null_mut()
9663                         } }
9664                 }
9665         }
9666 }
9667 #[no_mangle]
9668 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9669 /// but with all dynamically-allocated buffers duplicated in new buffers.
9670 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9671 #[repr(C)]
9672 #[derive(Clone)]
9673 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
9674 pub enum COption_OffersMessageZ {
9675         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
9676         Some(crate::lightning::onion_message::offers::OffersMessage),
9677         /// When we're in this state, this COption_OffersMessageZ contains nothing
9678         None
9679 }
9680 impl COption_OffersMessageZ {
9681         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9682                 if let Self::None = self { false } else { true }
9683         }
9684         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9685                 !self.is_some()
9686         }
9687         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
9688                 if let Self::Some(v) = self { v } else { unreachable!() }
9689         }
9690 }
9691 #[no_mangle]
9692 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
9693 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
9694         COption_OffersMessageZ::Some(o)
9695 }
9696 #[no_mangle]
9697 /// Constructs a new COption_OffersMessageZ containing nothing
9698 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
9699         COption_OffersMessageZ::None
9700 }
9701 #[no_mangle]
9702 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
9703 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
9704 #[no_mangle]
9705 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
9706 /// but with all dynamically-allocated buffers duplicated in new buffers.
9707 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
9708 #[repr(C)]
9709 /// A tuple of 3 elements. See the individual fields for the types contained.
9710 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
9711         /// The element at position 0
9712         pub a: crate::lightning::onion_message::offers::OffersMessage,
9713         /// The element at position 1
9714         pub b: crate::lightning::onion_message::messenger::Destination,
9715         /// The element at position 2
9716         pub c: crate::lightning::blinded_path::BlindedPath,
9717 }
9718 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
9719         fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
9720                 Self {
9721                         a: tup.0,
9722                         b: tup.1,
9723                         c: tup.2,
9724                 }
9725         }
9726 }
9727 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
9728         #[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) {
9729                 (self.a, self.b, self.c)
9730         }
9731 }
9732 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
9733         fn clone(&self) -> Self {
9734                 Self {
9735                         a: Clone::clone(&self.a),
9736                         b: Clone::clone(&self.b),
9737                         c: Clone::clone(&self.c),
9738                 }
9739         }
9740 }
9741 #[no_mangle]
9742 /// Creates a new tuple which has the same data as `orig`
9743 /// but with all dynamically-allocated buffers duplicated in new buffers.
9744 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
9745 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
9746 #[no_mangle]
9747 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 {
9748         C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
9749 }
9750
9751 #[no_mangle]
9752 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
9753 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
9754 #[repr(C)]
9755 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
9756 /// This corresponds to std::vector in C++
9757 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9758         /// The elements in the array.
9759         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9760         pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
9761         /// The number of elements pointed to by `data`.
9762         pub datalen: usize
9763 }
9764 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9765         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
9766                 if self.datalen == 0 { return Vec::new(); }
9767                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9768                 self.data = core::ptr::null_mut();
9769                 self.datalen = 0;
9770                 ret
9771         }
9772         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
9773                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9774         }
9775 }
9776 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9777         fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
9778                 let datalen = v.len();
9779                 let data = Box::into_raw(v.into_boxed_slice());
9780                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9781         }
9782 }
9783 #[no_mangle]
9784 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9785 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
9786 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9787         fn drop(&mut self) {
9788                 if self.datalen == 0 { return; }
9789                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9790         }
9791 }
9792 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9793         fn clone(&self) -> Self {
9794                 let mut res = Vec::new();
9795                 if self.datalen == 0 { return Self::from(res); }
9796                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9797                 Self::from(res)
9798         }
9799 }
9800 #[repr(C)]
9801 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9802 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9803         /// A pointer to the contents in the success state.
9804         /// Reading from this pointer when `result_ok` is not set is undefined.
9805         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9806         /// A pointer to the contents in the error state.
9807         /// Reading from this pointer when `result_ok` is set is undefined.
9808         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9809 }
9810 #[repr(C)]
9811 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9812 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9814 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9815         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9816         /// `err` or `result` depending on the state of `result_ok`.
9817         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9818         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9819         pub result_ok: bool,
9820 }
9821 #[no_mangle]
9822 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9823 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9824         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9825                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9826                         result: Box::into_raw(Box::new(o)),
9827                 },
9828                 result_ok: true,
9829         }
9830 }
9831 #[no_mangle]
9832 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9833 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9834         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9835                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9836                         err: Box::into_raw(Box::new(e)),
9837                 },
9838                 result_ok: false,
9839         }
9840 }
9841 /// Checks if the given object is currently in the success state
9842 #[no_mangle]
9843 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9844         o.result_ok
9845 }
9846 #[no_mangle]
9847 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9848 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9849 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9850         fn drop(&mut self) {
9851                 if self.result_ok {
9852                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9853                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9854                         }
9855                 } else {
9856                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9857                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9858                         }
9859                 }
9860         }
9861 }
9862 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9863         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9864                 let contents = if o.result_ok {
9865                         let result = unsafe { o.contents.result };
9866                         unsafe { o.contents.result = core::ptr::null_mut() };
9867                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9868                 } else {
9869                         let err = unsafe { o.contents.err };
9870                         unsafe { o.contents.err = core::ptr::null_mut(); }
9871                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9872                 };
9873                 Self {
9874                         contents,
9875                         result_ok: o.result_ok,
9876                 }
9877         }
9878 }
9879 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9880         fn clone(&self) -> Self {
9881                 if self.result_ok {
9882                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9883                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9884                         } }
9885                 } else {
9886                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9887                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9888                         } }
9889                 }
9890         }
9891 }
9892 #[no_mangle]
9893 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9894 /// but with all dynamically-allocated buffers duplicated in new buffers.
9895 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9896 #[repr(C)]
9897 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9898 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9899         /// A pointer to the contents in the success state.
9900         /// Reading from this pointer when `result_ok` is not set is undefined.
9901         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9902         /// A pointer to the contents in the error state.
9903         /// Reading from this pointer when `result_ok` is set is undefined.
9904         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9905 }
9906 #[repr(C)]
9907 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9908 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9910 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9911         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9912         /// `err` or `result` depending on the state of `result_ok`.
9913         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9914         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9915         pub result_ok: bool,
9916 }
9917 #[no_mangle]
9918 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9919 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9920         CResult_ChannelCounterpartyDecodeErrorZ {
9921                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9922                         result: Box::into_raw(Box::new(o)),
9923                 },
9924                 result_ok: true,
9925         }
9926 }
9927 #[no_mangle]
9928 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9929 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9930         CResult_ChannelCounterpartyDecodeErrorZ {
9931                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9932                         err: Box::into_raw(Box::new(e)),
9933                 },
9934                 result_ok: false,
9935         }
9936 }
9937 /// Checks if the given object is currently in the success state
9938 #[no_mangle]
9939 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9940         o.result_ok
9941 }
9942 #[no_mangle]
9943 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9944 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9945 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9946         fn drop(&mut self) {
9947                 if self.result_ok {
9948                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9949                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9950                         }
9951                 } else {
9952                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9953                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9954                         }
9955                 }
9956         }
9957 }
9958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9959         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9960                 let contents = if o.result_ok {
9961                         let result = unsafe { o.contents.result };
9962                         unsafe { o.contents.result = core::ptr::null_mut() };
9963                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9964                 } else {
9965                         let err = unsafe { o.contents.err };
9966                         unsafe { o.contents.err = core::ptr::null_mut(); }
9967                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9968                 };
9969                 Self {
9970                         contents,
9971                         result_ok: o.result_ok,
9972                 }
9973         }
9974 }
9975 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9976         fn clone(&self) -> Self {
9977                 if self.result_ok {
9978                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9979                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9980                         } }
9981                 } else {
9982                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9983                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9984                         } }
9985                 }
9986         }
9987 }
9988 #[no_mangle]
9989 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9990 /// but with all dynamically-allocated buffers duplicated in new buffers.
9991 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9992 #[repr(C)]
9993 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9994 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9995         /// A pointer to the contents in the success state.
9996         /// Reading from this pointer when `result_ok` is not set is undefined.
9997         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9998         /// A pointer to the contents in the error state.
9999         /// Reading from this pointer when `result_ok` is set is undefined.
10000         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10001 }
10002 #[repr(C)]
10003 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10004 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10006 pub struct CResult_ChannelDetailsDecodeErrorZ {
10007         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10008         /// `err` or `result` depending on the state of `result_ok`.
10009         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10010         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10011         pub result_ok: bool,
10012 }
10013 #[no_mangle]
10014 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10015 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10016         CResult_ChannelDetailsDecodeErrorZ {
10017                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10018                         result: Box::into_raw(Box::new(o)),
10019                 },
10020                 result_ok: true,
10021         }
10022 }
10023 #[no_mangle]
10024 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10025 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10026         CResult_ChannelDetailsDecodeErrorZ {
10027                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10028                         err: Box::into_raw(Box::new(e)),
10029                 },
10030                 result_ok: false,
10031         }
10032 }
10033 /// Checks if the given object is currently in the success state
10034 #[no_mangle]
10035 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10036         o.result_ok
10037 }
10038 #[no_mangle]
10039 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10040 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10041 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10042         fn drop(&mut self) {
10043                 if self.result_ok {
10044                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10045                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10046                         }
10047                 } else {
10048                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10049                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10050                         }
10051                 }
10052         }
10053 }
10054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10055         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10056                 let contents = if o.result_ok {
10057                         let result = unsafe { o.contents.result };
10058                         unsafe { o.contents.result = core::ptr::null_mut() };
10059                         CResult_ChannelDetailsDecodeErrorZPtr { result }
10060                 } else {
10061                         let err = unsafe { o.contents.err };
10062                         unsafe { o.contents.err = core::ptr::null_mut(); }
10063                         CResult_ChannelDetailsDecodeErrorZPtr { err }
10064                 };
10065                 Self {
10066                         contents,
10067                         result_ok: o.result_ok,
10068                 }
10069         }
10070 }
10071 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10072         fn clone(&self) -> Self {
10073                 if self.result_ok {
10074                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10075                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10076                         } }
10077                 } else {
10078                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10079                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10080                         } }
10081                 }
10082         }
10083 }
10084 #[no_mangle]
10085 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10086 /// but with all dynamically-allocated buffers duplicated in new buffers.
10087 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10088 #[repr(C)]
10089 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10090 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10091         /// A pointer to the contents in the success state.
10092         /// Reading from this pointer when `result_ok` is not set is undefined.
10093         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10094         /// A pointer to the contents in the error state.
10095         /// Reading from this pointer when `result_ok` is set is undefined.
10096         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10097 }
10098 #[repr(C)]
10099 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10100 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10102 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10103         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10104         /// `err` or `result` depending on the state of `result_ok`.
10105         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10106         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10107         pub result_ok: bool,
10108 }
10109 #[no_mangle]
10110 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10111 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10112         CResult_PhantomRouteHintsDecodeErrorZ {
10113                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10114                         result: Box::into_raw(Box::new(o)),
10115                 },
10116                 result_ok: true,
10117         }
10118 }
10119 #[no_mangle]
10120 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10121 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10122         CResult_PhantomRouteHintsDecodeErrorZ {
10123                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10124                         err: Box::into_raw(Box::new(e)),
10125                 },
10126                 result_ok: false,
10127         }
10128 }
10129 /// Checks if the given object is currently in the success state
10130 #[no_mangle]
10131 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10132         o.result_ok
10133 }
10134 #[no_mangle]
10135 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10136 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10137 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10138         fn drop(&mut self) {
10139                 if self.result_ok {
10140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10142                         }
10143                 } else {
10144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10146                         }
10147                 }
10148         }
10149 }
10150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10151         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10152                 let contents = if o.result_ok {
10153                         let result = unsafe { o.contents.result };
10154                         unsafe { o.contents.result = core::ptr::null_mut() };
10155                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10156                 } else {
10157                         let err = unsafe { o.contents.err };
10158                         unsafe { o.contents.err = core::ptr::null_mut(); }
10159                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10160                 };
10161                 Self {
10162                         contents,
10163                         result_ok: o.result_ok,
10164                 }
10165         }
10166 }
10167 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10168         fn clone(&self) -> Self {
10169                 if self.result_ok {
10170                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10171                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10172                         } }
10173                 } else {
10174                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10176                         } }
10177                 }
10178         }
10179 }
10180 #[no_mangle]
10181 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10182 /// but with all dynamically-allocated buffers duplicated in new buffers.
10183 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10184 #[repr(C)]
10185 /// The contents of CResult_BlindedForwardDecodeErrorZ
10186 pub union CResult_BlindedForwardDecodeErrorZPtr {
10187         /// A pointer to the contents in the success state.
10188         /// Reading from this pointer when `result_ok` is not set is undefined.
10189         pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
10190         /// A pointer to the contents in the error state.
10191         /// Reading from this pointer when `result_ok` is set is undefined.
10192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10193 }
10194 #[repr(C)]
10195 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
10196 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
10197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10198 pub struct CResult_BlindedForwardDecodeErrorZ {
10199         /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
10200         /// `err` or `result` depending on the state of `result_ok`.
10201         pub contents: CResult_BlindedForwardDecodeErrorZPtr,
10202         /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
10203         pub result_ok: bool,
10204 }
10205 #[no_mangle]
10206 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
10207 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
10208         CResult_BlindedForwardDecodeErrorZ {
10209                 contents: CResult_BlindedForwardDecodeErrorZPtr {
10210                         result: Box::into_raw(Box::new(o)),
10211                 },
10212                 result_ok: true,
10213         }
10214 }
10215 #[no_mangle]
10216 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
10217 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
10218         CResult_BlindedForwardDecodeErrorZ {
10219                 contents: CResult_BlindedForwardDecodeErrorZPtr {
10220                         err: Box::into_raw(Box::new(e)),
10221                 },
10222                 result_ok: false,
10223         }
10224 }
10225 /// Checks if the given object is currently in the success state
10226 #[no_mangle]
10227 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
10228         o.result_ok
10229 }
10230 #[no_mangle]
10231 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
10232 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
10233 impl Drop for CResult_BlindedForwardDecodeErrorZ {
10234         fn drop(&mut self) {
10235                 if self.result_ok {
10236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10238                         }
10239                 } else {
10240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10242                         }
10243                 }
10244         }
10245 }
10246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
10247         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
10248                 let contents = if o.result_ok {
10249                         let result = unsafe { o.contents.result };
10250                         unsafe { o.contents.result = core::ptr::null_mut() };
10251                         CResult_BlindedForwardDecodeErrorZPtr { result }
10252                 } else {
10253                         let err = unsafe { o.contents.err };
10254                         unsafe { o.contents.err = core::ptr::null_mut(); }
10255                         CResult_BlindedForwardDecodeErrorZPtr { err }
10256                 };
10257                 Self {
10258                         contents,
10259                         result_ok: o.result_ok,
10260                 }
10261         }
10262 }
10263 impl Clone for CResult_BlindedForwardDecodeErrorZ {
10264         fn clone(&self) -> Self {
10265                 if self.result_ok {
10266                         Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
10267                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
10268                         } }
10269                 } else {
10270                         Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
10271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10272                         } }
10273                 }
10274         }
10275 }
10276 #[no_mangle]
10277 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
10278 /// but with all dynamically-allocated buffers duplicated in new buffers.
10279 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
10280 #[repr(C)]
10281 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
10282 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
10283         /// A pointer to the contents in the success state.
10284         /// Reading from this pointer when `result_ok` is not set is undefined.
10285         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
10286         /// A pointer to the contents in the error state.
10287         /// Reading from this pointer when `result_ok` is set is undefined.
10288         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10289 }
10290 #[repr(C)]
10291 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
10292 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
10293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10294 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
10295         /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
10296         /// `err` or `result` depending on the state of `result_ok`.
10297         pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
10298         /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
10299         pub result_ok: bool,
10300 }
10301 #[no_mangle]
10302 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
10303 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
10304         CResult_PendingHTLCRoutingDecodeErrorZ {
10305                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10306                         result: Box::into_raw(Box::new(o)),
10307                 },
10308                 result_ok: true,
10309         }
10310 }
10311 #[no_mangle]
10312 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
10313 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
10314         CResult_PendingHTLCRoutingDecodeErrorZ {
10315                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10316                         err: Box::into_raw(Box::new(e)),
10317                 },
10318                 result_ok: false,
10319         }
10320 }
10321 /// Checks if the given object is currently in the success state
10322 #[no_mangle]
10323 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
10324         o.result_ok
10325 }
10326 #[no_mangle]
10327 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
10328 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
10329 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
10330         fn drop(&mut self) {
10331                 if self.result_ok {
10332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10334                         }
10335                 } else {
10336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10338                         }
10339                 }
10340         }
10341 }
10342 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
10343         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
10344                 let contents = if o.result_ok {
10345                         let result = unsafe { o.contents.result };
10346                         unsafe { o.contents.result = core::ptr::null_mut() };
10347                         CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
10348                 } else {
10349                         let err = unsafe { o.contents.err };
10350                         unsafe { o.contents.err = core::ptr::null_mut(); }
10351                         CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
10352                 };
10353                 Self {
10354                         contents,
10355                         result_ok: o.result_ok,
10356                 }
10357         }
10358 }
10359 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
10360         fn clone(&self) -> Self {
10361                 if self.result_ok {
10362                         Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10363                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
10364                         } }
10365                 } else {
10366                         Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10367                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10368                         } }
10369                 }
10370         }
10371 }
10372 #[no_mangle]
10373 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
10374 /// but with all dynamically-allocated buffers duplicated in new buffers.
10375 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
10376 #[repr(C)]
10377 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
10378 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
10379         /// A pointer to the contents in the success state.
10380         /// Reading from this pointer when `result_ok` is not set is undefined.
10381         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
10382         /// A pointer to the contents in the error state.
10383         /// Reading from this pointer when `result_ok` is set is undefined.
10384         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10385 }
10386 #[repr(C)]
10387 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
10388 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10390 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
10391         /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
10392         /// `err` or `result` depending on the state of `result_ok`.
10393         pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
10394         /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
10395         pub result_ok: bool,
10396 }
10397 #[no_mangle]
10398 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
10399 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
10400         CResult_PendingHTLCInfoDecodeErrorZ {
10401                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10402                         result: Box::into_raw(Box::new(o)),
10403                 },
10404                 result_ok: true,
10405         }
10406 }
10407 #[no_mangle]
10408 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
10409 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
10410         CResult_PendingHTLCInfoDecodeErrorZ {
10411                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10412                         err: Box::into_raw(Box::new(e)),
10413                 },
10414                 result_ok: false,
10415         }
10416 }
10417 /// Checks if the given object is currently in the success state
10418 #[no_mangle]
10419 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
10420         o.result_ok
10421 }
10422 #[no_mangle]
10423 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
10424 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
10425 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
10426         fn drop(&mut self) {
10427                 if self.result_ok {
10428                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10429                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10430                         }
10431                 } else {
10432                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10433                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10434                         }
10435                 }
10436         }
10437 }
10438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
10439         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10440                 let contents = if o.result_ok {
10441                         let result = unsafe { o.contents.result };
10442                         unsafe { o.contents.result = core::ptr::null_mut() };
10443                         CResult_PendingHTLCInfoDecodeErrorZPtr { result }
10444                 } else {
10445                         let err = unsafe { o.contents.err };
10446                         unsafe { o.contents.err = core::ptr::null_mut(); }
10447                         CResult_PendingHTLCInfoDecodeErrorZPtr { err }
10448                 };
10449                 Self {
10450                         contents,
10451                         result_ok: o.result_ok,
10452                 }
10453         }
10454 }
10455 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
10456         fn clone(&self) -> Self {
10457                 if self.result_ok {
10458                         Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10459                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
10460                         } }
10461                 } else {
10462                         Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10463                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10464                         } }
10465                 }
10466         }
10467 }
10468 #[no_mangle]
10469 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
10470 /// but with all dynamically-allocated buffers duplicated in new buffers.
10471 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
10472 #[repr(C)]
10473 /// The contents of CResult_BlindedFailureDecodeErrorZ
10474 pub union CResult_BlindedFailureDecodeErrorZPtr {
10475         /// A pointer to the contents in the success state.
10476         /// Reading from this pointer when `result_ok` is not set is undefined.
10477         pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
10478         /// A pointer to the contents in the error state.
10479         /// Reading from this pointer when `result_ok` is set is undefined.
10480         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10481 }
10482 #[repr(C)]
10483 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
10484 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10486 pub struct CResult_BlindedFailureDecodeErrorZ {
10487         /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
10488         /// `err` or `result` depending on the state of `result_ok`.
10489         pub contents: CResult_BlindedFailureDecodeErrorZPtr,
10490         /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
10491         pub result_ok: bool,
10492 }
10493 #[no_mangle]
10494 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
10495 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
10496         CResult_BlindedFailureDecodeErrorZ {
10497                 contents: CResult_BlindedFailureDecodeErrorZPtr {
10498                         result: Box::into_raw(Box::new(o)),
10499                 },
10500                 result_ok: true,
10501         }
10502 }
10503 #[no_mangle]
10504 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
10505 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
10506         CResult_BlindedFailureDecodeErrorZ {
10507                 contents: CResult_BlindedFailureDecodeErrorZPtr {
10508                         err: Box::into_raw(Box::new(e)),
10509                 },
10510                 result_ok: false,
10511         }
10512 }
10513 /// Checks if the given object is currently in the success state
10514 #[no_mangle]
10515 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
10516         o.result_ok
10517 }
10518 #[no_mangle]
10519 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
10520 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
10521 impl Drop for CResult_BlindedFailureDecodeErrorZ {
10522         fn drop(&mut self) {
10523                 if self.result_ok {
10524                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10525                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10526                         }
10527                 } else {
10528                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10529                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10530                         }
10531                 }
10532         }
10533 }
10534 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
10535         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10536                 let contents = if o.result_ok {
10537                         let result = unsafe { o.contents.result };
10538                         unsafe { o.contents.result = core::ptr::null_mut() };
10539                         CResult_BlindedFailureDecodeErrorZPtr { result }
10540                 } else {
10541                         let err = unsafe { o.contents.err };
10542                         unsafe { o.contents.err = core::ptr::null_mut(); }
10543                         CResult_BlindedFailureDecodeErrorZPtr { err }
10544                 };
10545                 Self {
10546                         contents,
10547                         result_ok: o.result_ok,
10548                 }
10549         }
10550 }
10551 impl Clone for CResult_BlindedFailureDecodeErrorZ {
10552         fn clone(&self) -> Self {
10553                 if self.result_ok {
10554                         Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
10555                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
10556                         } }
10557                 } else {
10558                         Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
10559                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10560                         } }
10561                 }
10562         }
10563 }
10564 #[no_mangle]
10565 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
10566 /// but with all dynamically-allocated buffers duplicated in new buffers.
10567 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
10568 #[repr(C)]
10569 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
10570 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
10571         /// A pointer to the contents in the success state.
10572         /// Reading from this pointer when `result_ok` is not set is undefined.
10573         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
10574         /// A pointer to the contents in the error state.
10575         /// Reading from this pointer when `result_ok` is set is undefined.
10576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10577 }
10578 #[repr(C)]
10579 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
10580 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
10581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10582 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
10583         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
10584         /// `err` or `result` depending on the state of `result_ok`.
10585         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
10586         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
10587         pub result_ok: bool,
10588 }
10589 #[no_mangle]
10590 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
10591 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
10592         CResult_ChannelShutdownStateDecodeErrorZ {
10593                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10594                         result: Box::into_raw(Box::new(o)),
10595                 },
10596                 result_ok: true,
10597         }
10598 }
10599 #[no_mangle]
10600 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
10601 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
10602         CResult_ChannelShutdownStateDecodeErrorZ {
10603                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10604                         err: Box::into_raw(Box::new(e)),
10605                 },
10606                 result_ok: false,
10607         }
10608 }
10609 /// Checks if the given object is currently in the success state
10610 #[no_mangle]
10611 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
10612         o.result_ok
10613 }
10614 #[no_mangle]
10615 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
10616 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
10617 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
10618         fn drop(&mut self) {
10619                 if self.result_ok {
10620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10622                         }
10623                 } else {
10624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10626                         }
10627                 }
10628         }
10629 }
10630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
10631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
10632                 let contents = if o.result_ok {
10633                         let result = unsafe { o.contents.result };
10634                         unsafe { o.contents.result = core::ptr::null_mut() };
10635                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
10636                 } else {
10637                         let err = unsafe { o.contents.err };
10638                         unsafe { o.contents.err = core::ptr::null_mut(); }
10639                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
10640                 };
10641                 Self {
10642                         contents,
10643                         result_ok: o.result_ok,
10644                 }
10645         }
10646 }
10647 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
10648         fn clone(&self) -> Self {
10649                 if self.result_ok {
10650                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10651                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
10652                         } }
10653                 } else {
10654                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10656                         } }
10657                 }
10658         }
10659 }
10660 #[no_mangle]
10661 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
10662 /// but with all dynamically-allocated buffers duplicated in new buffers.
10663 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
10664 #[repr(C)]
10665 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10666 /// This corresponds to std::vector in C++
10667 pub struct CVec_ChannelMonitorZ {
10668         /// The elements in the array.
10669         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10670         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10671         /// The number of elements pointed to by `data`.
10672         pub datalen: usize
10673 }
10674 impl CVec_ChannelMonitorZ {
10675         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10676                 if self.datalen == 0 { return Vec::new(); }
10677                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10678                 self.data = core::ptr::null_mut();
10679                 self.datalen = 0;
10680                 ret
10681         }
10682         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10683                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10684         }
10685 }
10686 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10687         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10688                 let datalen = v.len();
10689                 let data = Box::into_raw(v.into_boxed_slice());
10690                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10691         }
10692 }
10693 #[no_mangle]
10694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10695 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10696 impl Drop for CVec_ChannelMonitorZ {
10697         fn drop(&mut self) {
10698                 if self.datalen == 0 { return; }
10699                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10700         }
10701 }
10702 impl Clone for CVec_ChannelMonitorZ {
10703         fn clone(&self) -> Self {
10704                 let mut res = Vec::new();
10705                 if self.datalen == 0 { return Self::from(res); }
10706                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10707                 Self::from(res)
10708         }
10709 }
10710 #[repr(C)]
10711 /// A tuple of 2 elements. See the individual fields for the types contained.
10712 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
10713         /// The element at position 0
10714         pub a: crate::c_types::ThirtyTwoBytes,
10715         /// The element at position 1
10716         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10717 }
10718 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
10719         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10720                 Self {
10721                         a: tup.0,
10722                         b: tup.1,
10723                 }
10724         }
10725 }
10726 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
10727         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10728                 (self.a, self.b)
10729         }
10730 }
10731 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
10732 #[no_mangle]
10733 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
10734         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
10735 }
10736
10737 #[no_mangle]
10738 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
10739 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
10740 #[repr(C)]
10741 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
10742 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10743         /// A pointer to the contents in the success state.
10744         /// Reading from this pointer when `result_ok` is not set is undefined.
10745         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
10746         /// A pointer to the contents in the error state.
10747         /// Reading from this pointer when `result_ok` is set is undefined.
10748         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10749 }
10750 #[repr(C)]
10751 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10752 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10754 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10755         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
10756         /// `err` or `result` depending on the state of `result_ok`.
10757         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
10758         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
10759         pub result_ok: bool,
10760 }
10761 #[no_mangle]
10762 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
10763 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10764         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10765                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10766                         result: Box::into_raw(Box::new(o)),
10767                 },
10768                 result_ok: true,
10769         }
10770 }
10771 #[no_mangle]
10772 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
10773 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10774         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10775                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10776                         err: Box::into_raw(Box::new(e)),
10777                 },
10778                 result_ok: false,
10779         }
10780 }
10781 /// Checks if the given object is currently in the success state
10782 #[no_mangle]
10783 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
10784         o.result_ok
10785 }
10786 #[no_mangle]
10787 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
10788 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
10789 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10790         fn drop(&mut self) {
10791                 if self.result_ok {
10792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10794                         }
10795                 } else {
10796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10798                         }
10799                 }
10800         }
10801 }
10802 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10803         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10804                 let contents = if o.result_ok {
10805                         let result = unsafe { o.contents.result };
10806                         unsafe { o.contents.result = core::ptr::null_mut() };
10807                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
10808                 } else {
10809                         let err = unsafe { o.contents.err };
10810                         unsafe { o.contents.err = core::ptr::null_mut(); }
10811                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
10812                 };
10813                 Self {
10814                         contents,
10815                         result_ok: o.result_ok,
10816                 }
10817         }
10818 }
10819 #[repr(C)]
10820 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
10821 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10822         /// A pointer to the contents in the success state.
10823         /// Reading from this pointer when `result_ok` is not set is undefined.
10824         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
10825         /// A pointer to the contents in the error state.
10826         /// Reading from this pointer when `result_ok` is set is undefined.
10827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10828 }
10829 #[repr(C)]
10830 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
10831 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10833 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
10834         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
10835         /// `err` or `result` depending on the state of `result_ok`.
10836         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
10837         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
10838         pub result_ok: bool,
10839 }
10840 #[no_mangle]
10841 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
10842 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10843         CResult_MaxDustHTLCExposureDecodeErrorZ {
10844                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10845                         result: Box::into_raw(Box::new(o)),
10846                 },
10847                 result_ok: true,
10848         }
10849 }
10850 #[no_mangle]
10851 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
10852 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10853         CResult_MaxDustHTLCExposureDecodeErrorZ {
10854                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10855                         err: Box::into_raw(Box::new(e)),
10856                 },
10857                 result_ok: false,
10858         }
10859 }
10860 /// Checks if the given object is currently in the success state
10861 #[no_mangle]
10862 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
10863         o.result_ok
10864 }
10865 #[no_mangle]
10866 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
10867 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
10868 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
10869         fn drop(&mut self) {
10870                 if self.result_ok {
10871                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10872                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10873                         }
10874                 } else {
10875                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10876                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10877                         }
10878                 }
10879         }
10880 }
10881 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
10882         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10883                 let contents = if o.result_ok {
10884                         let result = unsafe { o.contents.result };
10885                         unsafe { o.contents.result = core::ptr::null_mut() };
10886                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
10887                 } else {
10888                         let err = unsafe { o.contents.err };
10889                         unsafe { o.contents.err = core::ptr::null_mut(); }
10890                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
10891                 };
10892                 Self {
10893                         contents,
10894                         result_ok: o.result_ok,
10895                 }
10896         }
10897 }
10898 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
10899         fn clone(&self) -> Self {
10900                 if self.result_ok {
10901                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10902                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
10903                         } }
10904                 } else {
10905                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10906                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10907                         } }
10908                 }
10909         }
10910 }
10911 #[no_mangle]
10912 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
10913 /// but with all dynamically-allocated buffers duplicated in new buffers.
10914 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
10915 #[repr(C)]
10916 /// The contents of CResult_ChannelConfigDecodeErrorZ
10917 pub union CResult_ChannelConfigDecodeErrorZPtr {
10918         /// A pointer to the contents in the success state.
10919         /// Reading from this pointer when `result_ok` is not set is undefined.
10920         pub result: *mut crate::lightning::util::config::ChannelConfig,
10921         /// A pointer to the contents in the error state.
10922         /// Reading from this pointer when `result_ok` is set is undefined.
10923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10924 }
10925 #[repr(C)]
10926 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10927 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10929 pub struct CResult_ChannelConfigDecodeErrorZ {
10930         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10931         /// `err` or `result` depending on the state of `result_ok`.
10932         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10933         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10934         pub result_ok: bool,
10935 }
10936 #[no_mangle]
10937 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10938 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10939         CResult_ChannelConfigDecodeErrorZ {
10940                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10941                         result: Box::into_raw(Box::new(o)),
10942                 },
10943                 result_ok: true,
10944         }
10945 }
10946 #[no_mangle]
10947 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10948 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10949         CResult_ChannelConfigDecodeErrorZ {
10950                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10951                         err: Box::into_raw(Box::new(e)),
10952                 },
10953                 result_ok: false,
10954         }
10955 }
10956 /// Checks if the given object is currently in the success state
10957 #[no_mangle]
10958 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10959         o.result_ok
10960 }
10961 #[no_mangle]
10962 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10963 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10964 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10965         fn drop(&mut self) {
10966                 if self.result_ok {
10967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10969                         }
10970                 } else {
10971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10973                         }
10974                 }
10975         }
10976 }
10977 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10978         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10979                 let contents = if o.result_ok {
10980                         let result = unsafe { o.contents.result };
10981                         unsafe { o.contents.result = core::ptr::null_mut() };
10982                         CResult_ChannelConfigDecodeErrorZPtr { result }
10983                 } else {
10984                         let err = unsafe { o.contents.err };
10985                         unsafe { o.contents.err = core::ptr::null_mut(); }
10986                         CResult_ChannelConfigDecodeErrorZPtr { err }
10987                 };
10988                 Self {
10989                         contents,
10990                         result_ok: o.result_ok,
10991                 }
10992         }
10993 }
10994 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10995         fn clone(&self) -> Self {
10996                 if self.result_ok {
10997                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10998                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10999                         } }
11000                 } else {
11001                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
11002                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11003                         } }
11004                 }
11005         }
11006 }
11007 #[no_mangle]
11008 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11009 /// but with all dynamically-allocated buffers duplicated in new buffers.
11010 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
11011 #[repr(C)]
11012 #[derive(Clone)]
11013 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
11014 pub enum COption_MaxDustHTLCExposureZ {
11015         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
11016         Some(crate::lightning::util::config::MaxDustHTLCExposure),
11017         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
11018         None
11019 }
11020 impl COption_MaxDustHTLCExposureZ {
11021         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11022                 if let Self::None = self { false } else { true }
11023         }
11024         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11025                 !self.is_some()
11026         }
11027         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
11028                 if let Self::Some(v) = self { v } else { unreachable!() }
11029         }
11030 }
11031 #[no_mangle]
11032 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
11033 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
11034         COption_MaxDustHTLCExposureZ::Some(o)
11035 }
11036 #[no_mangle]
11037 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
11038 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
11039         COption_MaxDustHTLCExposureZ::None
11040 }
11041 #[no_mangle]
11042 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
11043 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
11044 #[no_mangle]
11045 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
11046 /// but with all dynamically-allocated buffers duplicated in new buffers.
11047 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
11048 #[repr(C)]
11049 #[derive(Clone)]
11050 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
11051 pub enum COption_APIErrorZ {
11052         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
11053         Some(crate::lightning::util::errors::APIError),
11054         /// When we're in this state, this COption_APIErrorZ contains nothing
11055         None
11056 }
11057 impl COption_APIErrorZ {
11058         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11059                 if let Self::None = self { false } else { true }
11060         }
11061         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11062                 !self.is_some()
11063         }
11064         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
11065                 if let Self::Some(v) = self { v } else { unreachable!() }
11066         }
11067 }
11068 #[no_mangle]
11069 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
11070 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
11071         COption_APIErrorZ::Some(o)
11072 }
11073 #[no_mangle]
11074 /// Constructs a new COption_APIErrorZ containing nothing
11075 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
11076         COption_APIErrorZ::None
11077 }
11078 #[no_mangle]
11079 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
11080 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
11081 #[no_mangle]
11082 /// Creates a new COption_APIErrorZ which has the same data as `orig`
11083 /// but with all dynamically-allocated buffers duplicated in new buffers.
11084 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
11085 #[repr(C)]
11086 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
11087 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
11088         /// A pointer to the contents in the success state.
11089         /// Reading from this pointer when `result_ok` is not set is undefined.
11090         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
11091         /// A pointer to the contents in the error state.
11092         /// Reading from this pointer when `result_ok` is set is undefined.
11093         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11094 }
11095 #[repr(C)]
11096 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
11097 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11099 pub struct CResult_COption_APIErrorZDecodeErrorZ {
11100         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
11101         /// `err` or `result` depending on the state of `result_ok`.
11102         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
11103         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
11104         pub result_ok: bool,
11105 }
11106 #[no_mangle]
11107 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
11108 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
11109         CResult_COption_APIErrorZDecodeErrorZ {
11110                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11111                         result: Box::into_raw(Box::new(o)),
11112                 },
11113                 result_ok: true,
11114         }
11115 }
11116 #[no_mangle]
11117 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
11118 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
11119         CResult_COption_APIErrorZDecodeErrorZ {
11120                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11121                         err: Box::into_raw(Box::new(e)),
11122                 },
11123                 result_ok: false,
11124         }
11125 }
11126 /// Checks if the given object is currently in the success state
11127 #[no_mangle]
11128 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
11129         o.result_ok
11130 }
11131 #[no_mangle]
11132 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
11133 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
11134 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
11135         fn drop(&mut self) {
11136                 if self.result_ok {
11137                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11138                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11139                         }
11140                 } else {
11141                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11142                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11143                         }
11144                 }
11145         }
11146 }
11147 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
11148         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11149                 let contents = if o.result_ok {
11150                         let result = unsafe { o.contents.result };
11151                         unsafe { o.contents.result = core::ptr::null_mut() };
11152                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
11153                 } else {
11154                         let err = unsafe { o.contents.err };
11155                         unsafe { o.contents.err = core::ptr::null_mut(); }
11156                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
11157                 };
11158                 Self {
11159                         contents,
11160                         result_ok: o.result_ok,
11161                 }
11162         }
11163 }
11164 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
11165         fn clone(&self) -> Self {
11166                 if self.result_ok {
11167                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11168                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
11169                         } }
11170                 } else {
11171                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11172                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11173                         } }
11174                 }
11175         }
11176 }
11177 #[no_mangle]
11178 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
11179 /// but with all dynamically-allocated buffers duplicated in new buffers.
11180 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
11181 #[repr(C)]
11182 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11183 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11184         /// A pointer to the contents in the success state.
11185         /// Reading from this pointer when `result_ok` is not set is undefined.
11186         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11187         /// A pointer to the contents in the error state.
11188         /// Reading from this pointer when `result_ok` is set is undefined.
11189         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11190 }
11191 #[repr(C)]
11192 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11193 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11195 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11196         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11197         /// `err` or `result` depending on the state of `result_ok`.
11198         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11199         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11200         pub result_ok: bool,
11201 }
11202 #[no_mangle]
11203 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11204 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11205         CResult_ChannelMonitorUpdateDecodeErrorZ {
11206                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11207                         result: Box::into_raw(Box::new(o)),
11208                 },
11209                 result_ok: true,
11210         }
11211 }
11212 #[no_mangle]
11213 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11214 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11215         CResult_ChannelMonitorUpdateDecodeErrorZ {
11216                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11217                         err: Box::into_raw(Box::new(e)),
11218                 },
11219                 result_ok: false,
11220         }
11221 }
11222 /// Checks if the given object is currently in the success state
11223 #[no_mangle]
11224 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11225         o.result_ok
11226 }
11227 #[no_mangle]
11228 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11229 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11230 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11231         fn drop(&mut self) {
11232                 if self.result_ok {
11233                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11234                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11235                         }
11236                 } else {
11237                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11238                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11239                         }
11240                 }
11241         }
11242 }
11243 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11244         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11245                 let contents = if o.result_ok {
11246                         let result = unsafe { o.contents.result };
11247                         unsafe { o.contents.result = core::ptr::null_mut() };
11248                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11249                 } else {
11250                         let err = unsafe { o.contents.err };
11251                         unsafe { o.contents.err = core::ptr::null_mut(); }
11252                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11253                 };
11254                 Self {
11255                         contents,
11256                         result_ok: o.result_ok,
11257                 }
11258         }
11259 }
11260 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11261         fn clone(&self) -> Self {
11262                 if self.result_ok {
11263                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11264                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11265                         } }
11266                 } else {
11267                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11268                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11269                         } }
11270                 }
11271         }
11272 }
11273 #[no_mangle]
11274 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11275 /// but with all dynamically-allocated buffers duplicated in new buffers.
11276 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11277 #[repr(C)]
11278 #[derive(Clone)]
11279 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11280 pub enum COption_MonitorEventZ {
11281         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11282         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11283         /// When we're in this state, this COption_MonitorEventZ contains nothing
11284         None
11285 }
11286 impl COption_MonitorEventZ {
11287         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11288                 if let Self::None = self { false } else { true }
11289         }
11290         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11291                 !self.is_some()
11292         }
11293         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11294                 if let Self::Some(v) = self { v } else { unreachable!() }
11295         }
11296 }
11297 #[no_mangle]
11298 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11299 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11300         COption_MonitorEventZ::Some(o)
11301 }
11302 #[no_mangle]
11303 /// Constructs a new COption_MonitorEventZ containing nothing
11304 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11305         COption_MonitorEventZ::None
11306 }
11307 #[no_mangle]
11308 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11309 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11310 #[no_mangle]
11311 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11312 /// but with all dynamically-allocated buffers duplicated in new buffers.
11313 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11314 #[repr(C)]
11315 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11316 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11317         /// A pointer to the contents in the success state.
11318         /// Reading from this pointer when `result_ok` is not set is undefined.
11319         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11320         /// A pointer to the contents in the error state.
11321         /// Reading from this pointer when `result_ok` is set is undefined.
11322         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11323 }
11324 #[repr(C)]
11325 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11326 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11328 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11329         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11330         /// `err` or `result` depending on the state of `result_ok`.
11331         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11332         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11333         pub result_ok: bool,
11334 }
11335 #[no_mangle]
11336 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11337 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11338         CResult_COption_MonitorEventZDecodeErrorZ {
11339                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11340                         result: Box::into_raw(Box::new(o)),
11341                 },
11342                 result_ok: true,
11343         }
11344 }
11345 #[no_mangle]
11346 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11347 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11348         CResult_COption_MonitorEventZDecodeErrorZ {
11349                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11350                         err: Box::into_raw(Box::new(e)),
11351                 },
11352                 result_ok: false,
11353         }
11354 }
11355 /// Checks if the given object is currently in the success state
11356 #[no_mangle]
11357 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11358         o.result_ok
11359 }
11360 #[no_mangle]
11361 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11362 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11363 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11364         fn drop(&mut self) {
11365                 if self.result_ok {
11366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11368                         }
11369                 } else {
11370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11372                         }
11373                 }
11374         }
11375 }
11376 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11377         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11378                 let contents = if o.result_ok {
11379                         let result = unsafe { o.contents.result };
11380                         unsafe { o.contents.result = core::ptr::null_mut() };
11381                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11382                 } else {
11383                         let err = unsafe { o.contents.err };
11384                         unsafe { o.contents.err = core::ptr::null_mut(); }
11385                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11386                 };
11387                 Self {
11388                         contents,
11389                         result_ok: o.result_ok,
11390                 }
11391         }
11392 }
11393 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11394         fn clone(&self) -> Self {
11395                 if self.result_ok {
11396                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11397                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11398                         } }
11399                 } else {
11400                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11401                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11402                         } }
11403                 }
11404         }
11405 }
11406 #[no_mangle]
11407 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11408 /// but with all dynamically-allocated buffers duplicated in new buffers.
11409 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11410 #[repr(C)]
11411 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11412 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11413         /// A pointer to the contents in the success state.
11414         /// Reading from this pointer when `result_ok` is not set is undefined.
11415         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11416         /// A pointer to the contents in the error state.
11417         /// Reading from this pointer when `result_ok` is set is undefined.
11418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11419 }
11420 #[repr(C)]
11421 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11422 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11424 pub struct CResult_HTLCUpdateDecodeErrorZ {
11425         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11426         /// `err` or `result` depending on the state of `result_ok`.
11427         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11428         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11429         pub result_ok: bool,
11430 }
11431 #[no_mangle]
11432 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11433 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11434         CResult_HTLCUpdateDecodeErrorZ {
11435                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11436                         result: Box::into_raw(Box::new(o)),
11437                 },
11438                 result_ok: true,
11439         }
11440 }
11441 #[no_mangle]
11442 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11443 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11444         CResult_HTLCUpdateDecodeErrorZ {
11445                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11446                         err: Box::into_raw(Box::new(e)),
11447                 },
11448                 result_ok: false,
11449         }
11450 }
11451 /// Checks if the given object is currently in the success state
11452 #[no_mangle]
11453 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11454         o.result_ok
11455 }
11456 #[no_mangle]
11457 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11458 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11459 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11460         fn drop(&mut self) {
11461                 if self.result_ok {
11462                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11463                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11464                         }
11465                 } else {
11466                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11467                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11468                         }
11469                 }
11470         }
11471 }
11472 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11473         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11474                 let contents = if o.result_ok {
11475                         let result = unsafe { o.contents.result };
11476                         unsafe { o.contents.result = core::ptr::null_mut() };
11477                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11478                 } else {
11479                         let err = unsafe { o.contents.err };
11480                         unsafe { o.contents.err = core::ptr::null_mut(); }
11481                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11482                 };
11483                 Self {
11484                         contents,
11485                         result_ok: o.result_ok,
11486                 }
11487         }
11488 }
11489 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11490         fn clone(&self) -> Self {
11491                 if self.result_ok {
11492                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11493                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11494                         } }
11495                 } else {
11496                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11497                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11498                         } }
11499                 }
11500         }
11501 }
11502 #[no_mangle]
11503 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11504 /// but with all dynamically-allocated buffers duplicated in new buffers.
11505 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11506 #[repr(C)]
11507 /// A tuple of 2 elements. See the individual fields for the types contained.
11508 pub struct C2Tuple_OutPointCVec_u8ZZ {
11509         /// The element at position 0
11510         pub a: crate::lightning::chain::transaction::OutPoint,
11511         /// The element at position 1
11512         pub b: crate::c_types::derived::CVec_u8Z,
11513 }
11514 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
11515         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11516                 Self {
11517                         a: tup.0,
11518                         b: tup.1,
11519                 }
11520         }
11521 }
11522 impl C2Tuple_OutPointCVec_u8ZZ {
11523         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11524                 (self.a, self.b)
11525         }
11526 }
11527 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
11528         fn clone(&self) -> Self {
11529                 Self {
11530                         a: Clone::clone(&self.a),
11531                         b: Clone::clone(&self.b),
11532                 }
11533         }
11534 }
11535 #[no_mangle]
11536 /// Creates a new tuple which has the same data as `orig`
11537 /// but with all dynamically-allocated buffers duplicated in new buffers.
11538 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
11539 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
11540 #[no_mangle]
11541 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
11542         C2Tuple_OutPointCVec_u8ZZ { a, b, }
11543 }
11544
11545 #[no_mangle]
11546 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
11547 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
11548 #[repr(C)]
11549 /// A tuple of 2 elements. See the individual fields for the types contained.
11550 pub struct C2Tuple_u32CVec_u8ZZ {
11551         /// The element at position 0
11552         pub a: u32,
11553         /// The element at position 1
11554         pub b: crate::c_types::derived::CVec_u8Z,
11555 }
11556 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
11557         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11558                 Self {
11559                         a: tup.0,
11560                         b: tup.1,
11561                 }
11562         }
11563 }
11564 impl C2Tuple_u32CVec_u8ZZ {
11565         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11566                 (self.a, self.b)
11567         }
11568 }
11569 impl Clone for C2Tuple_u32CVec_u8ZZ {
11570         fn clone(&self) -> Self {
11571                 Self {
11572                         a: Clone::clone(&self.a),
11573                         b: Clone::clone(&self.b),
11574                 }
11575         }
11576 }
11577 #[no_mangle]
11578 /// Creates a new tuple which has the same data as `orig`
11579 /// but with all dynamically-allocated buffers duplicated in new buffers.
11580 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
11581 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
11582 #[no_mangle]
11583 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
11584         C2Tuple_u32CVec_u8ZZ { a, b, }
11585 }
11586
11587 #[no_mangle]
11588 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
11589 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
11590 #[repr(C)]
11591 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
11592 /// This corresponds to std::vector in C++
11593 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
11594         /// The elements in the array.
11595         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11596         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
11597         /// The number of elements pointed to by `data`.
11598         pub datalen: usize
11599 }
11600 impl CVec_C2Tuple_u32CVec_u8ZZZ {
11601         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
11602                 if self.datalen == 0 { return Vec::new(); }
11603                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11604                 self.data = core::ptr::null_mut();
11605                 self.datalen = 0;
11606                 ret
11607         }
11608         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
11609                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11610         }
11611 }
11612 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
11613         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
11614                 let datalen = v.len();
11615                 let data = Box::into_raw(v.into_boxed_slice());
11616                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11617         }
11618 }
11619 #[no_mangle]
11620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11621 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
11622 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
11623         fn drop(&mut self) {
11624                 if self.datalen == 0 { return; }
11625                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11626         }
11627 }
11628 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
11629         fn clone(&self) -> Self {
11630                 let mut res = Vec::new();
11631                 if self.datalen == 0 { return Self::from(res); }
11632                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11633                 Self::from(res)
11634         }
11635 }
11636 #[repr(C)]
11637 /// A tuple of 2 elements. See the individual fields for the types contained.
11638 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11639         /// The element at position 0
11640         pub a: crate::c_types::ThirtyTwoBytes,
11641         /// The element at position 1
11642         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
11643 }
11644 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11645         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
11646                 Self {
11647                         a: tup.0,
11648                         b: tup.1,
11649                 }
11650         }
11651 }
11652 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11653         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
11654                 (self.a, self.b)
11655         }
11656 }
11657 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11658         fn clone(&self) -> Self {
11659                 Self {
11660                         a: Clone::clone(&self.a),
11661                         b: Clone::clone(&self.b),
11662                 }
11663         }
11664 }
11665 #[no_mangle]
11666 /// Creates a new tuple which has the same data as `orig`
11667 /// but with all dynamically-allocated buffers duplicated in new buffers.
11668 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
11669 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
11670 #[no_mangle]
11671 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 {
11672         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
11673 }
11674
11675 #[no_mangle]
11676 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
11677 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
11678 #[repr(C)]
11679 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
11680 /// This corresponds to std::vector in C++
11681 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11682         /// The elements in the array.
11683         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11684         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
11685         /// The number of elements pointed to by `data`.
11686         pub datalen: usize
11687 }
11688 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11689         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
11690                 if self.datalen == 0 { return Vec::new(); }
11691                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11692                 self.data = core::ptr::null_mut();
11693                 self.datalen = 0;
11694                 ret
11695         }
11696         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
11697                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11698         }
11699 }
11700 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11701         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
11702                 let datalen = v.len();
11703                 let data = Box::into_raw(v.into_boxed_slice());
11704                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11705         }
11706 }
11707 #[no_mangle]
11708 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11709 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
11710 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11711         fn drop(&mut self) {
11712                 if self.datalen == 0 { return; }
11713                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11714         }
11715 }
11716 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11717         fn clone(&self) -> Self {
11718                 let mut res = Vec::new();
11719                 if self.datalen == 0 { return Self::from(res); }
11720                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11721                 Self::from(res)
11722         }
11723 }
11724 #[repr(C)]
11725 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
11726 /// This corresponds to std::vector in C++
11727 pub struct CVec_CommitmentTransactionZ {
11728         /// The elements in the array.
11729         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11730         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
11731         /// The number of elements pointed to by `data`.
11732         pub datalen: usize
11733 }
11734 impl CVec_CommitmentTransactionZ {
11735         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
11736                 if self.datalen == 0 { return Vec::new(); }
11737                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11738                 self.data = core::ptr::null_mut();
11739                 self.datalen = 0;
11740                 ret
11741         }
11742         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
11743                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11744         }
11745 }
11746 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
11747         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
11748                 let datalen = v.len();
11749                 let data = Box::into_raw(v.into_boxed_slice());
11750                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11751         }
11752 }
11753 #[no_mangle]
11754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11755 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
11756 impl Drop for CVec_CommitmentTransactionZ {
11757         fn drop(&mut self) {
11758                 if self.datalen == 0 { return; }
11759                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11760         }
11761 }
11762 impl Clone for CVec_CommitmentTransactionZ {
11763         fn clone(&self) -> Self {
11764                 let mut res = Vec::new();
11765                 if self.datalen == 0 { return Self::from(res); }
11766                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11767                 Self::from(res)
11768         }
11769 }
11770 #[repr(C)]
11771 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11772 /// This corresponds to std::vector in C++
11773 pub struct CVec_TransactionZ {
11774         /// The elements in the array.
11775         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11776         pub data: *mut crate::c_types::Transaction,
11777         /// The number of elements pointed to by `data`.
11778         pub datalen: usize
11779 }
11780 impl CVec_TransactionZ {
11781         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11782                 if self.datalen == 0 { return Vec::new(); }
11783                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11784                 self.data = core::ptr::null_mut();
11785                 self.datalen = 0;
11786                 ret
11787         }
11788         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11789                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11790         }
11791 }
11792 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11793         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11794                 let datalen = v.len();
11795                 let data = Box::into_raw(v.into_boxed_slice());
11796                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11797         }
11798 }
11799 #[no_mangle]
11800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11801 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11802 impl Drop for CVec_TransactionZ {
11803         fn drop(&mut self) {
11804                 if self.datalen == 0 { return; }
11805                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11806         }
11807 }
11808 impl Clone for CVec_TransactionZ {
11809         fn clone(&self) -> Self {
11810                 let mut res = Vec::new();
11811                 if self.datalen == 0 { return Self::from(res); }
11812                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11813                 Self::from(res)
11814         }
11815 }
11816 #[repr(C)]
11817 /// A tuple of 2 elements. See the individual fields for the types contained.
11818 pub struct C2Tuple_u32TxOutZ {
11819         /// The element at position 0
11820         pub a: u32,
11821         /// The element at position 1
11822         pub b: crate::c_types::TxOut,
11823 }
11824 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11825         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11826                 Self {
11827                         a: tup.0,
11828                         b: tup.1,
11829                 }
11830         }
11831 }
11832 impl C2Tuple_u32TxOutZ {
11833         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11834                 (self.a, self.b)
11835         }
11836 }
11837 impl Clone for C2Tuple_u32TxOutZ {
11838         fn clone(&self) -> Self {
11839                 Self {
11840                         a: Clone::clone(&self.a),
11841                         b: Clone::clone(&self.b),
11842                 }
11843         }
11844 }
11845 #[no_mangle]
11846 /// Creates a new tuple which has the same data as `orig`
11847 /// but with all dynamically-allocated buffers duplicated in new buffers.
11848 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11849 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11850 #[no_mangle]
11851 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11852         C2Tuple_u32TxOutZ { a, b, }
11853 }
11854
11855 #[no_mangle]
11856 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11857 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11858 #[repr(C)]
11859 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11860 /// This corresponds to std::vector in C++
11861 pub struct CVec_C2Tuple_u32TxOutZZ {
11862         /// The elements in the array.
11863         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11864         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11865         /// The number of elements pointed to by `data`.
11866         pub datalen: usize
11867 }
11868 impl CVec_C2Tuple_u32TxOutZZ {
11869         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11870                 if self.datalen == 0 { return Vec::new(); }
11871                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11872                 self.data = core::ptr::null_mut();
11873                 self.datalen = 0;
11874                 ret
11875         }
11876         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11877                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11878         }
11879 }
11880 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11881         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11882                 let datalen = v.len();
11883                 let data = Box::into_raw(v.into_boxed_slice());
11884                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11885         }
11886 }
11887 #[no_mangle]
11888 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11889 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11890 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11891         fn drop(&mut self) {
11892                 if self.datalen == 0 { return; }
11893                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11894         }
11895 }
11896 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11897         fn clone(&self) -> Self {
11898                 let mut res = Vec::new();
11899                 if self.datalen == 0 { return Self::from(res); }
11900                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11901                 Self::from(res)
11902         }
11903 }
11904 #[repr(C)]
11905 /// A tuple of 2 elements. See the individual fields for the types contained.
11906 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11907         /// The element at position 0
11908         pub a: crate::c_types::ThirtyTwoBytes,
11909         /// The element at position 1
11910         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11911 }
11912 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11913         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11914                 Self {
11915                         a: tup.0,
11916                         b: tup.1,
11917                 }
11918         }
11919 }
11920 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11921         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11922                 (self.a, self.b)
11923         }
11924 }
11925 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11926         fn clone(&self) -> Self {
11927                 Self {
11928                         a: Clone::clone(&self.a),
11929                         b: Clone::clone(&self.b),
11930                 }
11931         }
11932 }
11933 #[no_mangle]
11934 /// Creates a new tuple which has the same data as `orig`
11935 /// but with all dynamically-allocated buffers duplicated in new buffers.
11936 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11937 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11938 #[no_mangle]
11939 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 {
11940         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
11941 }
11942
11943 #[no_mangle]
11944 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
11945 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
11946 #[repr(C)]
11947 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11948 /// This corresponds to std::vector in C++
11949 pub struct CVec_TransactionOutputsZ {
11950         /// The elements in the array.
11951         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11952         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
11953         /// The number of elements pointed to by `data`.
11954         pub datalen: usize
11955 }
11956 impl CVec_TransactionOutputsZ {
11957         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11958                 if self.datalen == 0 { return Vec::new(); }
11959                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11960                 self.data = core::ptr::null_mut();
11961                 self.datalen = 0;
11962                 ret
11963         }
11964         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11965                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11966         }
11967 }
11968 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11969         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11970                 let datalen = v.len();
11971                 let data = Box::into_raw(v.into_boxed_slice());
11972                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11973         }
11974 }
11975 #[no_mangle]
11976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11977 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11978 impl Drop for CVec_TransactionOutputsZ {
11979         fn drop(&mut self) {
11980                 if self.datalen == 0 { return; }
11981                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11982         }
11983 }
11984 impl Clone for CVec_TransactionOutputsZ {
11985         fn clone(&self) -> Self {
11986                 let mut res = Vec::new();
11987                 if self.datalen == 0 { return Self::from(res); }
11988                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11989                 Self::from(res)
11990         }
11991 }
11992 #[repr(C)]
11993 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11994 /// This corresponds to std::vector in C++
11995 pub struct CVec_BalanceZ {
11996         /// The elements in the array.
11997         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11998         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11999         /// The number of elements pointed to by `data`.
12000         pub datalen: usize
12001 }
12002 impl CVec_BalanceZ {
12003         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12004                 if self.datalen == 0 { return Vec::new(); }
12005                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12006                 self.data = core::ptr::null_mut();
12007                 self.datalen = 0;
12008                 ret
12009         }
12010         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12011                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12012         }
12013 }
12014 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12015         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12016                 let datalen = v.len();
12017                 let data = Box::into_raw(v.into_boxed_slice());
12018                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12019         }
12020 }
12021 #[no_mangle]
12022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12023 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12024 impl Drop for CVec_BalanceZ {
12025         fn drop(&mut self) {
12026                 if self.datalen == 0 { return; }
12027                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12028         }
12029 }
12030 impl Clone for CVec_BalanceZ {
12031         fn clone(&self) -> Self {
12032                 let mut res = Vec::new();
12033                 if self.datalen == 0 { return Self::from(res); }
12034                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12035                 Self::from(res)
12036         }
12037 }
12038 #[repr(C)]
12039 /// A tuple of 2 elements. See the individual fields for the types contained.
12040 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12041         /// The element at position 0
12042         pub a: crate::c_types::ThirtyTwoBytes,
12043         /// The element at position 1
12044         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
12045 }
12046 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12047         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
12048                 Self {
12049                         a: tup.0,
12050                         b: tup.1,
12051                 }
12052         }
12053 }
12054 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12055         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
12056                 (self.a, self.b)
12057         }
12058 }
12059 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12060         fn clone(&self) -> Self {
12061                 Self {
12062                         a: Clone::clone(&self.a),
12063                         b: Clone::clone(&self.b),
12064                 }
12065         }
12066 }
12067 #[no_mangle]
12068 /// Creates a new tuple which has the same data as `orig`
12069 /// but with all dynamically-allocated buffers duplicated in new buffers.
12070 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
12071 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
12072 #[no_mangle]
12073 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12074         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
12075 }
12076
12077 #[no_mangle]
12078 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
12079 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
12080 #[repr(C)]
12081 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
12082 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12083         /// A pointer to the contents in the success state.
12084         /// Reading from this pointer when `result_ok` is not set is undefined.
12085         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12086         /// A pointer to the contents in the error state.
12087         /// Reading from this pointer when `result_ok` is set is undefined.
12088         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12089 }
12090 #[repr(C)]
12091 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12092 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12094 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12095         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
12096         /// `err` or `result` depending on the state of `result_ok`.
12097         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
12098         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
12099         pub result_ok: bool,
12100 }
12101 #[no_mangle]
12102 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
12103 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12104         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12105                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12106                         result: Box::into_raw(Box::new(o)),
12107                 },
12108                 result_ok: true,
12109         }
12110 }
12111 #[no_mangle]
12112 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
12113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12114         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12115                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12116                         err: Box::into_raw(Box::new(e)),
12117                 },
12118                 result_ok: false,
12119         }
12120 }
12121 /// Checks if the given object is currently in the success state
12122 #[no_mangle]
12123 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
12124         o.result_ok
12125 }
12126 #[no_mangle]
12127 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
12128 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
12129 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12130         fn drop(&mut self) {
12131                 if self.result_ok {
12132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12134                         }
12135                 } else {
12136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12138                         }
12139                 }
12140         }
12141 }
12142 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12143         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12144                 let contents = if o.result_ok {
12145                         let result = unsafe { o.contents.result };
12146                         unsafe { o.contents.result = core::ptr::null_mut() };
12147                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
12148                 } else {
12149                         let err = unsafe { o.contents.err };
12150                         unsafe { o.contents.err = core::ptr::null_mut(); }
12151                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
12152                 };
12153                 Self {
12154                         contents,
12155                         result_ok: o.result_ok,
12156                 }
12157         }
12158 }
12159 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12160         fn clone(&self) -> Self {
12161                 if self.result_ok {
12162                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12163                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12164                         } }
12165                 } else {
12166                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12167                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12168                         } }
12169                 }
12170         }
12171 }
12172 #[no_mangle]
12173 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
12174 /// but with all dynamically-allocated buffers duplicated in new buffers.
12175 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
12176 #[repr(C)]
12177 /// A tuple of 2 elements. See the individual fields for the types contained.
12178 pub struct C2Tuple_PublicKeyTypeZ {
12179         /// The element at position 0
12180         pub a: crate::c_types::PublicKey,
12181         /// The element at position 1
12182         pub b: crate::lightning::ln::wire::Type,
12183 }
12184 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12185         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12186                 Self {
12187                         a: tup.0,
12188                         b: tup.1,
12189                 }
12190         }
12191 }
12192 impl C2Tuple_PublicKeyTypeZ {
12193         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12194                 (self.a, self.b)
12195         }
12196 }
12197 impl Clone for C2Tuple_PublicKeyTypeZ {
12198         fn clone(&self) -> Self {
12199                 Self {
12200                         a: Clone::clone(&self.a),
12201                         b: Clone::clone(&self.b),
12202                 }
12203         }
12204 }
12205 #[no_mangle]
12206 /// Creates a new tuple which has the same data as `orig`
12207 /// but with all dynamically-allocated buffers duplicated in new buffers.
12208 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
12209 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12210 #[no_mangle]
12211 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12212         C2Tuple_PublicKeyTypeZ { a, b, }
12213 }
12214
12215 #[no_mangle]
12216 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12217 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12218 #[repr(C)]
12219 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12220 /// This corresponds to std::vector in C++
12221 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12222         /// The elements in the array.
12223         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12224         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12225         /// The number of elements pointed to by `data`.
12226         pub datalen: usize
12227 }
12228 impl CVec_C2Tuple_PublicKeyTypeZZ {
12229         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12230                 if self.datalen == 0 { return Vec::new(); }
12231                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12232                 self.data = core::ptr::null_mut();
12233                 self.datalen = 0;
12234                 ret
12235         }
12236         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12237                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12238         }
12239 }
12240 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12241         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12242                 let datalen = v.len();
12243                 let data = Box::into_raw(v.into_boxed_slice());
12244                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12245         }
12246 }
12247 #[no_mangle]
12248 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12249 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12250 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12251         fn drop(&mut self) {
12252                 if self.datalen == 0 { return; }
12253                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12254         }
12255 }
12256 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
12257         fn clone(&self) -> Self {
12258                 let mut res = Vec::new();
12259                 if self.datalen == 0 { return Self::from(res); }
12260                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12261                 Self::from(res)
12262         }
12263 }
12264 #[repr(C)]
12265 /// A tuple of 2 elements. See the individual fields for the types contained.
12266 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
12267         /// The element at position 0
12268         pub a: crate::c_types::PublicKey,
12269         /// The element at position 1
12270         pub b: crate::c_types::derived::CVec_SocketAddressZ,
12271 }
12272 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
12273         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
12274                 Self {
12275                         a: tup.0,
12276                         b: tup.1,
12277                 }
12278         }
12279 }
12280 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
12281         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
12282                 (self.a, self.b)
12283         }
12284 }
12285 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
12286         fn clone(&self) -> Self {
12287                 Self {
12288                         a: Clone::clone(&self.a),
12289                         b: Clone::clone(&self.b),
12290                 }
12291         }
12292 }
12293 #[no_mangle]
12294 /// Creates a new tuple which has the same data as `orig`
12295 /// but with all dynamically-allocated buffers duplicated in new buffers.
12296 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
12297 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
12298 #[no_mangle]
12299 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
12300         C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
12301 }
12302
12303 #[no_mangle]
12304 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
12305 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
12306 #[repr(C)]
12307 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
12308 /// This corresponds to std::vector in C++
12309 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12310         /// The elements in the array.
12311         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12312         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
12313         /// The number of elements pointed to by `data`.
12314         pub datalen: usize
12315 }
12316 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12317         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
12318                 if self.datalen == 0 { return Vec::new(); }
12319                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12320                 self.data = core::ptr::null_mut();
12321                 self.datalen = 0;
12322                 ret
12323         }
12324         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
12325                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12326         }
12327 }
12328 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12329         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
12330                 let datalen = v.len();
12331                 let data = Box::into_raw(v.into_boxed_slice());
12332                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12333         }
12334 }
12335 #[no_mangle]
12336 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12337 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
12338 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12339         fn drop(&mut self) {
12340                 if self.datalen == 0 { return; }
12341                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12342         }
12343 }
12344 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12345         fn clone(&self) -> Self {
12346                 let mut res = Vec::new();
12347                 if self.datalen == 0 { return Self::from(res); }
12348                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12349                 Self::from(res)
12350         }
12351 }
12352 #[repr(C)]
12353 #[derive(Clone)]
12354 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
12355 pub enum COption_OnionMessageContentsZ {
12356         /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
12357         Some(crate::lightning::onion_message::packet::OnionMessageContents),
12358         /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
12359         None
12360 }
12361 impl COption_OnionMessageContentsZ {
12362         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12363                 if let Self::None = self { false } else { true }
12364         }
12365         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12366                 !self.is_some()
12367         }
12368         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
12369                 if let Self::Some(v) = self { v } else { unreachable!() }
12370         }
12371 }
12372 #[no_mangle]
12373 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
12374 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
12375         COption_OnionMessageContentsZ::Some(o)
12376 }
12377 #[no_mangle]
12378 /// Constructs a new COption_OnionMessageContentsZ containing nothing
12379 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
12380         COption_OnionMessageContentsZ::None
12381 }
12382 #[no_mangle]
12383 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
12384 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
12385 #[no_mangle]
12386 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
12387 /// but with all dynamically-allocated buffers duplicated in new buffers.
12388 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
12389 #[repr(C)]
12390 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
12391 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12392         /// A pointer to the contents in the success state.
12393         /// Reading from this pointer when `result_ok` is not set is undefined.
12394         pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
12395         /// A pointer to the contents in the error state.
12396         /// Reading from this pointer when `result_ok` is set is undefined.
12397         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12398 }
12399 #[repr(C)]
12400 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12401 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12402 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12403 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
12404         /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
12405         /// `err` or `result` depending on the state of `result_ok`.
12406         pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
12407         /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
12408         pub result_ok: bool,
12409 }
12410 #[no_mangle]
12411 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
12412 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
12413         CResult_COption_OnionMessageContentsZDecodeErrorZ {
12414                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12415                         result: Box::into_raw(Box::new(o)),
12416                 },
12417                 result_ok: true,
12418         }
12419 }
12420 #[no_mangle]
12421 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
12422 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
12423         CResult_COption_OnionMessageContentsZDecodeErrorZ {
12424                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12425                         err: Box::into_raw(Box::new(e)),
12426                 },
12427                 result_ok: false,
12428         }
12429 }
12430 /// Checks if the given object is currently in the success state
12431 #[no_mangle]
12432 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
12433         o.result_ok
12434 }
12435 #[no_mangle]
12436 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
12437 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
12438 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12439         fn drop(&mut self) {
12440                 if self.result_ok {
12441                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12442                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12443                         }
12444                 } else {
12445                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12446                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12447                         }
12448                 }
12449         }
12450 }
12451 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12452         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12453                 let contents = if o.result_ok {
12454                         let result = unsafe { o.contents.result };
12455                         unsafe { o.contents.result = core::ptr::null_mut() };
12456                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
12457                 } else {
12458                         let err = unsafe { o.contents.err };
12459                         unsafe { o.contents.err = core::ptr::null_mut(); }
12460                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
12461                 };
12462                 Self {
12463                         contents,
12464                         result_ok: o.result_ok,
12465                 }
12466         }
12467 }
12468 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12469         fn clone(&self) -> Self {
12470                 if self.result_ok {
12471                         Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12472                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
12473                         } }
12474                 } else {
12475                         Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12476                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12477                         } }
12478                 }
12479         }
12480 }
12481 #[no_mangle]
12482 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
12483 /// but with all dynamically-allocated buffers duplicated in new buffers.
12484 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
12485 #[repr(C)]
12486 /// A tuple of 3 elements. See the individual fields for the types contained.
12487 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12488         /// The element at position 0
12489         pub a: crate::lightning::onion_message::packet::OnionMessageContents,
12490         /// The element at position 1
12491         pub b: crate::lightning::onion_message::messenger::Destination,
12492         /// The element at position 2
12493         pub c: crate::lightning::blinded_path::BlindedPath,
12494 }
12495 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12496         fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
12497                 Self {
12498                         a: tup.0,
12499                         b: tup.1,
12500                         c: tup.2,
12501                 }
12502         }
12503 }
12504 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12505         #[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) {
12506                 (self.a, self.b, self.c)
12507         }
12508 }
12509 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12510         fn clone(&self) -> Self {
12511                 Self {
12512                         a: Clone::clone(&self.a),
12513                         b: Clone::clone(&self.b),
12514                         c: Clone::clone(&self.c),
12515                 }
12516         }
12517 }
12518 #[no_mangle]
12519 /// Creates a new tuple which has the same data as `orig`
12520 /// but with all dynamically-allocated buffers duplicated in new buffers.
12521 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
12522 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
12523 #[no_mangle]
12524 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 {
12525         C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
12526 }
12527
12528 #[no_mangle]
12529 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
12530 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
12531 #[repr(C)]
12532 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
12533 /// This corresponds to std::vector in C++
12534 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12535         /// The elements in the array.
12536         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12537         pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
12538         /// The number of elements pointed to by `data`.
12539         pub datalen: usize
12540 }
12541 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12542         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
12543                 if self.datalen == 0 { return Vec::new(); }
12544                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12545                 self.data = core::ptr::null_mut();
12546                 self.datalen = 0;
12547                 ret
12548         }
12549         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
12550                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12551         }
12552 }
12553 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12554         fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
12555                 let datalen = v.len();
12556                 let data = Box::into_raw(v.into_boxed_slice());
12557                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12558         }
12559 }
12560 #[no_mangle]
12561 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12562 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
12563 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12564         fn drop(&mut self) {
12565                 if self.datalen == 0 { return; }
12566                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12567         }
12568 }
12569 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12570         fn clone(&self) -> Self {
12571                 let mut res = Vec::new();
12572                 if self.datalen == 0 { return Self::from(res); }
12573                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12574                 Self::from(res)
12575         }
12576 }
12577 #[repr(C)]
12578 #[derive(Clone)]
12579 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
12580 pub enum COption_TypeZ {
12581         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
12582         Some(crate::lightning::ln::wire::Type),
12583         /// When we're in this state, this COption_TypeZ contains nothing
12584         None
12585 }
12586 impl COption_TypeZ {
12587         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12588                 if let Self::None = self { false } else { true }
12589         }
12590         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12591                 !self.is_some()
12592         }
12593         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
12594                 if let Self::Some(v) = self { v } else { unreachable!() }
12595         }
12596 }
12597 #[no_mangle]
12598 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
12599 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
12600         COption_TypeZ::Some(o)
12601 }
12602 #[no_mangle]
12603 /// Constructs a new COption_TypeZ containing nothing
12604 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
12605         COption_TypeZ::None
12606 }
12607 #[no_mangle]
12608 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
12609 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
12610 #[no_mangle]
12611 /// Creates a new COption_TypeZ which has the same data as `orig`
12612 /// but with all dynamically-allocated buffers duplicated in new buffers.
12613 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
12614 #[repr(C)]
12615 /// The contents of CResult_COption_TypeZDecodeErrorZ
12616 pub union CResult_COption_TypeZDecodeErrorZPtr {
12617         /// A pointer to the contents in the success state.
12618         /// Reading from this pointer when `result_ok` is not set is undefined.
12619         pub result: *mut crate::c_types::derived::COption_TypeZ,
12620         /// A pointer to the contents in the error state.
12621         /// Reading from this pointer when `result_ok` is set is undefined.
12622         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12623 }
12624 #[repr(C)]
12625 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
12626 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12628 pub struct CResult_COption_TypeZDecodeErrorZ {
12629         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
12630         /// `err` or `result` depending on the state of `result_ok`.
12631         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
12632         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
12633         pub result_ok: bool,
12634 }
12635 #[no_mangle]
12636 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
12637 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
12638         CResult_COption_TypeZDecodeErrorZ {
12639                 contents: CResult_COption_TypeZDecodeErrorZPtr {
12640                         result: Box::into_raw(Box::new(o)),
12641                 },
12642                 result_ok: true,
12643         }
12644 }
12645 #[no_mangle]
12646 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
12647 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
12648         CResult_COption_TypeZDecodeErrorZ {
12649                 contents: CResult_COption_TypeZDecodeErrorZPtr {
12650                         err: Box::into_raw(Box::new(e)),
12651                 },
12652                 result_ok: false,
12653         }
12654 }
12655 /// Checks if the given object is currently in the success state
12656 #[no_mangle]
12657 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
12658         o.result_ok
12659 }
12660 #[no_mangle]
12661 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
12662 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
12663 impl Drop for CResult_COption_TypeZDecodeErrorZ {
12664         fn drop(&mut self) {
12665                 if self.result_ok {
12666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12668                         }
12669                 } else {
12670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12672                         }
12673                 }
12674         }
12675 }
12676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
12677         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12678                 let contents = if o.result_ok {
12679                         let result = unsafe { o.contents.result };
12680                         unsafe { o.contents.result = core::ptr::null_mut() };
12681                         CResult_COption_TypeZDecodeErrorZPtr { result }
12682                 } else {
12683                         let err = unsafe { o.contents.err };
12684                         unsafe { o.contents.err = core::ptr::null_mut(); }
12685                         CResult_COption_TypeZDecodeErrorZPtr { err }
12686                 };
12687                 Self {
12688                         contents,
12689                         result_ok: o.result_ok,
12690                 }
12691         }
12692 }
12693 impl Clone for CResult_COption_TypeZDecodeErrorZ {
12694         fn clone(&self) -> Self {
12695                 if self.result_ok {
12696                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
12697                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
12698                         } }
12699                 } else {
12700                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
12701                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12702                         } }
12703                 }
12704         }
12705 }
12706 #[no_mangle]
12707 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
12708 /// but with all dynamically-allocated buffers duplicated in new buffers.
12709 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
12710 #[repr(C)]
12711 #[derive(Clone)]
12712 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
12713 pub enum COption_SocketAddressZ {
12714         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
12715         Some(crate::lightning::ln::msgs::SocketAddress),
12716         /// When we're in this state, this COption_SocketAddressZ contains nothing
12717         None
12718 }
12719 impl COption_SocketAddressZ {
12720         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12721                 if let Self::None = self { false } else { true }
12722         }
12723         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12724                 !self.is_some()
12725         }
12726         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
12727                 if let Self::Some(v) = self { v } else { unreachable!() }
12728         }
12729 }
12730 #[no_mangle]
12731 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
12732 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
12733         COption_SocketAddressZ::Some(o)
12734 }
12735 #[no_mangle]
12736 /// Constructs a new COption_SocketAddressZ containing nothing
12737 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
12738         COption_SocketAddressZ::None
12739 }
12740 #[no_mangle]
12741 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
12742 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
12743 #[no_mangle]
12744 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
12745 /// but with all dynamically-allocated buffers duplicated in new buffers.
12746 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
12747 #[repr(C)]
12748 /// A tuple of 2 elements. See the individual fields for the types contained.
12749 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
12750         /// The element at position 0
12751         pub a: crate::c_types::PublicKey,
12752         /// The element at position 1
12753         pub b: crate::c_types::derived::COption_SocketAddressZ,
12754 }
12755 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
12756         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
12757                 Self {
12758                         a: tup.0,
12759                         b: tup.1,
12760                 }
12761         }
12762 }
12763 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
12764         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
12765                 (self.a, self.b)
12766         }
12767 }
12768 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
12769         fn clone(&self) -> Self {
12770                 Self {
12771                         a: Clone::clone(&self.a),
12772                         b: Clone::clone(&self.b),
12773                 }
12774         }
12775 }
12776 #[no_mangle]
12777 /// Creates a new tuple which has the same data as `orig`
12778 /// but with all dynamically-allocated buffers duplicated in new buffers.
12779 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
12780 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
12781 #[no_mangle]
12782 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
12783         C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
12784 }
12785
12786 #[no_mangle]
12787 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
12788 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
12789 #[repr(C)]
12790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
12791 /// This corresponds to std::vector in C++
12792 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12793         /// The elements in the array.
12794         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12795         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
12796         /// The number of elements pointed to by `data`.
12797         pub datalen: usize
12798 }
12799 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12800         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
12801                 if self.datalen == 0 { return Vec::new(); }
12802                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12803                 self.data = core::ptr::null_mut();
12804                 self.datalen = 0;
12805                 ret
12806         }
12807         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
12808                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12809         }
12810 }
12811 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12812         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
12813                 let datalen = v.len();
12814                 let data = Box::into_raw(v.into_boxed_slice());
12815                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12816         }
12817 }
12818 #[no_mangle]
12819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12820 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
12821 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12822         fn drop(&mut self) {
12823                 if self.datalen == 0 { return; }
12824                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12825         }
12826 }
12827 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12828         fn clone(&self) -> Self {
12829                 let mut res = Vec::new();
12830                 if self.datalen == 0 { return Self::from(res); }
12831                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12832                 Self::from(res)
12833         }
12834 }
12835 #[repr(C)]
12836 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12837 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12838         /// A pointer to the contents in the success state.
12839         /// Reading from this pointer when `result_ok` is not set is undefined.
12840         pub result: *mut crate::c_types::derived::CVec_u8Z,
12841         /// A pointer to the contents in the error state.
12842         /// Reading from this pointer when `result_ok` is set is undefined.
12843         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12844 }
12845 #[repr(C)]
12846 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12847 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12849 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12850         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12851         /// `err` or `result` depending on the state of `result_ok`.
12852         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12853         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12854         pub result_ok: bool,
12855 }
12856 #[no_mangle]
12857 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12858 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12859         CResult_CVec_u8ZPeerHandleErrorZ {
12860                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12861                         result: Box::into_raw(Box::new(o)),
12862                 },
12863                 result_ok: true,
12864         }
12865 }
12866 #[no_mangle]
12867 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12868 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12869         CResult_CVec_u8ZPeerHandleErrorZ {
12870                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12871                         err: Box::into_raw(Box::new(e)),
12872                 },
12873                 result_ok: false,
12874         }
12875 }
12876 /// Checks if the given object is currently in the success state
12877 #[no_mangle]
12878 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12879         o.result_ok
12880 }
12881 #[no_mangle]
12882 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12883 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12884 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12885         fn drop(&mut self) {
12886                 if self.result_ok {
12887                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12888                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12889                         }
12890                 } else {
12891                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12892                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12893                         }
12894                 }
12895         }
12896 }
12897 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12898         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12899                 let contents = if o.result_ok {
12900                         let result = unsafe { o.contents.result };
12901                         unsafe { o.contents.result = core::ptr::null_mut() };
12902                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12903                 } else {
12904                         let err = unsafe { o.contents.err };
12905                         unsafe { o.contents.err = core::ptr::null_mut(); }
12906                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12907                 };
12908                 Self {
12909                         contents,
12910                         result_ok: o.result_ok,
12911                 }
12912         }
12913 }
12914 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12915         fn clone(&self) -> Self {
12916                 if self.result_ok {
12917                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12918                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12919                         } }
12920                 } else {
12921                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12922                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12923                         } }
12924                 }
12925         }
12926 }
12927 #[no_mangle]
12928 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12929 /// but with all dynamically-allocated buffers duplicated in new buffers.
12930 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12931 #[repr(C)]
12932 /// The contents of CResult_NonePeerHandleErrorZ
12933 pub union CResult_NonePeerHandleErrorZPtr {
12934         /// Note that this value is always NULL, as there are no contents in the OK variant
12935         pub result: *mut core::ffi::c_void,
12936         /// A pointer to the contents in the error state.
12937         /// Reading from this pointer when `result_ok` is set is undefined.
12938         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12939 }
12940 #[repr(C)]
12941 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12942 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12944 pub struct CResult_NonePeerHandleErrorZ {
12945         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12946         /// `err` or `result` depending on the state of `result_ok`.
12947         pub contents: CResult_NonePeerHandleErrorZPtr,
12948         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12949         pub result_ok: bool,
12950 }
12951 #[no_mangle]
12952 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12953 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12954         CResult_NonePeerHandleErrorZ {
12955                 contents: CResult_NonePeerHandleErrorZPtr {
12956                         result: core::ptr::null_mut(),
12957                 },
12958                 result_ok: true,
12959         }
12960 }
12961 #[no_mangle]
12962 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12963 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12964         CResult_NonePeerHandleErrorZ {
12965                 contents: CResult_NonePeerHandleErrorZPtr {
12966                         err: Box::into_raw(Box::new(e)),
12967                 },
12968                 result_ok: false,
12969         }
12970 }
12971 /// Checks if the given object is currently in the success state
12972 #[no_mangle]
12973 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12974         o.result_ok
12975 }
12976 #[no_mangle]
12977 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12978 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12979 impl Drop for CResult_NonePeerHandleErrorZ {
12980         fn drop(&mut self) {
12981                 if self.result_ok {
12982                 } else {
12983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12985                         }
12986                 }
12987         }
12988 }
12989 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12990         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12991                 let contents = if o.result_ok {
12992                         let _ = unsafe { Box::from_raw(o.contents.result) };
12993                         o.contents.result = core::ptr::null_mut();
12994                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12995                 } else {
12996                         let err = unsafe { o.contents.err };
12997                         unsafe { o.contents.err = core::ptr::null_mut(); }
12998                         CResult_NonePeerHandleErrorZPtr { err }
12999                 };
13000                 Self {
13001                         contents,
13002                         result_ok: o.result_ok,
13003                 }
13004         }
13005 }
13006 impl Clone for CResult_NonePeerHandleErrorZ {
13007         fn clone(&self) -> Self {
13008                 if self.result_ok {
13009                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13010                                 result: core::ptr::null_mut()
13011                         } }
13012                 } else {
13013                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13014                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13015                         } }
13016                 }
13017         }
13018 }
13019 #[no_mangle]
13020 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13021 /// but with all dynamically-allocated buffers duplicated in new buffers.
13022 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13023 #[repr(C)]
13024 /// The contents of CResult_boolPeerHandleErrorZ
13025 pub union CResult_boolPeerHandleErrorZPtr {
13026         /// A pointer to the contents in the success state.
13027         /// Reading from this pointer when `result_ok` is not set is undefined.
13028         pub result: *mut bool,
13029         /// A pointer to the contents in the error state.
13030         /// Reading from this pointer when `result_ok` is set is undefined.
13031         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13032 }
13033 #[repr(C)]
13034 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13035 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13037 pub struct CResult_boolPeerHandleErrorZ {
13038         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13039         /// `err` or `result` depending on the state of `result_ok`.
13040         pub contents: CResult_boolPeerHandleErrorZPtr,
13041         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13042         pub result_ok: bool,
13043 }
13044 #[no_mangle]
13045 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13046 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13047         CResult_boolPeerHandleErrorZ {
13048                 contents: CResult_boolPeerHandleErrorZPtr {
13049                         result: Box::into_raw(Box::new(o)),
13050                 },
13051                 result_ok: true,
13052         }
13053 }
13054 #[no_mangle]
13055 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13056 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13057         CResult_boolPeerHandleErrorZ {
13058                 contents: CResult_boolPeerHandleErrorZPtr {
13059                         err: Box::into_raw(Box::new(e)),
13060                 },
13061                 result_ok: false,
13062         }
13063 }
13064 /// Checks if the given object is currently in the success state
13065 #[no_mangle]
13066 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
13067         o.result_ok
13068 }
13069 #[no_mangle]
13070 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
13071 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
13072 impl Drop for CResult_boolPeerHandleErrorZ {
13073         fn drop(&mut self) {
13074                 if self.result_ok {
13075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13077                         }
13078                 } else {
13079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13081                         }
13082                 }
13083         }
13084 }
13085 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
13086         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13087                 let contents = if o.result_ok {
13088                         let result = unsafe { o.contents.result };
13089                         unsafe { o.contents.result = core::ptr::null_mut() };
13090                         CResult_boolPeerHandleErrorZPtr { result }
13091                 } else {
13092                         let err = unsafe { o.contents.err };
13093                         unsafe { o.contents.err = core::ptr::null_mut(); }
13094                         CResult_boolPeerHandleErrorZPtr { err }
13095                 };
13096                 Self {
13097                         contents,
13098                         result_ok: o.result_ok,
13099                 }
13100         }
13101 }
13102 impl Clone for CResult_boolPeerHandleErrorZ {
13103         fn clone(&self) -> Self {
13104                 if self.result_ok {
13105                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
13106                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
13107                         } }
13108                 } else {
13109                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
13110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13111                         } }
13112                 }
13113         }
13114 }
13115 #[no_mangle]
13116 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
13117 /// but with all dynamically-allocated buffers duplicated in new buffers.
13118 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
13119 #[repr(C)]
13120 /// The contents of CResult_u32GraphSyncErrorZ
13121 pub union CResult_u32GraphSyncErrorZPtr {
13122         /// A pointer to the contents in the success state.
13123         /// Reading from this pointer when `result_ok` is not set is undefined.
13124         pub result: *mut u32,
13125         /// A pointer to the contents in the error state.
13126         /// Reading from this pointer when `result_ok` is set is undefined.
13127         pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
13128 }
13129 #[repr(C)]
13130 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13131 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
13132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13133 pub struct CResult_u32GraphSyncErrorZ {
13134         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13135         /// `err` or `result` depending on the state of `result_ok`.
13136         pub contents: CResult_u32GraphSyncErrorZPtr,
13137         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13138         pub result_ok: bool,
13139 }
13140 #[no_mangle]
13141 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13142 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13143         CResult_u32GraphSyncErrorZ {
13144                 contents: CResult_u32GraphSyncErrorZPtr {
13145                         result: Box::into_raw(Box::new(o)),
13146                 },
13147                 result_ok: true,
13148         }
13149 }
13150 #[no_mangle]
13151 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13152 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13153         CResult_u32GraphSyncErrorZ {
13154                 contents: CResult_u32GraphSyncErrorZPtr {
13155                         err: Box::into_raw(Box::new(e)),
13156                 },
13157                 result_ok: false,
13158         }
13159 }
13160 /// Checks if the given object is currently in the success state
13161 #[no_mangle]
13162 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13163         o.result_ok
13164 }
13165 #[no_mangle]
13166 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13167 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13168 impl Drop for CResult_u32GraphSyncErrorZ {
13169         fn drop(&mut self) {
13170                 if self.result_ok {
13171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13173                         }
13174                 } else {
13175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13177                         }
13178                 }
13179         }
13180 }
13181 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13182         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
13183                 let contents = if o.result_ok {
13184                         let result = unsafe { o.contents.result };
13185                         unsafe { o.contents.result = core::ptr::null_mut() };
13186                         CResult_u32GraphSyncErrorZPtr { result }
13187                 } else {
13188                         let err = unsafe { o.contents.err };
13189                         unsafe { o.contents.err = core::ptr::null_mut(); }
13190                         CResult_u32GraphSyncErrorZPtr { err }
13191                 };
13192                 Self {
13193                         contents,
13194                         result_ok: o.result_ok,
13195                 }
13196         }
13197 }
13198 #[repr(C)]
13199 /// The contents of CResult_CVec_u8ZIOErrorZ
13200 pub union CResult_CVec_u8ZIOErrorZPtr {
13201         /// A pointer to the contents in the success state.
13202         /// Reading from this pointer when `result_ok` is not set is undefined.
13203         pub result: *mut crate::c_types::derived::CVec_u8Z,
13204         /// A pointer to the contents in the error state.
13205         /// Reading from this pointer when `result_ok` is set is undefined.
13206         pub err: *mut crate::c_types::IOError,
13207 }
13208 #[repr(C)]
13209 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
13210 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
13211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13212 pub struct CResult_CVec_u8ZIOErrorZ {
13213         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
13214         /// `err` or `result` depending on the state of `result_ok`.
13215         pub contents: CResult_CVec_u8ZIOErrorZPtr,
13216         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
13217         pub result_ok: bool,
13218 }
13219 #[no_mangle]
13220 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
13221 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
13222         CResult_CVec_u8ZIOErrorZ {
13223                 contents: CResult_CVec_u8ZIOErrorZPtr {
13224                         result: Box::into_raw(Box::new(o)),
13225                 },
13226                 result_ok: true,
13227         }
13228 }
13229 #[no_mangle]
13230 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
13231 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
13232         CResult_CVec_u8ZIOErrorZ {
13233                 contents: CResult_CVec_u8ZIOErrorZPtr {
13234                         err: Box::into_raw(Box::new(e)),
13235                 },
13236                 result_ok: false,
13237         }
13238 }
13239 /// Checks if the given object is currently in the success state
13240 #[no_mangle]
13241 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
13242         o.result_ok
13243 }
13244 #[no_mangle]
13245 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
13246 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
13247 impl Drop for CResult_CVec_u8ZIOErrorZ {
13248         fn drop(&mut self) {
13249                 if self.result_ok {
13250                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13251                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13252                         }
13253                 } else {
13254                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13255                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13256                         }
13257                 }
13258         }
13259 }
13260 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
13261         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
13262                 let contents = if o.result_ok {
13263                         let result = unsafe { o.contents.result };
13264                         unsafe { o.contents.result = core::ptr::null_mut() };
13265                         CResult_CVec_u8ZIOErrorZPtr { result }
13266                 } else {
13267                         let err = unsafe { o.contents.err };
13268                         unsafe { o.contents.err = core::ptr::null_mut(); }
13269                         CResult_CVec_u8ZIOErrorZPtr { err }
13270                 };
13271                 Self {
13272                         contents,
13273                         result_ok: o.result_ok,
13274                 }
13275         }
13276 }
13277 impl Clone for CResult_CVec_u8ZIOErrorZ {
13278         fn clone(&self) -> Self {
13279                 if self.result_ok {
13280                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
13281                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13282                         } }
13283                 } else {
13284                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
13285                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13286                         } }
13287                 }
13288         }
13289 }
13290 #[no_mangle]
13291 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
13292 /// but with all dynamically-allocated buffers duplicated in new buffers.
13293 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
13294 #[repr(C)]
13295 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
13296 /// This corresponds to std::vector in C++
13297 pub struct CVec_StrZ {
13298         /// The elements in the array.
13299         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13300         pub data: *mut crate::c_types::Str,
13301         /// The number of elements pointed to by `data`.
13302         pub datalen: usize
13303 }
13304 impl CVec_StrZ {
13305         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
13306                 if self.datalen == 0 { return Vec::new(); }
13307                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13308                 self.data = core::ptr::null_mut();
13309                 self.datalen = 0;
13310                 ret
13311         }
13312         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
13313                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13314         }
13315 }
13316 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
13317         fn from(v: Vec<crate::c_types::Str>) -> Self {
13318                 let datalen = v.len();
13319                 let data = Box::into_raw(v.into_boxed_slice());
13320                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13321         }
13322 }
13323 #[no_mangle]
13324 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13325 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
13326 impl Drop for CVec_StrZ {
13327         fn drop(&mut self) {
13328                 if self.datalen == 0 { return; }
13329                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13330         }
13331 }
13332 impl Clone for CVec_StrZ {
13333         fn clone(&self) -> Self {
13334                 let mut res = Vec::new();
13335                 if self.datalen == 0 { return Self::from(res); }
13336                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13337                 Self::from(res)
13338         }
13339 }
13340 #[repr(C)]
13341 /// The contents of CResult_CVec_StrZIOErrorZ
13342 pub union CResult_CVec_StrZIOErrorZPtr {
13343         /// A pointer to the contents in the success state.
13344         /// Reading from this pointer when `result_ok` is not set is undefined.
13345         pub result: *mut crate::c_types::derived::CVec_StrZ,
13346         /// A pointer to the contents in the error state.
13347         /// Reading from this pointer when `result_ok` is set is undefined.
13348         pub err: *mut crate::c_types::IOError,
13349 }
13350 #[repr(C)]
13351 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
13352 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
13353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13354 pub struct CResult_CVec_StrZIOErrorZ {
13355         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
13356         /// `err` or `result` depending on the state of `result_ok`.
13357         pub contents: CResult_CVec_StrZIOErrorZPtr,
13358         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
13359         pub result_ok: bool,
13360 }
13361 #[no_mangle]
13362 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
13363 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
13364         CResult_CVec_StrZIOErrorZ {
13365                 contents: CResult_CVec_StrZIOErrorZPtr {
13366                         result: Box::into_raw(Box::new(o)),
13367                 },
13368                 result_ok: true,
13369         }
13370 }
13371 #[no_mangle]
13372 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
13373 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
13374         CResult_CVec_StrZIOErrorZ {
13375                 contents: CResult_CVec_StrZIOErrorZPtr {
13376                         err: Box::into_raw(Box::new(e)),
13377                 },
13378                 result_ok: false,
13379         }
13380 }
13381 /// Checks if the given object is currently in the success state
13382 #[no_mangle]
13383 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
13384         o.result_ok
13385 }
13386 #[no_mangle]
13387 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
13388 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
13389 impl Drop for CResult_CVec_StrZIOErrorZ {
13390         fn drop(&mut self) {
13391                 if self.result_ok {
13392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13394                         }
13395                 } else {
13396                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13397                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13398                         }
13399                 }
13400         }
13401 }
13402 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
13403         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
13404                 let contents = if o.result_ok {
13405                         let result = unsafe { o.contents.result };
13406                         unsafe { o.contents.result = core::ptr::null_mut() };
13407                         CResult_CVec_StrZIOErrorZPtr { result }
13408                 } else {
13409                         let err = unsafe { o.contents.err };
13410                         unsafe { o.contents.err = core::ptr::null_mut(); }
13411                         CResult_CVec_StrZIOErrorZPtr { err }
13412                 };
13413                 Self {
13414                         contents,
13415                         result_ok: o.result_ok,
13416                 }
13417         }
13418 }
13419 impl Clone for CResult_CVec_StrZIOErrorZ {
13420         fn clone(&self) -> Self {
13421                 if self.result_ok {
13422                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
13423                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
13424                         } }
13425                 } else {
13426                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
13427                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13428                         } }
13429                 }
13430         }
13431 }
13432 #[no_mangle]
13433 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
13434 /// but with all dynamically-allocated buffers duplicated in new buffers.
13435 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
13436 #[repr(C)]
13437 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
13438 /// This corresponds to std::vector in C++
13439 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13440         /// The elements in the array.
13441         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13442         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13443         /// The number of elements pointed to by `data`.
13444         pub datalen: usize
13445 }
13446 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13447         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
13448                 if self.datalen == 0 { return Vec::new(); }
13449                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13450                 self.data = core::ptr::null_mut();
13451                 self.datalen = 0;
13452                 ret
13453         }
13454         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
13455                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13456         }
13457 }
13458 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13459         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
13460                 let datalen = v.len();
13461                 let data = Box::into_raw(v.into_boxed_slice());
13462                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13463         }
13464 }
13465 #[no_mangle]
13466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13467 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
13468 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13469         fn drop(&mut self) {
13470                 if self.datalen == 0 { return; }
13471                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13472         }
13473 }
13474 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13475         fn clone(&self) -> Self {
13476                 let mut res = Vec::new();
13477                 if self.datalen == 0 { return Self::from(res); }
13478                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13479                 Self::from(res)
13480         }
13481 }
13482 #[repr(C)]
13483 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
13484 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13485         /// A pointer to the contents in the success state.
13486         /// Reading from this pointer when `result_ok` is not set is undefined.
13487         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
13488         /// A pointer to the contents in the error state.
13489         /// Reading from this pointer when `result_ok` is set is undefined.
13490         pub err: *mut crate::c_types::IOError,
13491 }
13492 #[repr(C)]
13493 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
13494 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
13495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13496 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13497         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
13498         /// `err` or `result` depending on the state of `result_ok`.
13499         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
13500         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
13501         pub result_ok: bool,
13502 }
13503 #[no_mangle]
13504 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
13505 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13506         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13507                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13508                         result: Box::into_raw(Box::new(o)),
13509                 },
13510                 result_ok: true,
13511         }
13512 }
13513 #[no_mangle]
13514 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
13515 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13516         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13517                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13518                         err: Box::into_raw(Box::new(e)),
13519                 },
13520                 result_ok: false,
13521         }
13522 }
13523 /// Checks if the given object is currently in the success state
13524 #[no_mangle]
13525 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
13526         o.result_ok
13527 }
13528 #[no_mangle]
13529 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
13530 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
13531 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13532         fn drop(&mut self) {
13533                 if self.result_ok {
13534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13536                         }
13537                 } else {
13538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13540                         }
13541                 }
13542         }
13543 }
13544 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13545         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
13546                 let contents = if o.result_ok {
13547                         let result = unsafe { o.contents.result };
13548                         unsafe { o.contents.result = core::ptr::null_mut() };
13549                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
13550                 } else {
13551                         let err = unsafe { o.contents.err };
13552                         unsafe { o.contents.err = core::ptr::null_mut(); }
13553                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
13554                 };
13555                 Self {
13556                         contents,
13557                         result_ok: o.result_ok,
13558                 }
13559         }
13560 }
13561 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13562         fn clone(&self) -> Self {
13563                 if self.result_ok {
13564                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13565                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
13566                         } }
13567                 } else {
13568                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13569                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13570                         } }
13571                 }
13572         }
13573 }
13574 #[no_mangle]
13575 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
13576 /// but with all dynamically-allocated buffers duplicated in new buffers.
13577 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
13578 #[repr(C)]
13579 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
13580 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13581         /// A pointer to the contents in the success state.
13582         /// Reading from this pointer when `result_ok` is not set is undefined.
13583         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13584         /// A pointer to the contents in the error state.
13585         /// Reading from this pointer when `result_ok` is set is undefined.
13586         pub err: *mut crate::c_types::IOError,
13587 }
13588 #[repr(C)]
13589 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
13590 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
13591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13592 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13593         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
13594         /// `err` or `result` depending on the state of `result_ok`.
13595         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
13596         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
13597         pub result_ok: bool,
13598 }
13599 #[no_mangle]
13600 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
13601 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13602         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13603                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13604                         result: Box::into_raw(Box::new(o)),
13605                 },
13606                 result_ok: true,
13607         }
13608 }
13609 #[no_mangle]
13610 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
13611 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13612         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13613                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13614                         err: Box::into_raw(Box::new(e)),
13615                 },
13616                 result_ok: false,
13617         }
13618 }
13619 /// Checks if the given object is currently in the success state
13620 #[no_mangle]
13621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
13622         o.result_ok
13623 }
13624 #[no_mangle]
13625 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
13626 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
13627 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13628         fn drop(&mut self) {
13629                 if self.result_ok {
13630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13632                         }
13633                 } else {
13634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13636                         }
13637                 }
13638         }
13639 }
13640 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13641         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
13642                 let contents = if o.result_ok {
13643                         let result = unsafe { o.contents.result };
13644                         unsafe { o.contents.result = core::ptr::null_mut() };
13645                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
13646                 } else {
13647                         let err = unsafe { o.contents.err };
13648                         unsafe { o.contents.err = core::ptr::null_mut(); }
13649                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
13650                 };
13651                 Self {
13652                         contents,
13653                         result_ok: o.result_ok,
13654                 }
13655         }
13656 }
13657 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13658         fn clone(&self) -> Self {
13659                 if self.result_ok {
13660                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13661                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13662                         } }
13663                 } else {
13664                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13665                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13666                         } }
13667                 }
13668         }
13669 }
13670 #[no_mangle]
13671 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
13672 /// but with all dynamically-allocated buffers duplicated in new buffers.
13673 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
13674 #[repr(C)]
13675 #[derive(Clone)]
13676 /// An enum which can either contain a crate::c_types::SecretKey or not
13677 pub enum COption_SecretKeyZ {
13678         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
13679         Some(crate::c_types::SecretKey),
13680         /// When we're in this state, this COption_SecretKeyZ contains nothing
13681         None
13682 }
13683 impl COption_SecretKeyZ {
13684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13685                 if let Self::None = self { false } else { true }
13686         }
13687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13688                 !self.is_some()
13689         }
13690         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
13691                 if let Self::Some(v) = self { v } else { unreachable!() }
13692         }
13693 }
13694 #[no_mangle]
13695 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
13696 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
13697         COption_SecretKeyZ::Some(o)
13698 }
13699 #[no_mangle]
13700 /// Constructs a new COption_SecretKeyZ containing nothing
13701 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
13702         COption_SecretKeyZ::None
13703 }
13704 #[no_mangle]
13705 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
13706 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
13707 #[no_mangle]
13708 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
13709 /// but with all dynamically-allocated buffers duplicated in new buffers.
13710 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
13711 #[repr(C)]
13712 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
13713 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
13714         /// A pointer to the contents in the success state.
13715         /// Reading from this pointer when `result_ok` is not set is undefined.
13716         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
13717         /// Note that this value is always NULL, as there are no contents in the Err variant
13718         pub err: *mut core::ffi::c_void,
13719 }
13720 #[repr(C)]
13721 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
13722 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
13723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13724 pub struct CResult_VerifiedInvoiceRequestNoneZ {
13725         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
13726         /// `err` or `result` depending on the state of `result_ok`.
13727         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
13728         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
13729         pub result_ok: bool,
13730 }
13731 #[no_mangle]
13732 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
13733 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
13734         CResult_VerifiedInvoiceRequestNoneZ {
13735                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13736                         result: Box::into_raw(Box::new(o)),
13737                 },
13738                 result_ok: true,
13739         }
13740 }
13741 #[no_mangle]
13742 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
13743 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
13744         CResult_VerifiedInvoiceRequestNoneZ {
13745                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13746                         err: core::ptr::null_mut(),
13747                 },
13748                 result_ok: false,
13749         }
13750 }
13751 /// Checks if the given object is currently in the success state
13752 #[no_mangle]
13753 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
13754         o.result_ok
13755 }
13756 #[no_mangle]
13757 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
13758 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
13759 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
13760         fn drop(&mut self) {
13761                 if self.result_ok {
13762                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13763                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13764                         }
13765                 } else {
13766                 }
13767         }
13768 }
13769 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
13770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
13771                 let contents = if o.result_ok {
13772                         let result = unsafe { o.contents.result };
13773                         unsafe { o.contents.result = core::ptr::null_mut() };
13774                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
13775                 } else {
13776                         let _ = unsafe { Box::from_raw(o.contents.err) };
13777                         o.contents.err = core::ptr::null_mut();
13778                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
13779                 };
13780                 Self {
13781                         contents,
13782                         result_ok: o.result_ok,
13783                 }
13784         }
13785 }
13786 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
13787         fn clone(&self) -> Self {
13788                 if self.result_ok {
13789                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13790                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
13791                         } }
13792                 } else {
13793                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13794                                 err: core::ptr::null_mut()
13795                         } }
13796                 }
13797         }
13798 }
13799 #[no_mangle]
13800 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
13801 /// but with all dynamically-allocated buffers duplicated in new buffers.
13802 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
13803 #[repr(C)]
13804 /// An enum which can either contain a  or not
13805 pub enum COption_NoneZ {
13806         /// When we're in this state, this COption_NoneZ contains a 
13807         Some,
13808         /// When we're in this state, this COption_NoneZ contains nothing
13809         None
13810 }
13811 impl COption_NoneZ {
13812         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13813                 if let Self::None = self { false } else { true }
13814         }
13815         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13816                 !self.is_some()
13817         }
13818 }
13819 #[no_mangle]
13820 /// Constructs a new COption_NoneZ containing a 
13821 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
13822         COption_NoneZ::Some
13823 }
13824 #[no_mangle]
13825 /// Constructs a new COption_NoneZ containing nothing
13826 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
13827         COption_NoneZ::None
13828 }
13829 #[no_mangle]
13830 /// Frees any resources associated with the , if we are in the Some state
13831 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
13832 #[repr(C)]
13833 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
13834 /// This corresponds to std::vector in C++
13835 pub struct CVec_WitnessZ {
13836         /// The elements in the array.
13837         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13838         pub data: *mut crate::c_types::Witness,
13839         /// The number of elements pointed to by `data`.
13840         pub datalen: usize
13841 }
13842 impl CVec_WitnessZ {
13843         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
13844                 if self.datalen == 0 { return Vec::new(); }
13845                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13846                 self.data = core::ptr::null_mut();
13847                 self.datalen = 0;
13848                 ret
13849         }
13850         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
13851                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13852         }
13853 }
13854 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
13855         fn from(v: Vec<crate::c_types::Witness>) -> Self {
13856                 let datalen = v.len();
13857                 let data = Box::into_raw(v.into_boxed_slice());
13858                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13859         }
13860 }
13861 #[no_mangle]
13862 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13863 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
13864 impl Drop for CVec_WitnessZ {
13865         fn drop(&mut self) {
13866                 if self.datalen == 0 { return; }
13867                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13868         }
13869 }
13870 impl Clone for CVec_WitnessZ {
13871         fn clone(&self) -> Self {
13872                 let mut res = Vec::new();
13873                 if self.datalen == 0 { return Self::from(res); }
13874                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13875                 Self::from(res)
13876         }
13877 }
13878 #[repr(C)]
13879 #[derive(Clone)]
13880 /// An enum which can either contain a i64 or not
13881 pub enum COption_i64Z {
13882         /// When we're in this state, this COption_i64Z contains a i64
13883         Some(i64),
13884         /// When we're in this state, this COption_i64Z contains nothing
13885         None
13886 }
13887 impl COption_i64Z {
13888         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13889                 if let Self::None = self { false } else { true }
13890         }
13891         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13892                 !self.is_some()
13893         }
13894         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
13895                 if let Self::Some(v) = self { v } else { unreachable!() }
13896         }
13897 }
13898 #[no_mangle]
13899 /// Constructs a new COption_i64Z containing a i64
13900 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
13901         COption_i64Z::Some(o)
13902 }
13903 #[no_mangle]
13904 /// Constructs a new COption_i64Z containing nothing
13905 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
13906         COption_i64Z::None
13907 }
13908 #[no_mangle]
13909 /// Frees any resources associated with the i64, if we are in the Some state
13910 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
13911 #[no_mangle]
13912 /// Creates a new COption_i64Z which has the same data as `orig`
13913 /// but with all dynamically-allocated buffers duplicated in new buffers.
13914 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
13915 #[repr(C)]
13916 /// The contents of CResult_SocketAddressDecodeErrorZ
13917 pub union CResult_SocketAddressDecodeErrorZPtr {
13918         /// A pointer to the contents in the success state.
13919         /// Reading from this pointer when `result_ok` is not set is undefined.
13920         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13921         /// A pointer to the contents in the error state.
13922         /// Reading from this pointer when `result_ok` is set is undefined.
13923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13924 }
13925 #[repr(C)]
13926 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
13927 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13929 pub struct CResult_SocketAddressDecodeErrorZ {
13930         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
13931         /// `err` or `result` depending on the state of `result_ok`.
13932         pub contents: CResult_SocketAddressDecodeErrorZPtr,
13933         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
13934         pub result_ok: bool,
13935 }
13936 #[no_mangle]
13937 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
13938 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
13939         CResult_SocketAddressDecodeErrorZ {
13940                 contents: CResult_SocketAddressDecodeErrorZPtr {
13941                         result: Box::into_raw(Box::new(o)),
13942                 },
13943                 result_ok: true,
13944         }
13945 }
13946 #[no_mangle]
13947 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
13948 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
13949         CResult_SocketAddressDecodeErrorZ {
13950                 contents: CResult_SocketAddressDecodeErrorZPtr {
13951                         err: Box::into_raw(Box::new(e)),
13952                 },
13953                 result_ok: false,
13954         }
13955 }
13956 /// Checks if the given object is currently in the success state
13957 #[no_mangle]
13958 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
13959         o.result_ok
13960 }
13961 #[no_mangle]
13962 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
13963 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
13964 impl Drop for CResult_SocketAddressDecodeErrorZ {
13965         fn drop(&mut self) {
13966                 if self.result_ok {
13967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13969                         }
13970                 } else {
13971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13973                         }
13974                 }
13975         }
13976 }
13977 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
13978         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13979                 let contents = if o.result_ok {
13980                         let result = unsafe { o.contents.result };
13981                         unsafe { o.contents.result = core::ptr::null_mut() };
13982                         CResult_SocketAddressDecodeErrorZPtr { result }
13983                 } else {
13984                         let err = unsafe { o.contents.err };
13985                         unsafe { o.contents.err = core::ptr::null_mut(); }
13986                         CResult_SocketAddressDecodeErrorZPtr { err }
13987                 };
13988                 Self {
13989                         contents,
13990                         result_ok: o.result_ok,
13991                 }
13992         }
13993 }
13994 impl Clone for CResult_SocketAddressDecodeErrorZ {
13995         fn clone(&self) -> Self {
13996                 if self.result_ok {
13997                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
13998                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
13999                         } }
14000                 } else {
14001                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
14002                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14003                         } }
14004                 }
14005         }
14006 }
14007 #[no_mangle]
14008 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
14009 /// but with all dynamically-allocated buffers duplicated in new buffers.
14010 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
14011 #[repr(C)]
14012 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
14013 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
14014         /// A pointer to the contents in the success state.
14015         /// Reading from this pointer when `result_ok` is not set is undefined.
14016         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
14017         /// A pointer to the contents in the error state.
14018         /// Reading from this pointer when `result_ok` is set is undefined.
14019         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
14020 }
14021 #[repr(C)]
14022 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
14023 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
14024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14025 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
14026         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
14027         /// `err` or `result` depending on the state of `result_ok`.
14028         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
14029         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
14030         pub result_ok: bool,
14031 }
14032 #[no_mangle]
14033 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
14034 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
14035         CResult_SocketAddressSocketAddressParseErrorZ {
14036                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14037                         result: Box::into_raw(Box::new(o)),
14038                 },
14039                 result_ok: true,
14040         }
14041 }
14042 #[no_mangle]
14043 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
14044 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
14045         CResult_SocketAddressSocketAddressParseErrorZ {
14046                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14047                         err: Box::into_raw(Box::new(e)),
14048                 },
14049                 result_ok: false,
14050         }
14051 }
14052 /// Checks if the given object is currently in the success state
14053 #[no_mangle]
14054 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
14055         o.result_ok
14056 }
14057 #[no_mangle]
14058 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
14059 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
14060 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
14061         fn drop(&mut self) {
14062                 if self.result_ok {
14063                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14064                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14065                         }
14066                 } else {
14067                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14068                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14069                         }
14070                 }
14071         }
14072 }
14073 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
14074         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
14075                 let contents = if o.result_ok {
14076                         let result = unsafe { o.contents.result };
14077                         unsafe { o.contents.result = core::ptr::null_mut() };
14078                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
14079                 } else {
14080                         let err = unsafe { o.contents.err };
14081                         unsafe { o.contents.err = core::ptr::null_mut(); }
14082                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
14083                 };
14084                 Self {
14085                         contents,
14086                         result_ok: o.result_ok,
14087                 }
14088         }
14089 }
14090 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
14091         fn clone(&self) -> Self {
14092                 if self.result_ok {
14093                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14094                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
14095                         } }
14096                 } else {
14097                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14098                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
14099                         } }
14100                 }
14101         }
14102 }
14103 #[no_mangle]
14104 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
14105 /// but with all dynamically-allocated buffers duplicated in new buffers.
14106 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
14107 #[repr(C)]
14108 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14109 /// This corresponds to std::vector in C++
14110 pub struct CVec_UpdateAddHTLCZ {
14111         /// The elements in the array.
14112         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14113         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14114         /// The number of elements pointed to by `data`.
14115         pub datalen: usize
14116 }
14117 impl CVec_UpdateAddHTLCZ {
14118         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14119                 if self.datalen == 0 { return Vec::new(); }
14120                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14121                 self.data = core::ptr::null_mut();
14122                 self.datalen = 0;
14123                 ret
14124         }
14125         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14126                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14127         }
14128 }
14129 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14130         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14131                 let datalen = v.len();
14132                 let data = Box::into_raw(v.into_boxed_slice());
14133                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14134         }
14135 }
14136 #[no_mangle]
14137 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14138 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14139 impl Drop for CVec_UpdateAddHTLCZ {
14140         fn drop(&mut self) {
14141                 if self.datalen == 0 { return; }
14142                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14143         }
14144 }
14145 impl Clone for CVec_UpdateAddHTLCZ {
14146         fn clone(&self) -> Self {
14147                 let mut res = Vec::new();
14148                 if self.datalen == 0 { return Self::from(res); }
14149                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14150                 Self::from(res)
14151         }
14152 }
14153 #[repr(C)]
14154 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14155 /// This corresponds to std::vector in C++
14156 pub struct CVec_UpdateFulfillHTLCZ {
14157         /// The elements in the array.
14158         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14159         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14160         /// The number of elements pointed to by `data`.
14161         pub datalen: usize
14162 }
14163 impl CVec_UpdateFulfillHTLCZ {
14164         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14165                 if self.datalen == 0 { return Vec::new(); }
14166                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14167                 self.data = core::ptr::null_mut();
14168                 self.datalen = 0;
14169                 ret
14170         }
14171         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14172                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14173         }
14174 }
14175 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14176         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14177                 let datalen = v.len();
14178                 let data = Box::into_raw(v.into_boxed_slice());
14179                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14180         }
14181 }
14182 #[no_mangle]
14183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14184 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14185 impl Drop for CVec_UpdateFulfillHTLCZ {
14186         fn drop(&mut self) {
14187                 if self.datalen == 0 { return; }
14188                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14189         }
14190 }
14191 impl Clone for CVec_UpdateFulfillHTLCZ {
14192         fn clone(&self) -> Self {
14193                 let mut res = Vec::new();
14194                 if self.datalen == 0 { return Self::from(res); }
14195                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14196                 Self::from(res)
14197         }
14198 }
14199 #[repr(C)]
14200 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14201 /// This corresponds to std::vector in C++
14202 pub struct CVec_UpdateFailHTLCZ {
14203         /// The elements in the array.
14204         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14205         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14206         /// The number of elements pointed to by `data`.
14207         pub datalen: usize
14208 }
14209 impl CVec_UpdateFailHTLCZ {
14210         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14211                 if self.datalen == 0 { return Vec::new(); }
14212                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14213                 self.data = core::ptr::null_mut();
14214                 self.datalen = 0;
14215                 ret
14216         }
14217         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14218                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14219         }
14220 }
14221 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14222         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14223                 let datalen = v.len();
14224                 let data = Box::into_raw(v.into_boxed_slice());
14225                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14226         }
14227 }
14228 #[no_mangle]
14229 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14230 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14231 impl Drop for CVec_UpdateFailHTLCZ {
14232         fn drop(&mut self) {
14233                 if self.datalen == 0 { return; }
14234                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14235         }
14236 }
14237 impl Clone for CVec_UpdateFailHTLCZ {
14238         fn clone(&self) -> Self {
14239                 let mut res = Vec::new();
14240                 if self.datalen == 0 { return Self::from(res); }
14241                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14242                 Self::from(res)
14243         }
14244 }
14245 #[repr(C)]
14246 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14247 /// This corresponds to std::vector in C++
14248 pub struct CVec_UpdateFailMalformedHTLCZ {
14249         /// The elements in the array.
14250         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14251         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14252         /// The number of elements pointed to by `data`.
14253         pub datalen: usize
14254 }
14255 impl CVec_UpdateFailMalformedHTLCZ {
14256         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14257                 if self.datalen == 0 { return Vec::new(); }
14258                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14259                 self.data = core::ptr::null_mut();
14260                 self.datalen = 0;
14261                 ret
14262         }
14263         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14264                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14265         }
14266 }
14267 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14268         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14269                 let datalen = v.len();
14270                 let data = Box::into_raw(v.into_boxed_slice());
14271                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14272         }
14273 }
14274 #[no_mangle]
14275 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14276 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14277 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14278         fn drop(&mut self) {
14279                 if self.datalen == 0 { return; }
14280                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14281         }
14282 }
14283 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14284         fn clone(&self) -> Self {
14285                 let mut res = Vec::new();
14286                 if self.datalen == 0 { return Self::from(res); }
14287                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14288                 Self::from(res)
14289         }
14290 }
14291 #[repr(C)]
14292 /// The contents of CResult_AcceptChannelDecodeErrorZ
14293 pub union CResult_AcceptChannelDecodeErrorZPtr {
14294         /// A pointer to the contents in the success state.
14295         /// Reading from this pointer when `result_ok` is not set is undefined.
14296         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14297         /// A pointer to the contents in the error state.
14298         /// Reading from this pointer when `result_ok` is set is undefined.
14299         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14300 }
14301 #[repr(C)]
14302 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14303 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14305 pub struct CResult_AcceptChannelDecodeErrorZ {
14306         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14307         /// `err` or `result` depending on the state of `result_ok`.
14308         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14309         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14310         pub result_ok: bool,
14311 }
14312 #[no_mangle]
14313 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14314 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14315         CResult_AcceptChannelDecodeErrorZ {
14316                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14317                         result: Box::into_raw(Box::new(o)),
14318                 },
14319                 result_ok: true,
14320         }
14321 }
14322 #[no_mangle]
14323 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14324 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14325         CResult_AcceptChannelDecodeErrorZ {
14326                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14327                         err: Box::into_raw(Box::new(e)),
14328                 },
14329                 result_ok: false,
14330         }
14331 }
14332 /// Checks if the given object is currently in the success state
14333 #[no_mangle]
14334 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14335         o.result_ok
14336 }
14337 #[no_mangle]
14338 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14339 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14340 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14341         fn drop(&mut self) {
14342                 if self.result_ok {
14343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14345                         }
14346                 } else {
14347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14349                         }
14350                 }
14351         }
14352 }
14353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14354         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14355                 let contents = if o.result_ok {
14356                         let result = unsafe { o.contents.result };
14357                         unsafe { o.contents.result = core::ptr::null_mut() };
14358                         CResult_AcceptChannelDecodeErrorZPtr { result }
14359                 } else {
14360                         let err = unsafe { o.contents.err };
14361                         unsafe { o.contents.err = core::ptr::null_mut(); }
14362                         CResult_AcceptChannelDecodeErrorZPtr { err }
14363                 };
14364                 Self {
14365                         contents,
14366                         result_ok: o.result_ok,
14367                 }
14368         }
14369 }
14370 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14371         fn clone(&self) -> Self {
14372                 if self.result_ok {
14373                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14374                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14375                         } }
14376                 } else {
14377                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14379                         } }
14380                 }
14381         }
14382 }
14383 #[no_mangle]
14384 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14385 /// but with all dynamically-allocated buffers duplicated in new buffers.
14386 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14387 #[repr(C)]
14388 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
14389 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
14390         /// A pointer to the contents in the success state.
14391         /// Reading from this pointer when `result_ok` is not set is undefined.
14392         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
14393         /// A pointer to the contents in the error state.
14394         /// Reading from this pointer when `result_ok` is set is undefined.
14395         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14396 }
14397 #[repr(C)]
14398 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
14399 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
14400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14401 pub struct CResult_AcceptChannelV2DecodeErrorZ {
14402         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
14403         /// `err` or `result` depending on the state of `result_ok`.
14404         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
14405         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
14406         pub result_ok: bool,
14407 }
14408 #[no_mangle]
14409 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
14410 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
14411         CResult_AcceptChannelV2DecodeErrorZ {
14412                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14413                         result: Box::into_raw(Box::new(o)),
14414                 },
14415                 result_ok: true,
14416         }
14417 }
14418 #[no_mangle]
14419 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
14420 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
14421         CResult_AcceptChannelV2DecodeErrorZ {
14422                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14423                         err: Box::into_raw(Box::new(e)),
14424                 },
14425                 result_ok: false,
14426         }
14427 }
14428 /// Checks if the given object is currently in the success state
14429 #[no_mangle]
14430 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
14431         o.result_ok
14432 }
14433 #[no_mangle]
14434 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
14435 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
14436 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
14437         fn drop(&mut self) {
14438                 if self.result_ok {
14439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14441                         }
14442                 } else {
14443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14445                         }
14446                 }
14447         }
14448 }
14449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
14450         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
14451                 let contents = if o.result_ok {
14452                         let result = unsafe { o.contents.result };
14453                         unsafe { o.contents.result = core::ptr::null_mut() };
14454                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
14455                 } else {
14456                         let err = unsafe { o.contents.err };
14457                         unsafe { o.contents.err = core::ptr::null_mut(); }
14458                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
14459                 };
14460                 Self {
14461                         contents,
14462                         result_ok: o.result_ok,
14463                 }
14464         }
14465 }
14466 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
14467         fn clone(&self) -> Self {
14468                 if self.result_ok {
14469                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14470                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
14471                         } }
14472                 } else {
14473                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14474                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14475                         } }
14476                 }
14477         }
14478 }
14479 #[no_mangle]
14480 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
14481 /// but with all dynamically-allocated buffers duplicated in new buffers.
14482 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
14483 #[repr(C)]
14484 /// The contents of CResult_StfuDecodeErrorZ
14485 pub union CResult_StfuDecodeErrorZPtr {
14486         /// A pointer to the contents in the success state.
14487         /// Reading from this pointer when `result_ok` is not set is undefined.
14488         pub result: *mut crate::lightning::ln::msgs::Stfu,
14489         /// A pointer to the contents in the error state.
14490         /// Reading from this pointer when `result_ok` is set is undefined.
14491         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14492 }
14493 #[repr(C)]
14494 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
14495 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
14496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14497 pub struct CResult_StfuDecodeErrorZ {
14498         /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
14499         /// `err` or `result` depending on the state of `result_ok`.
14500         pub contents: CResult_StfuDecodeErrorZPtr,
14501         /// Whether this CResult_StfuDecodeErrorZ represents a success state.
14502         pub result_ok: bool,
14503 }
14504 #[no_mangle]
14505 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
14506 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
14507         CResult_StfuDecodeErrorZ {
14508                 contents: CResult_StfuDecodeErrorZPtr {
14509                         result: Box::into_raw(Box::new(o)),
14510                 },
14511                 result_ok: true,
14512         }
14513 }
14514 #[no_mangle]
14515 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
14516 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
14517         CResult_StfuDecodeErrorZ {
14518                 contents: CResult_StfuDecodeErrorZPtr {
14519                         err: Box::into_raw(Box::new(e)),
14520                 },
14521                 result_ok: false,
14522         }
14523 }
14524 /// Checks if the given object is currently in the success state
14525 #[no_mangle]
14526 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
14527         o.result_ok
14528 }
14529 #[no_mangle]
14530 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
14531 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
14532 impl Drop for CResult_StfuDecodeErrorZ {
14533         fn drop(&mut self) {
14534                 if self.result_ok {
14535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14537                         }
14538                 } else {
14539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14541                         }
14542                 }
14543         }
14544 }
14545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
14546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
14547                 let contents = if o.result_ok {
14548                         let result = unsafe { o.contents.result };
14549                         unsafe { o.contents.result = core::ptr::null_mut() };
14550                         CResult_StfuDecodeErrorZPtr { result }
14551                 } else {
14552                         let err = unsafe { o.contents.err };
14553                         unsafe { o.contents.err = core::ptr::null_mut(); }
14554                         CResult_StfuDecodeErrorZPtr { err }
14555                 };
14556                 Self {
14557                         contents,
14558                         result_ok: o.result_ok,
14559                 }
14560         }
14561 }
14562 impl Clone for CResult_StfuDecodeErrorZ {
14563         fn clone(&self) -> Self {
14564                 if self.result_ok {
14565                         Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
14566                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
14567                         } }
14568                 } else {
14569                         Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
14570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14571                         } }
14572                 }
14573         }
14574 }
14575 #[no_mangle]
14576 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
14577 /// but with all dynamically-allocated buffers duplicated in new buffers.
14578 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
14579 #[repr(C)]
14580 /// The contents of CResult_SpliceDecodeErrorZ
14581 pub union CResult_SpliceDecodeErrorZPtr {
14582         /// A pointer to the contents in the success state.
14583         /// Reading from this pointer when `result_ok` is not set is undefined.
14584         pub result: *mut crate::lightning::ln::msgs::Splice,
14585         /// A pointer to the contents in the error state.
14586         /// Reading from this pointer when `result_ok` is set is undefined.
14587         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14588 }
14589 #[repr(C)]
14590 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
14591 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
14592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14593 pub struct CResult_SpliceDecodeErrorZ {
14594         /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
14595         /// `err` or `result` depending on the state of `result_ok`.
14596         pub contents: CResult_SpliceDecodeErrorZPtr,
14597         /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
14598         pub result_ok: bool,
14599 }
14600 #[no_mangle]
14601 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
14602 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
14603         CResult_SpliceDecodeErrorZ {
14604                 contents: CResult_SpliceDecodeErrorZPtr {
14605                         result: Box::into_raw(Box::new(o)),
14606                 },
14607                 result_ok: true,
14608         }
14609 }
14610 #[no_mangle]
14611 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
14612 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
14613         CResult_SpliceDecodeErrorZ {
14614                 contents: CResult_SpliceDecodeErrorZPtr {
14615                         err: Box::into_raw(Box::new(e)),
14616                 },
14617                 result_ok: false,
14618         }
14619 }
14620 /// Checks if the given object is currently in the success state
14621 #[no_mangle]
14622 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
14623         o.result_ok
14624 }
14625 #[no_mangle]
14626 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
14627 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
14628 impl Drop for CResult_SpliceDecodeErrorZ {
14629         fn drop(&mut self) {
14630                 if self.result_ok {
14631                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14632                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14633                         }
14634                 } else {
14635                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14636                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14637                         }
14638                 }
14639         }
14640 }
14641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
14642         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
14643                 let contents = if o.result_ok {
14644                         let result = unsafe { o.contents.result };
14645                         unsafe { o.contents.result = core::ptr::null_mut() };
14646                         CResult_SpliceDecodeErrorZPtr { result }
14647                 } else {
14648                         let err = unsafe { o.contents.err };
14649                         unsafe { o.contents.err = core::ptr::null_mut(); }
14650                         CResult_SpliceDecodeErrorZPtr { err }
14651                 };
14652                 Self {
14653                         contents,
14654                         result_ok: o.result_ok,
14655                 }
14656         }
14657 }
14658 impl Clone for CResult_SpliceDecodeErrorZ {
14659         fn clone(&self) -> Self {
14660                 if self.result_ok {
14661                         Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
14662                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
14663                         } }
14664                 } else {
14665                         Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
14666                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14667                         } }
14668                 }
14669         }
14670 }
14671 #[no_mangle]
14672 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
14673 /// but with all dynamically-allocated buffers duplicated in new buffers.
14674 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
14675 #[repr(C)]
14676 /// The contents of CResult_SpliceAckDecodeErrorZ
14677 pub union CResult_SpliceAckDecodeErrorZPtr {
14678         /// A pointer to the contents in the success state.
14679         /// Reading from this pointer when `result_ok` is not set is undefined.
14680         pub result: *mut crate::lightning::ln::msgs::SpliceAck,
14681         /// A pointer to the contents in the error state.
14682         /// Reading from this pointer when `result_ok` is set is undefined.
14683         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14684 }
14685 #[repr(C)]
14686 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
14687 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
14688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14689 pub struct CResult_SpliceAckDecodeErrorZ {
14690         /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
14691         /// `err` or `result` depending on the state of `result_ok`.
14692         pub contents: CResult_SpliceAckDecodeErrorZPtr,
14693         /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
14694         pub result_ok: bool,
14695 }
14696 #[no_mangle]
14697 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
14698 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
14699         CResult_SpliceAckDecodeErrorZ {
14700                 contents: CResult_SpliceAckDecodeErrorZPtr {
14701                         result: Box::into_raw(Box::new(o)),
14702                 },
14703                 result_ok: true,
14704         }
14705 }
14706 #[no_mangle]
14707 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
14708 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
14709         CResult_SpliceAckDecodeErrorZ {
14710                 contents: CResult_SpliceAckDecodeErrorZPtr {
14711                         err: Box::into_raw(Box::new(e)),
14712                 },
14713                 result_ok: false,
14714         }
14715 }
14716 /// Checks if the given object is currently in the success state
14717 #[no_mangle]
14718 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
14719         o.result_ok
14720 }
14721 #[no_mangle]
14722 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
14723 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
14724 impl Drop for CResult_SpliceAckDecodeErrorZ {
14725         fn drop(&mut self) {
14726                 if self.result_ok {
14727                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14728                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14729                         }
14730                 } else {
14731                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14732                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14733                         }
14734                 }
14735         }
14736 }
14737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
14738         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
14739                 let contents = if o.result_ok {
14740                         let result = unsafe { o.contents.result };
14741                         unsafe { o.contents.result = core::ptr::null_mut() };
14742                         CResult_SpliceAckDecodeErrorZPtr { result }
14743                 } else {
14744                         let err = unsafe { o.contents.err };
14745                         unsafe { o.contents.err = core::ptr::null_mut(); }
14746                         CResult_SpliceAckDecodeErrorZPtr { err }
14747                 };
14748                 Self {
14749                         contents,
14750                         result_ok: o.result_ok,
14751                 }
14752         }
14753 }
14754 impl Clone for CResult_SpliceAckDecodeErrorZ {
14755         fn clone(&self) -> Self {
14756                 if self.result_ok {
14757                         Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
14758                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
14759                         } }
14760                 } else {
14761                         Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
14762                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14763                         } }
14764                 }
14765         }
14766 }
14767 #[no_mangle]
14768 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
14769 /// but with all dynamically-allocated buffers duplicated in new buffers.
14770 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
14771 #[repr(C)]
14772 /// The contents of CResult_SpliceLockedDecodeErrorZ
14773 pub union CResult_SpliceLockedDecodeErrorZPtr {
14774         /// A pointer to the contents in the success state.
14775         /// Reading from this pointer when `result_ok` is not set is undefined.
14776         pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
14777         /// A pointer to the contents in the error state.
14778         /// Reading from this pointer when `result_ok` is set is undefined.
14779         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14780 }
14781 #[repr(C)]
14782 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
14783 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
14784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14785 pub struct CResult_SpliceLockedDecodeErrorZ {
14786         /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
14787         /// `err` or `result` depending on the state of `result_ok`.
14788         pub contents: CResult_SpliceLockedDecodeErrorZPtr,
14789         /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
14790         pub result_ok: bool,
14791 }
14792 #[no_mangle]
14793 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
14794 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
14795         CResult_SpliceLockedDecodeErrorZ {
14796                 contents: CResult_SpliceLockedDecodeErrorZPtr {
14797                         result: Box::into_raw(Box::new(o)),
14798                 },
14799                 result_ok: true,
14800         }
14801 }
14802 #[no_mangle]
14803 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
14804 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
14805         CResult_SpliceLockedDecodeErrorZ {
14806                 contents: CResult_SpliceLockedDecodeErrorZPtr {
14807                         err: Box::into_raw(Box::new(e)),
14808                 },
14809                 result_ok: false,
14810         }
14811 }
14812 /// Checks if the given object is currently in the success state
14813 #[no_mangle]
14814 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
14815         o.result_ok
14816 }
14817 #[no_mangle]
14818 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
14819 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
14820 impl Drop for CResult_SpliceLockedDecodeErrorZ {
14821         fn drop(&mut self) {
14822                 if self.result_ok {
14823                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14824                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14825                         }
14826                 } else {
14827                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14828                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14829                         }
14830                 }
14831         }
14832 }
14833 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
14834         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
14835                 let contents = if o.result_ok {
14836                         let result = unsafe { o.contents.result };
14837                         unsafe { o.contents.result = core::ptr::null_mut() };
14838                         CResult_SpliceLockedDecodeErrorZPtr { result }
14839                 } else {
14840                         let err = unsafe { o.contents.err };
14841                         unsafe { o.contents.err = core::ptr::null_mut(); }
14842                         CResult_SpliceLockedDecodeErrorZPtr { err }
14843                 };
14844                 Self {
14845                         contents,
14846                         result_ok: o.result_ok,
14847                 }
14848         }
14849 }
14850 impl Clone for CResult_SpliceLockedDecodeErrorZ {
14851         fn clone(&self) -> Self {
14852                 if self.result_ok {
14853                         Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
14854                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
14855                         } }
14856                 } else {
14857                         Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
14858                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14859                         } }
14860                 }
14861         }
14862 }
14863 #[no_mangle]
14864 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
14865 /// but with all dynamically-allocated buffers duplicated in new buffers.
14866 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
14867 #[repr(C)]
14868 /// The contents of CResult_TxAddInputDecodeErrorZ
14869 pub union CResult_TxAddInputDecodeErrorZPtr {
14870         /// A pointer to the contents in the success state.
14871         /// Reading from this pointer when `result_ok` is not set is undefined.
14872         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
14873         /// A pointer to the contents in the error state.
14874         /// Reading from this pointer when `result_ok` is set is undefined.
14875         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14876 }
14877 #[repr(C)]
14878 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
14879 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14881 pub struct CResult_TxAddInputDecodeErrorZ {
14882         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
14883         /// `err` or `result` depending on the state of `result_ok`.
14884         pub contents: CResult_TxAddInputDecodeErrorZPtr,
14885         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
14886         pub result_ok: bool,
14887 }
14888 #[no_mangle]
14889 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
14890 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
14891         CResult_TxAddInputDecodeErrorZ {
14892                 contents: CResult_TxAddInputDecodeErrorZPtr {
14893                         result: Box::into_raw(Box::new(o)),
14894                 },
14895                 result_ok: true,
14896         }
14897 }
14898 #[no_mangle]
14899 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
14900 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
14901         CResult_TxAddInputDecodeErrorZ {
14902                 contents: CResult_TxAddInputDecodeErrorZPtr {
14903                         err: Box::into_raw(Box::new(e)),
14904                 },
14905                 result_ok: false,
14906         }
14907 }
14908 /// Checks if the given object is currently in the success state
14909 #[no_mangle]
14910 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
14911         o.result_ok
14912 }
14913 #[no_mangle]
14914 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
14915 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
14916 impl Drop for CResult_TxAddInputDecodeErrorZ {
14917         fn drop(&mut self) {
14918                 if self.result_ok {
14919                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14920                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14921                         }
14922                 } else {
14923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14925                         }
14926                 }
14927         }
14928 }
14929 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
14930         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
14931                 let contents = if o.result_ok {
14932                         let result = unsafe { o.contents.result };
14933                         unsafe { o.contents.result = core::ptr::null_mut() };
14934                         CResult_TxAddInputDecodeErrorZPtr { result }
14935                 } else {
14936                         let err = unsafe { o.contents.err };
14937                         unsafe { o.contents.err = core::ptr::null_mut(); }
14938                         CResult_TxAddInputDecodeErrorZPtr { err }
14939                 };
14940                 Self {
14941                         contents,
14942                         result_ok: o.result_ok,
14943                 }
14944         }
14945 }
14946 impl Clone for CResult_TxAddInputDecodeErrorZ {
14947         fn clone(&self) -> Self {
14948                 if self.result_ok {
14949                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
14950                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
14951                         } }
14952                 } else {
14953                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
14954                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14955                         } }
14956                 }
14957         }
14958 }
14959 #[no_mangle]
14960 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
14961 /// but with all dynamically-allocated buffers duplicated in new buffers.
14962 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
14963 #[repr(C)]
14964 /// The contents of CResult_TxAddOutputDecodeErrorZ
14965 pub union CResult_TxAddOutputDecodeErrorZPtr {
14966         /// A pointer to the contents in the success state.
14967         /// Reading from this pointer when `result_ok` is not set is undefined.
14968         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
14969         /// A pointer to the contents in the error state.
14970         /// Reading from this pointer when `result_ok` is set is undefined.
14971         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14972 }
14973 #[repr(C)]
14974 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
14975 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14977 pub struct CResult_TxAddOutputDecodeErrorZ {
14978         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
14979         /// `err` or `result` depending on the state of `result_ok`.
14980         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
14981         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
14982         pub result_ok: bool,
14983 }
14984 #[no_mangle]
14985 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
14986 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
14987         CResult_TxAddOutputDecodeErrorZ {
14988                 contents: CResult_TxAddOutputDecodeErrorZPtr {
14989                         result: Box::into_raw(Box::new(o)),
14990                 },
14991                 result_ok: true,
14992         }
14993 }
14994 #[no_mangle]
14995 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
14996 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
14997         CResult_TxAddOutputDecodeErrorZ {
14998                 contents: CResult_TxAddOutputDecodeErrorZPtr {
14999                         err: Box::into_raw(Box::new(e)),
15000                 },
15001                 result_ok: false,
15002         }
15003 }
15004 /// Checks if the given object is currently in the success state
15005 #[no_mangle]
15006 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
15007         o.result_ok
15008 }
15009 #[no_mangle]
15010 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
15011 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
15012 impl Drop for CResult_TxAddOutputDecodeErrorZ {
15013         fn drop(&mut self) {
15014                 if self.result_ok {
15015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15017                         }
15018                 } else {
15019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15021                         }
15022                 }
15023         }
15024 }
15025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
15026         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15027                 let contents = if o.result_ok {
15028                         let result = unsafe { o.contents.result };
15029                         unsafe { o.contents.result = core::ptr::null_mut() };
15030                         CResult_TxAddOutputDecodeErrorZPtr { result }
15031                 } else {
15032                         let err = unsafe { o.contents.err };
15033                         unsafe { o.contents.err = core::ptr::null_mut(); }
15034                         CResult_TxAddOutputDecodeErrorZPtr { err }
15035                 };
15036                 Self {
15037                         contents,
15038                         result_ok: o.result_ok,
15039                 }
15040         }
15041 }
15042 impl Clone for CResult_TxAddOutputDecodeErrorZ {
15043         fn clone(&self) -> Self {
15044                 if self.result_ok {
15045                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
15046                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
15047                         } }
15048                 } else {
15049                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
15050                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15051                         } }
15052                 }
15053         }
15054 }
15055 #[no_mangle]
15056 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
15057 /// but with all dynamically-allocated buffers duplicated in new buffers.
15058 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
15059 #[repr(C)]
15060 /// The contents of CResult_TxRemoveInputDecodeErrorZ
15061 pub union CResult_TxRemoveInputDecodeErrorZPtr {
15062         /// A pointer to the contents in the success state.
15063         /// Reading from this pointer when `result_ok` is not set is undefined.
15064         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
15065         /// A pointer to the contents in the error state.
15066         /// Reading from this pointer when `result_ok` is set is undefined.
15067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15068 }
15069 #[repr(C)]
15070 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
15071 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
15072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15073 pub struct CResult_TxRemoveInputDecodeErrorZ {
15074         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
15075         /// `err` or `result` depending on the state of `result_ok`.
15076         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
15077         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
15078         pub result_ok: bool,
15079 }
15080 #[no_mangle]
15081 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
15082 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
15083         CResult_TxRemoveInputDecodeErrorZ {
15084                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
15085                         result: Box::into_raw(Box::new(o)),
15086                 },
15087                 result_ok: true,
15088         }
15089 }
15090 #[no_mangle]
15091 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
15092 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
15093         CResult_TxRemoveInputDecodeErrorZ {
15094                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
15095                         err: Box::into_raw(Box::new(e)),
15096                 },
15097                 result_ok: false,
15098         }
15099 }
15100 /// Checks if the given object is currently in the success state
15101 #[no_mangle]
15102 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
15103         o.result_ok
15104 }
15105 #[no_mangle]
15106 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
15107 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
15108 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
15109         fn drop(&mut self) {
15110                 if self.result_ok {
15111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15113                         }
15114                 } else {
15115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15117                         }
15118                 }
15119         }
15120 }
15121 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
15122         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15123                 let contents = if o.result_ok {
15124                         let result = unsafe { o.contents.result };
15125                         unsafe { o.contents.result = core::ptr::null_mut() };
15126                         CResult_TxRemoveInputDecodeErrorZPtr { result }
15127                 } else {
15128                         let err = unsafe { o.contents.err };
15129                         unsafe { o.contents.err = core::ptr::null_mut(); }
15130                         CResult_TxRemoveInputDecodeErrorZPtr { err }
15131                 };
15132                 Self {
15133                         contents,
15134                         result_ok: o.result_ok,
15135                 }
15136         }
15137 }
15138 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
15139         fn clone(&self) -> Self {
15140                 if self.result_ok {
15141                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
15142                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
15143                         } }
15144                 } else {
15145                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
15146                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15147                         } }
15148                 }
15149         }
15150 }
15151 #[no_mangle]
15152 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
15153 /// but with all dynamically-allocated buffers duplicated in new buffers.
15154 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
15155 #[repr(C)]
15156 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
15157 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
15158         /// A pointer to the contents in the success state.
15159         /// Reading from this pointer when `result_ok` is not set is undefined.
15160         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
15161         /// A pointer to the contents in the error state.
15162         /// Reading from this pointer when `result_ok` is set is undefined.
15163         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15164 }
15165 #[repr(C)]
15166 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
15167 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
15168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15169 pub struct CResult_TxRemoveOutputDecodeErrorZ {
15170         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
15171         /// `err` or `result` depending on the state of `result_ok`.
15172         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
15173         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
15174         pub result_ok: bool,
15175 }
15176 #[no_mangle]
15177 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
15178 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
15179         CResult_TxRemoveOutputDecodeErrorZ {
15180                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15181                         result: Box::into_raw(Box::new(o)),
15182                 },
15183                 result_ok: true,
15184         }
15185 }
15186 #[no_mangle]
15187 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
15188 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
15189         CResult_TxRemoveOutputDecodeErrorZ {
15190                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15191                         err: Box::into_raw(Box::new(e)),
15192                 },
15193                 result_ok: false,
15194         }
15195 }
15196 /// Checks if the given object is currently in the success state
15197 #[no_mangle]
15198 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
15199         o.result_ok
15200 }
15201 #[no_mangle]
15202 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
15203 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
15204 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
15205         fn drop(&mut self) {
15206                 if self.result_ok {
15207                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15208                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15209                         }
15210                 } else {
15211                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15212                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15213                         }
15214                 }
15215         }
15216 }
15217 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
15218         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15219                 let contents = if o.result_ok {
15220                         let result = unsafe { o.contents.result };
15221                         unsafe { o.contents.result = core::ptr::null_mut() };
15222                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
15223                 } else {
15224                         let err = unsafe { o.contents.err };
15225                         unsafe { o.contents.err = core::ptr::null_mut(); }
15226                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
15227                 };
15228                 Self {
15229                         contents,
15230                         result_ok: o.result_ok,
15231                 }
15232         }
15233 }
15234 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
15235         fn clone(&self) -> Self {
15236                 if self.result_ok {
15237                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15238                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
15239                         } }
15240                 } else {
15241                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15242                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15243                         } }
15244                 }
15245         }
15246 }
15247 #[no_mangle]
15248 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
15249 /// but with all dynamically-allocated buffers duplicated in new buffers.
15250 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
15251 #[repr(C)]
15252 /// The contents of CResult_TxCompleteDecodeErrorZ
15253 pub union CResult_TxCompleteDecodeErrorZPtr {
15254         /// A pointer to the contents in the success state.
15255         /// Reading from this pointer when `result_ok` is not set is undefined.
15256         pub result: *mut crate::lightning::ln::msgs::TxComplete,
15257         /// A pointer to the contents in the error state.
15258         /// Reading from this pointer when `result_ok` is set is undefined.
15259         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15260 }
15261 #[repr(C)]
15262 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
15263 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
15264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15265 pub struct CResult_TxCompleteDecodeErrorZ {
15266         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
15267         /// `err` or `result` depending on the state of `result_ok`.
15268         pub contents: CResult_TxCompleteDecodeErrorZPtr,
15269         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
15270         pub result_ok: bool,
15271 }
15272 #[no_mangle]
15273 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
15274 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
15275         CResult_TxCompleteDecodeErrorZ {
15276                 contents: CResult_TxCompleteDecodeErrorZPtr {
15277                         result: Box::into_raw(Box::new(o)),
15278                 },
15279                 result_ok: true,
15280         }
15281 }
15282 #[no_mangle]
15283 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
15284 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
15285         CResult_TxCompleteDecodeErrorZ {
15286                 contents: CResult_TxCompleteDecodeErrorZPtr {
15287                         err: Box::into_raw(Box::new(e)),
15288                 },
15289                 result_ok: false,
15290         }
15291 }
15292 /// Checks if the given object is currently in the success state
15293 #[no_mangle]
15294 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
15295         o.result_ok
15296 }
15297 #[no_mangle]
15298 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
15299 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
15300 impl Drop for CResult_TxCompleteDecodeErrorZ {
15301         fn drop(&mut self) {
15302                 if self.result_ok {
15303                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15304                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15305                         }
15306                 } else {
15307                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15308                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15309                         }
15310                 }
15311         }
15312 }
15313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
15314         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
15315                 let contents = if o.result_ok {
15316                         let result = unsafe { o.contents.result };
15317                         unsafe { o.contents.result = core::ptr::null_mut() };
15318                         CResult_TxCompleteDecodeErrorZPtr { result }
15319                 } else {
15320                         let err = unsafe { o.contents.err };
15321                         unsafe { o.contents.err = core::ptr::null_mut(); }
15322                         CResult_TxCompleteDecodeErrorZPtr { err }
15323                 };
15324                 Self {
15325                         contents,
15326                         result_ok: o.result_ok,
15327                 }
15328         }
15329 }
15330 impl Clone for CResult_TxCompleteDecodeErrorZ {
15331         fn clone(&self) -> Self {
15332                 if self.result_ok {
15333                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
15334                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
15335                         } }
15336                 } else {
15337                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
15338                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15339                         } }
15340                 }
15341         }
15342 }
15343 #[no_mangle]
15344 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
15345 /// but with all dynamically-allocated buffers duplicated in new buffers.
15346 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
15347 #[repr(C)]
15348 /// The contents of CResult_TxSignaturesDecodeErrorZ
15349 pub union CResult_TxSignaturesDecodeErrorZPtr {
15350         /// A pointer to the contents in the success state.
15351         /// Reading from this pointer when `result_ok` is not set is undefined.
15352         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
15353         /// A pointer to the contents in the error state.
15354         /// Reading from this pointer when `result_ok` is set is undefined.
15355         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15356 }
15357 #[repr(C)]
15358 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
15359 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
15360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15361 pub struct CResult_TxSignaturesDecodeErrorZ {
15362         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
15363         /// `err` or `result` depending on the state of `result_ok`.
15364         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
15365         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
15366         pub result_ok: bool,
15367 }
15368 #[no_mangle]
15369 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
15370 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
15371         CResult_TxSignaturesDecodeErrorZ {
15372                 contents: CResult_TxSignaturesDecodeErrorZPtr {
15373                         result: Box::into_raw(Box::new(o)),
15374                 },
15375                 result_ok: true,
15376         }
15377 }
15378 #[no_mangle]
15379 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
15380 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
15381         CResult_TxSignaturesDecodeErrorZ {
15382                 contents: CResult_TxSignaturesDecodeErrorZPtr {
15383                         err: Box::into_raw(Box::new(e)),
15384                 },
15385                 result_ok: false,
15386         }
15387 }
15388 /// Checks if the given object is currently in the success state
15389 #[no_mangle]
15390 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
15391         o.result_ok
15392 }
15393 #[no_mangle]
15394 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
15395 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
15396 impl Drop for CResult_TxSignaturesDecodeErrorZ {
15397         fn drop(&mut self) {
15398                 if self.result_ok {
15399                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15400                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15401                         }
15402                 } else {
15403                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15404                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15405                         }
15406                 }
15407         }
15408 }
15409 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
15410         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
15411                 let contents = if o.result_ok {
15412                         let result = unsafe { o.contents.result };
15413                         unsafe { o.contents.result = core::ptr::null_mut() };
15414                         CResult_TxSignaturesDecodeErrorZPtr { result }
15415                 } else {
15416                         let err = unsafe { o.contents.err };
15417                         unsafe { o.contents.err = core::ptr::null_mut(); }
15418                         CResult_TxSignaturesDecodeErrorZPtr { err }
15419                 };
15420                 Self {
15421                         contents,
15422                         result_ok: o.result_ok,
15423                 }
15424         }
15425 }
15426 impl Clone for CResult_TxSignaturesDecodeErrorZ {
15427         fn clone(&self) -> Self {
15428                 if self.result_ok {
15429                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
15430                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
15431                         } }
15432                 } else {
15433                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
15434                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15435                         } }
15436                 }
15437         }
15438 }
15439 #[no_mangle]
15440 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
15441 /// but with all dynamically-allocated buffers duplicated in new buffers.
15442 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
15443 #[repr(C)]
15444 /// The contents of CResult_TxInitRbfDecodeErrorZ
15445 pub union CResult_TxInitRbfDecodeErrorZPtr {
15446         /// A pointer to the contents in the success state.
15447         /// Reading from this pointer when `result_ok` is not set is undefined.
15448         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
15449         /// A pointer to the contents in the error state.
15450         /// Reading from this pointer when `result_ok` is set is undefined.
15451         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15452 }
15453 #[repr(C)]
15454 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
15455 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
15456 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15457 pub struct CResult_TxInitRbfDecodeErrorZ {
15458         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
15459         /// `err` or `result` depending on the state of `result_ok`.
15460         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
15461         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
15462         pub result_ok: bool,
15463 }
15464 #[no_mangle]
15465 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
15466 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
15467         CResult_TxInitRbfDecodeErrorZ {
15468                 contents: CResult_TxInitRbfDecodeErrorZPtr {
15469                         result: Box::into_raw(Box::new(o)),
15470                 },
15471                 result_ok: true,
15472         }
15473 }
15474 #[no_mangle]
15475 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
15476 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
15477         CResult_TxInitRbfDecodeErrorZ {
15478                 contents: CResult_TxInitRbfDecodeErrorZPtr {
15479                         err: Box::into_raw(Box::new(e)),
15480                 },
15481                 result_ok: false,
15482         }
15483 }
15484 /// Checks if the given object is currently in the success state
15485 #[no_mangle]
15486 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
15487         o.result_ok
15488 }
15489 #[no_mangle]
15490 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
15491 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
15492 impl Drop for CResult_TxInitRbfDecodeErrorZ {
15493         fn drop(&mut self) {
15494                 if self.result_ok {
15495                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15496                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15497                         }
15498                 } else {
15499                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15500                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15501                         }
15502                 }
15503         }
15504 }
15505 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
15506         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
15507                 let contents = if o.result_ok {
15508                         let result = unsafe { o.contents.result };
15509                         unsafe { o.contents.result = core::ptr::null_mut() };
15510                         CResult_TxInitRbfDecodeErrorZPtr { result }
15511                 } else {
15512                         let err = unsafe { o.contents.err };
15513                         unsafe { o.contents.err = core::ptr::null_mut(); }
15514                         CResult_TxInitRbfDecodeErrorZPtr { err }
15515                 };
15516                 Self {
15517                         contents,
15518                         result_ok: o.result_ok,
15519                 }
15520         }
15521 }
15522 impl Clone for CResult_TxInitRbfDecodeErrorZ {
15523         fn clone(&self) -> Self {
15524                 if self.result_ok {
15525                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
15526                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
15527                         } }
15528                 } else {
15529                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
15530                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15531                         } }
15532                 }
15533         }
15534 }
15535 #[no_mangle]
15536 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
15537 /// but with all dynamically-allocated buffers duplicated in new buffers.
15538 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
15539 #[repr(C)]
15540 /// The contents of CResult_TxAckRbfDecodeErrorZ
15541 pub union CResult_TxAckRbfDecodeErrorZPtr {
15542         /// A pointer to the contents in the success state.
15543         /// Reading from this pointer when `result_ok` is not set is undefined.
15544         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
15545         /// A pointer to the contents in the error state.
15546         /// Reading from this pointer when `result_ok` is set is undefined.
15547         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15548 }
15549 #[repr(C)]
15550 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
15551 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
15552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15553 pub struct CResult_TxAckRbfDecodeErrorZ {
15554         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
15555         /// `err` or `result` depending on the state of `result_ok`.
15556         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
15557         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
15558         pub result_ok: bool,
15559 }
15560 #[no_mangle]
15561 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
15562 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
15563         CResult_TxAckRbfDecodeErrorZ {
15564                 contents: CResult_TxAckRbfDecodeErrorZPtr {
15565                         result: Box::into_raw(Box::new(o)),
15566                 },
15567                 result_ok: true,
15568         }
15569 }
15570 #[no_mangle]
15571 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
15572 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
15573         CResult_TxAckRbfDecodeErrorZ {
15574                 contents: CResult_TxAckRbfDecodeErrorZPtr {
15575                         err: Box::into_raw(Box::new(e)),
15576                 },
15577                 result_ok: false,
15578         }
15579 }
15580 /// Checks if the given object is currently in the success state
15581 #[no_mangle]
15582 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
15583         o.result_ok
15584 }
15585 #[no_mangle]
15586 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
15587 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
15588 impl Drop for CResult_TxAckRbfDecodeErrorZ {
15589         fn drop(&mut self) {
15590                 if self.result_ok {
15591                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15592                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15593                         }
15594                 } else {
15595                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15596                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15597                         }
15598                 }
15599         }
15600 }
15601 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
15602         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
15603                 let contents = if o.result_ok {
15604                         let result = unsafe { o.contents.result };
15605                         unsafe { o.contents.result = core::ptr::null_mut() };
15606                         CResult_TxAckRbfDecodeErrorZPtr { result }
15607                 } else {
15608                         let err = unsafe { o.contents.err };
15609                         unsafe { o.contents.err = core::ptr::null_mut(); }
15610                         CResult_TxAckRbfDecodeErrorZPtr { err }
15611                 };
15612                 Self {
15613                         contents,
15614                         result_ok: o.result_ok,
15615                 }
15616         }
15617 }
15618 impl Clone for CResult_TxAckRbfDecodeErrorZ {
15619         fn clone(&self) -> Self {
15620                 if self.result_ok {
15621                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
15622                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
15623                         } }
15624                 } else {
15625                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
15626                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15627                         } }
15628                 }
15629         }
15630 }
15631 #[no_mangle]
15632 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
15633 /// but with all dynamically-allocated buffers duplicated in new buffers.
15634 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
15635 #[repr(C)]
15636 /// The contents of CResult_TxAbortDecodeErrorZ
15637 pub union CResult_TxAbortDecodeErrorZPtr {
15638         /// A pointer to the contents in the success state.
15639         /// Reading from this pointer when `result_ok` is not set is undefined.
15640         pub result: *mut crate::lightning::ln::msgs::TxAbort,
15641         /// A pointer to the contents in the error state.
15642         /// Reading from this pointer when `result_ok` is set is undefined.
15643         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15644 }
15645 #[repr(C)]
15646 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
15647 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
15648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15649 pub struct CResult_TxAbortDecodeErrorZ {
15650         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
15651         /// `err` or `result` depending on the state of `result_ok`.
15652         pub contents: CResult_TxAbortDecodeErrorZPtr,
15653         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
15654         pub result_ok: bool,
15655 }
15656 #[no_mangle]
15657 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
15658 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
15659         CResult_TxAbortDecodeErrorZ {
15660                 contents: CResult_TxAbortDecodeErrorZPtr {
15661                         result: Box::into_raw(Box::new(o)),
15662                 },
15663                 result_ok: true,
15664         }
15665 }
15666 #[no_mangle]
15667 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
15668 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
15669         CResult_TxAbortDecodeErrorZ {
15670                 contents: CResult_TxAbortDecodeErrorZPtr {
15671                         err: Box::into_raw(Box::new(e)),
15672                 },
15673                 result_ok: false,
15674         }
15675 }
15676 /// Checks if the given object is currently in the success state
15677 #[no_mangle]
15678 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
15679         o.result_ok
15680 }
15681 #[no_mangle]
15682 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
15683 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
15684 impl Drop for CResult_TxAbortDecodeErrorZ {
15685         fn drop(&mut self) {
15686                 if self.result_ok {
15687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15689                         }
15690                 } else {
15691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15693                         }
15694                 }
15695         }
15696 }
15697 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
15698         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
15699                 let contents = if o.result_ok {
15700                         let result = unsafe { o.contents.result };
15701                         unsafe { o.contents.result = core::ptr::null_mut() };
15702                         CResult_TxAbortDecodeErrorZPtr { result }
15703                 } else {
15704                         let err = unsafe { o.contents.err };
15705                         unsafe { o.contents.err = core::ptr::null_mut(); }
15706                         CResult_TxAbortDecodeErrorZPtr { err }
15707                 };
15708                 Self {
15709                         contents,
15710                         result_ok: o.result_ok,
15711                 }
15712         }
15713 }
15714 impl Clone for CResult_TxAbortDecodeErrorZ {
15715         fn clone(&self) -> Self {
15716                 if self.result_ok {
15717                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
15718                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
15719                         } }
15720                 } else {
15721                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
15722                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15723                         } }
15724                 }
15725         }
15726 }
15727 #[no_mangle]
15728 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
15729 /// but with all dynamically-allocated buffers duplicated in new buffers.
15730 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
15731 #[repr(C)]
15732 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
15733 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
15734         /// A pointer to the contents in the success state.
15735         /// Reading from this pointer when `result_ok` is not set is undefined.
15736         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
15737         /// A pointer to the contents in the error state.
15738         /// Reading from this pointer when `result_ok` is set is undefined.
15739         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15740 }
15741 #[repr(C)]
15742 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
15743 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
15744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15745 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
15746         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
15747         /// `err` or `result` depending on the state of `result_ok`.
15748         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
15749         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
15750         pub result_ok: bool,
15751 }
15752 #[no_mangle]
15753 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15754 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
15755         CResult_AnnouncementSignaturesDecodeErrorZ {
15756                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15757                         result: Box::into_raw(Box::new(o)),
15758                 },
15759                 result_ok: true,
15760         }
15761 }
15762 #[no_mangle]
15763 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15764 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
15765         CResult_AnnouncementSignaturesDecodeErrorZ {
15766                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15767                         err: Box::into_raw(Box::new(e)),
15768                 },
15769                 result_ok: false,
15770         }
15771 }
15772 /// Checks if the given object is currently in the success state
15773 #[no_mangle]
15774 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
15775         o.result_ok
15776 }
15777 #[no_mangle]
15778 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15779 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
15780 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
15781         fn drop(&mut self) {
15782                 if self.result_ok {
15783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15785                         }
15786                 } else {
15787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15789                         }
15790                 }
15791         }
15792 }
15793 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
15794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
15795                 let contents = if o.result_ok {
15796                         let result = unsafe { o.contents.result };
15797                         unsafe { o.contents.result = core::ptr::null_mut() };
15798                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
15799                 } else {
15800                         let err = unsafe { o.contents.err };
15801                         unsafe { o.contents.err = core::ptr::null_mut(); }
15802                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
15803                 };
15804                 Self {
15805                         contents,
15806                         result_ok: o.result_ok,
15807                 }
15808         }
15809 }
15810 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
15811         fn clone(&self) -> Self {
15812                 if self.result_ok {
15813                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15814                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
15815                         } }
15816                 } else {
15817                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15819                         } }
15820                 }
15821         }
15822 }
15823 #[no_mangle]
15824 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15825 /// but with all dynamically-allocated buffers duplicated in new buffers.
15826 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
15827 #[repr(C)]
15828 /// The contents of CResult_ChannelReestablishDecodeErrorZ
15829 pub union CResult_ChannelReestablishDecodeErrorZPtr {
15830         /// A pointer to the contents in the success state.
15831         /// Reading from this pointer when `result_ok` is not set is undefined.
15832         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
15833         /// A pointer to the contents in the error state.
15834         /// Reading from this pointer when `result_ok` is set is undefined.
15835         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15836 }
15837 #[repr(C)]
15838 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
15839 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
15840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15841 pub struct CResult_ChannelReestablishDecodeErrorZ {
15842         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
15843         /// `err` or `result` depending on the state of `result_ok`.
15844         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
15845         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
15846         pub result_ok: bool,
15847 }
15848 #[no_mangle]
15849 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15850 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
15851         CResult_ChannelReestablishDecodeErrorZ {
15852                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
15853                         result: Box::into_raw(Box::new(o)),
15854                 },
15855                 result_ok: true,
15856         }
15857 }
15858 #[no_mangle]
15859 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15860 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
15861         CResult_ChannelReestablishDecodeErrorZ {
15862                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
15863                         err: Box::into_raw(Box::new(e)),
15864                 },
15865                 result_ok: false,
15866         }
15867 }
15868 /// Checks if the given object is currently in the success state
15869 #[no_mangle]
15870 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
15871         o.result_ok
15872 }
15873 #[no_mangle]
15874 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15875 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
15876 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
15877         fn drop(&mut self) {
15878                 if self.result_ok {
15879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15881                         }
15882                 } else {
15883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15885                         }
15886                 }
15887         }
15888 }
15889 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
15890         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
15891                 let contents = if o.result_ok {
15892                         let result = unsafe { o.contents.result };
15893                         unsafe { o.contents.result = core::ptr::null_mut() };
15894                         CResult_ChannelReestablishDecodeErrorZPtr { result }
15895                 } else {
15896                         let err = unsafe { o.contents.err };
15897                         unsafe { o.contents.err = core::ptr::null_mut(); }
15898                         CResult_ChannelReestablishDecodeErrorZPtr { err }
15899                 };
15900                 Self {
15901                         contents,
15902                         result_ok: o.result_ok,
15903                 }
15904         }
15905 }
15906 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
15907         fn clone(&self) -> Self {
15908                 if self.result_ok {
15909                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
15910                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
15911                         } }
15912                 } else {
15913                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
15914                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15915                         } }
15916                 }
15917         }
15918 }
15919 #[no_mangle]
15920 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15921 /// but with all dynamically-allocated buffers duplicated in new buffers.
15922 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
15923 #[repr(C)]
15924 /// The contents of CResult_ClosingSignedDecodeErrorZ
15925 pub union CResult_ClosingSignedDecodeErrorZPtr {
15926         /// A pointer to the contents in the success state.
15927         /// Reading from this pointer when `result_ok` is not set is undefined.
15928         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
15929         /// A pointer to the contents in the error state.
15930         /// Reading from this pointer when `result_ok` is set is undefined.
15931         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15932 }
15933 #[repr(C)]
15934 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
15935 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15936 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15937 pub struct CResult_ClosingSignedDecodeErrorZ {
15938         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
15939         /// `err` or `result` depending on the state of `result_ok`.
15940         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
15941         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
15942         pub result_ok: bool,
15943 }
15944 #[no_mangle]
15945 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15946 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
15947         CResult_ClosingSignedDecodeErrorZ {
15948                 contents: CResult_ClosingSignedDecodeErrorZPtr {
15949                         result: Box::into_raw(Box::new(o)),
15950                 },
15951                 result_ok: true,
15952         }
15953 }
15954 #[no_mangle]
15955 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15956 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
15957         CResult_ClosingSignedDecodeErrorZ {
15958                 contents: CResult_ClosingSignedDecodeErrorZPtr {
15959                         err: Box::into_raw(Box::new(e)),
15960                 },
15961                 result_ok: false,
15962         }
15963 }
15964 /// Checks if the given object is currently in the success state
15965 #[no_mangle]
15966 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
15967         o.result_ok
15968 }
15969 #[no_mangle]
15970 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15971 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
15972 impl Drop for CResult_ClosingSignedDecodeErrorZ {
15973         fn drop(&mut self) {
15974                 if self.result_ok {
15975                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15976                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15977                         }
15978                 } else {
15979                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15980                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15981                         }
15982                 }
15983         }
15984 }
15985 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
15986         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15987                 let contents = if o.result_ok {
15988                         let result = unsafe { o.contents.result };
15989                         unsafe { o.contents.result = core::ptr::null_mut() };
15990                         CResult_ClosingSignedDecodeErrorZPtr { result }
15991                 } else {
15992                         let err = unsafe { o.contents.err };
15993                         unsafe { o.contents.err = core::ptr::null_mut(); }
15994                         CResult_ClosingSignedDecodeErrorZPtr { err }
15995                 };
15996                 Self {
15997                         contents,
15998                         result_ok: o.result_ok,
15999                 }
16000         }
16001 }
16002 impl Clone for CResult_ClosingSignedDecodeErrorZ {
16003         fn clone(&self) -> Self {
16004                 if self.result_ok {
16005                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
16006                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
16007                         } }
16008                 } else {
16009                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
16010                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16011                         } }
16012                 }
16013         }
16014 }
16015 #[no_mangle]
16016 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16017 /// but with all dynamically-allocated buffers duplicated in new buffers.
16018 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
16019 #[repr(C)]
16020 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
16021 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16022         /// A pointer to the contents in the success state.
16023         /// Reading from this pointer when `result_ok` is not set is undefined.
16024         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
16025         /// A pointer to the contents in the error state.
16026         /// Reading from this pointer when `result_ok` is set is undefined.
16027         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16028 }
16029 #[repr(C)]
16030 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
16031 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16033 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
16034         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
16035         /// `err` or `result` depending on the state of `result_ok`.
16036         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
16037         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
16038         pub result_ok: bool,
16039 }
16040 #[no_mangle]
16041 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16042 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
16043         CResult_ClosingSignedFeeRangeDecodeErrorZ {
16044                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16045                         result: Box::into_raw(Box::new(o)),
16046                 },
16047                 result_ok: true,
16048         }
16049 }
16050 #[no_mangle]
16051 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16052 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
16053         CResult_ClosingSignedFeeRangeDecodeErrorZ {
16054                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16055                         err: Box::into_raw(Box::new(e)),
16056                 },
16057                 result_ok: false,
16058         }
16059 }
16060 /// Checks if the given object is currently in the success state
16061 #[no_mangle]
16062 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
16063         o.result_ok
16064 }
16065 #[no_mangle]
16066 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16067 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
16068 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16069         fn drop(&mut self) {
16070                 if self.result_ok {
16071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16073                         }
16074                 } else {
16075                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16076                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16077                         }
16078                 }
16079         }
16080 }
16081 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16082         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16083                 let contents = if o.result_ok {
16084                         let result = unsafe { o.contents.result };
16085                         unsafe { o.contents.result = core::ptr::null_mut() };
16086                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
16087                 } else {
16088                         let err = unsafe { o.contents.err };
16089                         unsafe { o.contents.err = core::ptr::null_mut(); }
16090                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
16091                 };
16092                 Self {
16093                         contents,
16094                         result_ok: o.result_ok,
16095                 }
16096         }
16097 }
16098 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16099         fn clone(&self) -> Self {
16100                 if self.result_ok {
16101                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16102                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
16103                         } }
16104                 } else {
16105                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16106                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16107                         } }
16108                 }
16109         }
16110 }
16111 #[no_mangle]
16112 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16113 /// but with all dynamically-allocated buffers duplicated in new buffers.
16114 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
16115 #[repr(C)]
16116 /// The contents of CResult_CommitmentSignedDecodeErrorZ
16117 pub union CResult_CommitmentSignedDecodeErrorZPtr {
16118         /// A pointer to the contents in the success state.
16119         /// Reading from this pointer when `result_ok` is not set is undefined.
16120         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
16121         /// A pointer to the contents in the error state.
16122         /// Reading from this pointer when `result_ok` is set is undefined.
16123         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16124 }
16125 #[repr(C)]
16126 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
16127 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
16128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16129 pub struct CResult_CommitmentSignedDecodeErrorZ {
16130         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
16131         /// `err` or `result` depending on the state of `result_ok`.
16132         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
16133         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
16134         pub result_ok: bool,
16135 }
16136 #[no_mangle]
16137 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16138 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
16139         CResult_CommitmentSignedDecodeErrorZ {
16140                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
16141                         result: Box::into_raw(Box::new(o)),
16142                 },
16143                 result_ok: true,
16144         }
16145 }
16146 #[no_mangle]
16147 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16148 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
16149         CResult_CommitmentSignedDecodeErrorZ {
16150                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
16151                         err: Box::into_raw(Box::new(e)),
16152                 },
16153                 result_ok: false,
16154         }
16155 }
16156 /// Checks if the given object is currently in the success state
16157 #[no_mangle]
16158 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
16159         o.result_ok
16160 }
16161 #[no_mangle]
16162 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16163 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
16164 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
16165         fn drop(&mut self) {
16166                 if self.result_ok {
16167                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16168                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16169                         }
16170                 } else {
16171                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16172                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16173                         }
16174                 }
16175         }
16176 }
16177 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
16178         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
16179                 let contents = if o.result_ok {
16180                         let result = unsafe { o.contents.result };
16181                         unsafe { o.contents.result = core::ptr::null_mut() };
16182                         CResult_CommitmentSignedDecodeErrorZPtr { result }
16183                 } else {
16184                         let err = unsafe { o.contents.err };
16185                         unsafe { o.contents.err = core::ptr::null_mut(); }
16186                         CResult_CommitmentSignedDecodeErrorZPtr { err }
16187                 };
16188                 Self {
16189                         contents,
16190                         result_ok: o.result_ok,
16191                 }
16192         }
16193 }
16194 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
16195         fn clone(&self) -> Self {
16196                 if self.result_ok {
16197                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
16198                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
16199                         } }
16200                 } else {
16201                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
16202                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16203                         } }
16204                 }
16205         }
16206 }
16207 #[no_mangle]
16208 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16209 /// but with all dynamically-allocated buffers duplicated in new buffers.
16210 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
16211 #[repr(C)]
16212 /// The contents of CResult_FundingCreatedDecodeErrorZ
16213 pub union CResult_FundingCreatedDecodeErrorZPtr {
16214         /// A pointer to the contents in the success state.
16215         /// Reading from this pointer when `result_ok` is not set is undefined.
16216         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
16217         /// A pointer to the contents in the error state.
16218         /// Reading from this pointer when `result_ok` is set is undefined.
16219         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16220 }
16221 #[repr(C)]
16222 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
16223 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
16224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16225 pub struct CResult_FundingCreatedDecodeErrorZ {
16226         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
16227         /// `err` or `result` depending on the state of `result_ok`.
16228         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
16229         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
16230         pub result_ok: bool,
16231 }
16232 #[no_mangle]
16233 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16234 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
16235         CResult_FundingCreatedDecodeErrorZ {
16236                 contents: CResult_FundingCreatedDecodeErrorZPtr {
16237                         result: Box::into_raw(Box::new(o)),
16238                 },
16239                 result_ok: true,
16240         }
16241 }
16242 #[no_mangle]
16243 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16244 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
16245         CResult_FundingCreatedDecodeErrorZ {
16246                 contents: CResult_FundingCreatedDecodeErrorZPtr {
16247                         err: Box::into_raw(Box::new(e)),
16248                 },
16249                 result_ok: false,
16250         }
16251 }
16252 /// Checks if the given object is currently in the success state
16253 #[no_mangle]
16254 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
16255         o.result_ok
16256 }
16257 #[no_mangle]
16258 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16259 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
16260 impl Drop for CResult_FundingCreatedDecodeErrorZ {
16261         fn drop(&mut self) {
16262                 if self.result_ok {
16263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16265                         }
16266                 } else {
16267                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16268                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16269                         }
16270                 }
16271         }
16272 }
16273 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
16274         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
16275                 let contents = if o.result_ok {
16276                         let result = unsafe { o.contents.result };
16277                         unsafe { o.contents.result = core::ptr::null_mut() };
16278                         CResult_FundingCreatedDecodeErrorZPtr { result }
16279                 } else {
16280                         let err = unsafe { o.contents.err };
16281                         unsafe { o.contents.err = core::ptr::null_mut(); }
16282                         CResult_FundingCreatedDecodeErrorZPtr { err }
16283                 };
16284                 Self {
16285                         contents,
16286                         result_ok: o.result_ok,
16287                 }
16288         }
16289 }
16290 impl Clone for CResult_FundingCreatedDecodeErrorZ {
16291         fn clone(&self) -> Self {
16292                 if self.result_ok {
16293                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
16294                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
16295                         } }
16296                 } else {
16297                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
16298                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16299                         } }
16300                 }
16301         }
16302 }
16303 #[no_mangle]
16304 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16305 /// but with all dynamically-allocated buffers duplicated in new buffers.
16306 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
16307 #[repr(C)]
16308 /// The contents of CResult_FundingSignedDecodeErrorZ
16309 pub union CResult_FundingSignedDecodeErrorZPtr {
16310         /// A pointer to the contents in the success state.
16311         /// Reading from this pointer when `result_ok` is not set is undefined.
16312         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
16313         /// A pointer to the contents in the error state.
16314         /// Reading from this pointer when `result_ok` is set is undefined.
16315         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16316 }
16317 #[repr(C)]
16318 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
16319 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
16320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16321 pub struct CResult_FundingSignedDecodeErrorZ {
16322         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
16323         /// `err` or `result` depending on the state of `result_ok`.
16324         pub contents: CResult_FundingSignedDecodeErrorZPtr,
16325         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
16326         pub result_ok: bool,
16327 }
16328 #[no_mangle]
16329 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16330 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
16331         CResult_FundingSignedDecodeErrorZ {
16332                 contents: CResult_FundingSignedDecodeErrorZPtr {
16333                         result: Box::into_raw(Box::new(o)),
16334                 },
16335                 result_ok: true,
16336         }
16337 }
16338 #[no_mangle]
16339 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16340 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
16341         CResult_FundingSignedDecodeErrorZ {
16342                 contents: CResult_FundingSignedDecodeErrorZPtr {
16343                         err: Box::into_raw(Box::new(e)),
16344                 },
16345                 result_ok: false,
16346         }
16347 }
16348 /// Checks if the given object is currently in the success state
16349 #[no_mangle]
16350 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
16351         o.result_ok
16352 }
16353 #[no_mangle]
16354 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16355 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
16356 impl Drop for CResult_FundingSignedDecodeErrorZ {
16357         fn drop(&mut self) {
16358                 if self.result_ok {
16359                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16360                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16361                         }
16362                 } else {
16363                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16364                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16365                         }
16366                 }
16367         }
16368 }
16369 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
16370         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
16371                 let contents = if o.result_ok {
16372                         let result = unsafe { o.contents.result };
16373                         unsafe { o.contents.result = core::ptr::null_mut() };
16374                         CResult_FundingSignedDecodeErrorZPtr { result }
16375                 } else {
16376                         let err = unsafe { o.contents.err };
16377                         unsafe { o.contents.err = core::ptr::null_mut(); }
16378                         CResult_FundingSignedDecodeErrorZPtr { err }
16379                 };
16380                 Self {
16381                         contents,
16382                         result_ok: o.result_ok,
16383                 }
16384         }
16385 }
16386 impl Clone for CResult_FundingSignedDecodeErrorZ {
16387         fn clone(&self) -> Self {
16388                 if self.result_ok {
16389                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
16390                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
16391                         } }
16392                 } else {
16393                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
16394                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16395                         } }
16396                 }
16397         }
16398 }
16399 #[no_mangle]
16400 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16401 /// but with all dynamically-allocated buffers duplicated in new buffers.
16402 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
16403 #[repr(C)]
16404 /// The contents of CResult_ChannelReadyDecodeErrorZ
16405 pub union CResult_ChannelReadyDecodeErrorZPtr {
16406         /// A pointer to the contents in the success state.
16407         /// Reading from this pointer when `result_ok` is not set is undefined.
16408         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
16409         /// A pointer to the contents in the error state.
16410         /// Reading from this pointer when `result_ok` is set is undefined.
16411         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16412 }
16413 #[repr(C)]
16414 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
16415 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
16416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16417 pub struct CResult_ChannelReadyDecodeErrorZ {
16418         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
16419         /// `err` or `result` depending on the state of `result_ok`.
16420         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
16421         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
16422         pub result_ok: bool,
16423 }
16424 #[no_mangle]
16425 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16426 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
16427         CResult_ChannelReadyDecodeErrorZ {
16428                 contents: CResult_ChannelReadyDecodeErrorZPtr {
16429                         result: Box::into_raw(Box::new(o)),
16430                 },
16431                 result_ok: true,
16432         }
16433 }
16434 #[no_mangle]
16435 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16436 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
16437         CResult_ChannelReadyDecodeErrorZ {
16438                 contents: CResult_ChannelReadyDecodeErrorZPtr {
16439                         err: Box::into_raw(Box::new(e)),
16440                 },
16441                 result_ok: false,
16442         }
16443 }
16444 /// Checks if the given object is currently in the success state
16445 #[no_mangle]
16446 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
16447         o.result_ok
16448 }
16449 #[no_mangle]
16450 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16451 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
16452 impl Drop for CResult_ChannelReadyDecodeErrorZ {
16453         fn drop(&mut self) {
16454                 if self.result_ok {
16455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16457                         }
16458                 } else {
16459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16461                         }
16462                 }
16463         }
16464 }
16465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
16466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
16467                 let contents = if o.result_ok {
16468                         let result = unsafe { o.contents.result };
16469                         unsafe { o.contents.result = core::ptr::null_mut() };
16470                         CResult_ChannelReadyDecodeErrorZPtr { result }
16471                 } else {
16472                         let err = unsafe { o.contents.err };
16473                         unsafe { o.contents.err = core::ptr::null_mut(); }
16474                         CResult_ChannelReadyDecodeErrorZPtr { err }
16475                 };
16476                 Self {
16477                         contents,
16478                         result_ok: o.result_ok,
16479                 }
16480         }
16481 }
16482 impl Clone for CResult_ChannelReadyDecodeErrorZ {
16483         fn clone(&self) -> Self {
16484                 if self.result_ok {
16485                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
16486                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
16487                         } }
16488                 } else {
16489                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
16490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16491                         } }
16492                 }
16493         }
16494 }
16495 #[no_mangle]
16496 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16497 /// but with all dynamically-allocated buffers duplicated in new buffers.
16498 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
16499 #[repr(C)]
16500 /// The contents of CResult_InitDecodeErrorZ
16501 pub union CResult_InitDecodeErrorZPtr {
16502         /// A pointer to the contents in the success state.
16503         /// Reading from this pointer when `result_ok` is not set is undefined.
16504         pub result: *mut crate::lightning::ln::msgs::Init,
16505         /// A pointer to the contents in the error state.
16506         /// Reading from this pointer when `result_ok` is set is undefined.
16507         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16508 }
16509 #[repr(C)]
16510 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
16511 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
16512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16513 pub struct CResult_InitDecodeErrorZ {
16514         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
16515         /// `err` or `result` depending on the state of `result_ok`.
16516         pub contents: CResult_InitDecodeErrorZPtr,
16517         /// Whether this CResult_InitDecodeErrorZ represents a success state.
16518         pub result_ok: bool,
16519 }
16520 #[no_mangle]
16521 /// Creates a new CResult_InitDecodeErrorZ in the success state.
16522 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
16523         CResult_InitDecodeErrorZ {
16524                 contents: CResult_InitDecodeErrorZPtr {
16525                         result: Box::into_raw(Box::new(o)),
16526                 },
16527                 result_ok: true,
16528         }
16529 }
16530 #[no_mangle]
16531 /// Creates a new CResult_InitDecodeErrorZ in the error state.
16532 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
16533         CResult_InitDecodeErrorZ {
16534                 contents: CResult_InitDecodeErrorZPtr {
16535                         err: Box::into_raw(Box::new(e)),
16536                 },
16537                 result_ok: false,
16538         }
16539 }
16540 /// Checks if the given object is currently in the success state
16541 #[no_mangle]
16542 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
16543         o.result_ok
16544 }
16545 #[no_mangle]
16546 /// Frees any resources used by the CResult_InitDecodeErrorZ.
16547 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
16548 impl Drop for CResult_InitDecodeErrorZ {
16549         fn drop(&mut self) {
16550                 if self.result_ok {
16551                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16552                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16553                         }
16554                 } else {
16555                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16556                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16557                         }
16558                 }
16559         }
16560 }
16561 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
16562         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
16563                 let contents = if o.result_ok {
16564                         let result = unsafe { o.contents.result };
16565                         unsafe { o.contents.result = core::ptr::null_mut() };
16566                         CResult_InitDecodeErrorZPtr { result }
16567                 } else {
16568                         let err = unsafe { o.contents.err };
16569                         unsafe { o.contents.err = core::ptr::null_mut(); }
16570                         CResult_InitDecodeErrorZPtr { err }
16571                 };
16572                 Self {
16573                         contents,
16574                         result_ok: o.result_ok,
16575                 }
16576         }
16577 }
16578 impl Clone for CResult_InitDecodeErrorZ {
16579         fn clone(&self) -> Self {
16580                 if self.result_ok {
16581                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
16582                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
16583                         } }
16584                 } else {
16585                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
16586                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16587                         } }
16588                 }
16589         }
16590 }
16591 #[no_mangle]
16592 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16593 /// but with all dynamically-allocated buffers duplicated in new buffers.
16594 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
16595 #[repr(C)]
16596 /// The contents of CResult_OpenChannelDecodeErrorZ
16597 pub union CResult_OpenChannelDecodeErrorZPtr {
16598         /// A pointer to the contents in the success state.
16599         /// Reading from this pointer when `result_ok` is not set is undefined.
16600         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
16601         /// A pointer to the contents in the error state.
16602         /// Reading from this pointer when `result_ok` is set is undefined.
16603         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16604 }
16605 #[repr(C)]
16606 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
16607 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
16608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16609 pub struct CResult_OpenChannelDecodeErrorZ {
16610         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
16611         /// `err` or `result` depending on the state of `result_ok`.
16612         pub contents: CResult_OpenChannelDecodeErrorZPtr,
16613         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
16614         pub result_ok: bool,
16615 }
16616 #[no_mangle]
16617 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16618 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
16619         CResult_OpenChannelDecodeErrorZ {
16620                 contents: CResult_OpenChannelDecodeErrorZPtr {
16621                         result: Box::into_raw(Box::new(o)),
16622                 },
16623                 result_ok: true,
16624         }
16625 }
16626 #[no_mangle]
16627 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16628 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
16629         CResult_OpenChannelDecodeErrorZ {
16630                 contents: CResult_OpenChannelDecodeErrorZPtr {
16631                         err: Box::into_raw(Box::new(e)),
16632                 },
16633                 result_ok: false,
16634         }
16635 }
16636 /// Checks if the given object is currently in the success state
16637 #[no_mangle]
16638 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
16639         o.result_ok
16640 }
16641 #[no_mangle]
16642 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16643 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
16644 impl Drop for CResult_OpenChannelDecodeErrorZ {
16645         fn drop(&mut self) {
16646                 if self.result_ok {
16647                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16648                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16649                         }
16650                 } else {
16651                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16652                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16653                         }
16654                 }
16655         }
16656 }
16657 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
16658         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
16659                 let contents = if o.result_ok {
16660                         let result = unsafe { o.contents.result };
16661                         unsafe { o.contents.result = core::ptr::null_mut() };
16662                         CResult_OpenChannelDecodeErrorZPtr { result }
16663                 } else {
16664                         let err = unsafe { o.contents.err };
16665                         unsafe { o.contents.err = core::ptr::null_mut(); }
16666                         CResult_OpenChannelDecodeErrorZPtr { err }
16667                 };
16668                 Self {
16669                         contents,
16670                         result_ok: o.result_ok,
16671                 }
16672         }
16673 }
16674 impl Clone for CResult_OpenChannelDecodeErrorZ {
16675         fn clone(&self) -> Self {
16676                 if self.result_ok {
16677                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
16678                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
16679                         } }
16680                 } else {
16681                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
16682                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16683                         } }
16684                 }
16685         }
16686 }
16687 #[no_mangle]
16688 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16689 /// but with all dynamically-allocated buffers duplicated in new buffers.
16690 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
16691 #[repr(C)]
16692 /// The contents of CResult_OpenChannelV2DecodeErrorZ
16693 pub union CResult_OpenChannelV2DecodeErrorZPtr {
16694         /// A pointer to the contents in the success state.
16695         /// Reading from this pointer when `result_ok` is not set is undefined.
16696         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
16697         /// A pointer to the contents in the error state.
16698         /// Reading from this pointer when `result_ok` is set is undefined.
16699         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16700 }
16701 #[repr(C)]
16702 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
16703 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
16704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16705 pub struct CResult_OpenChannelV2DecodeErrorZ {
16706         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
16707         /// `err` or `result` depending on the state of `result_ok`.
16708         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
16709         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
16710         pub result_ok: bool,
16711 }
16712 #[no_mangle]
16713 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
16714 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
16715         CResult_OpenChannelV2DecodeErrorZ {
16716                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
16717                         result: Box::into_raw(Box::new(o)),
16718                 },
16719                 result_ok: true,
16720         }
16721 }
16722 #[no_mangle]
16723 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
16724 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
16725         CResult_OpenChannelV2DecodeErrorZ {
16726                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
16727                         err: Box::into_raw(Box::new(e)),
16728                 },
16729                 result_ok: false,
16730         }
16731 }
16732 /// Checks if the given object is currently in the success state
16733 #[no_mangle]
16734 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
16735         o.result_ok
16736 }
16737 #[no_mangle]
16738 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
16739 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
16740 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
16741         fn drop(&mut self) {
16742                 if self.result_ok {
16743                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16744                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16745                         }
16746                 } else {
16747                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16748                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16749                         }
16750                 }
16751         }
16752 }
16753 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
16754         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
16755                 let contents = if o.result_ok {
16756                         let result = unsafe { o.contents.result };
16757                         unsafe { o.contents.result = core::ptr::null_mut() };
16758                         CResult_OpenChannelV2DecodeErrorZPtr { result }
16759                 } else {
16760                         let err = unsafe { o.contents.err };
16761                         unsafe { o.contents.err = core::ptr::null_mut(); }
16762                         CResult_OpenChannelV2DecodeErrorZPtr { err }
16763                 };
16764                 Self {
16765                         contents,
16766                         result_ok: o.result_ok,
16767                 }
16768         }
16769 }
16770 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
16771         fn clone(&self) -> Self {
16772                 if self.result_ok {
16773                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
16774                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
16775                         } }
16776                 } else {
16777                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
16778                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16779                         } }
16780                 }
16781         }
16782 }
16783 #[no_mangle]
16784 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
16785 /// but with all dynamically-allocated buffers duplicated in new buffers.
16786 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
16787 #[repr(C)]
16788 /// The contents of CResult_RevokeAndACKDecodeErrorZ
16789 pub union CResult_RevokeAndACKDecodeErrorZPtr {
16790         /// A pointer to the contents in the success state.
16791         /// Reading from this pointer when `result_ok` is not set is undefined.
16792         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
16793         /// A pointer to the contents in the error state.
16794         /// Reading from this pointer when `result_ok` is set is undefined.
16795         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16796 }
16797 #[repr(C)]
16798 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
16799 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
16800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16801 pub struct CResult_RevokeAndACKDecodeErrorZ {
16802         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
16803         /// `err` or `result` depending on the state of `result_ok`.
16804         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
16805         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
16806         pub result_ok: bool,
16807 }
16808 #[no_mangle]
16809 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16810 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
16811         CResult_RevokeAndACKDecodeErrorZ {
16812                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
16813                         result: Box::into_raw(Box::new(o)),
16814                 },
16815                 result_ok: true,
16816         }
16817 }
16818 #[no_mangle]
16819 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16820 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
16821         CResult_RevokeAndACKDecodeErrorZ {
16822                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
16823                         err: Box::into_raw(Box::new(e)),
16824                 },
16825                 result_ok: false,
16826         }
16827 }
16828 /// Checks if the given object is currently in the success state
16829 #[no_mangle]
16830 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
16831         o.result_ok
16832 }
16833 #[no_mangle]
16834 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16835 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
16836 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
16837         fn drop(&mut self) {
16838                 if self.result_ok {
16839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16841                         }
16842                 } else {
16843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16845                         }
16846                 }
16847         }
16848 }
16849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
16850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
16851                 let contents = if o.result_ok {
16852                         let result = unsafe { o.contents.result };
16853                         unsafe { o.contents.result = core::ptr::null_mut() };
16854                         CResult_RevokeAndACKDecodeErrorZPtr { result }
16855                 } else {
16856                         let err = unsafe { o.contents.err };
16857                         unsafe { o.contents.err = core::ptr::null_mut(); }
16858                         CResult_RevokeAndACKDecodeErrorZPtr { err }
16859                 };
16860                 Self {
16861                         contents,
16862                         result_ok: o.result_ok,
16863                 }
16864         }
16865 }
16866 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
16867         fn clone(&self) -> Self {
16868                 if self.result_ok {
16869                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
16870                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
16871                         } }
16872                 } else {
16873                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
16874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16875                         } }
16876                 }
16877         }
16878 }
16879 #[no_mangle]
16880 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16881 /// but with all dynamically-allocated buffers duplicated in new buffers.
16882 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
16883 #[repr(C)]
16884 /// The contents of CResult_ShutdownDecodeErrorZ
16885 pub union CResult_ShutdownDecodeErrorZPtr {
16886         /// A pointer to the contents in the success state.
16887         /// Reading from this pointer when `result_ok` is not set is undefined.
16888         pub result: *mut crate::lightning::ln::msgs::Shutdown,
16889         /// A pointer to the contents in the error state.
16890         /// Reading from this pointer when `result_ok` is set is undefined.
16891         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16892 }
16893 #[repr(C)]
16894 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
16895 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
16896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16897 pub struct CResult_ShutdownDecodeErrorZ {
16898         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
16899         /// `err` or `result` depending on the state of `result_ok`.
16900         pub contents: CResult_ShutdownDecodeErrorZPtr,
16901         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
16902         pub result_ok: bool,
16903 }
16904 #[no_mangle]
16905 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16906 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
16907         CResult_ShutdownDecodeErrorZ {
16908                 contents: CResult_ShutdownDecodeErrorZPtr {
16909                         result: Box::into_raw(Box::new(o)),
16910                 },
16911                 result_ok: true,
16912         }
16913 }
16914 #[no_mangle]
16915 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16916 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
16917         CResult_ShutdownDecodeErrorZ {
16918                 contents: CResult_ShutdownDecodeErrorZPtr {
16919                         err: Box::into_raw(Box::new(e)),
16920                 },
16921                 result_ok: false,
16922         }
16923 }
16924 /// Checks if the given object is currently in the success state
16925 #[no_mangle]
16926 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
16927         o.result_ok
16928 }
16929 #[no_mangle]
16930 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16931 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
16932 impl Drop for CResult_ShutdownDecodeErrorZ {
16933         fn drop(&mut self) {
16934                 if self.result_ok {
16935                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16936                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16937                         }
16938                 } else {
16939                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16940                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16941                         }
16942                 }
16943         }
16944 }
16945 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
16946         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
16947                 let contents = if o.result_ok {
16948                         let result = unsafe { o.contents.result };
16949                         unsafe { o.contents.result = core::ptr::null_mut() };
16950                         CResult_ShutdownDecodeErrorZPtr { result }
16951                 } else {
16952                         let err = unsafe { o.contents.err };
16953                         unsafe { o.contents.err = core::ptr::null_mut(); }
16954                         CResult_ShutdownDecodeErrorZPtr { err }
16955                 };
16956                 Self {
16957                         contents,
16958                         result_ok: o.result_ok,
16959                 }
16960         }
16961 }
16962 impl Clone for CResult_ShutdownDecodeErrorZ {
16963         fn clone(&self) -> Self {
16964                 if self.result_ok {
16965                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
16966                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
16967                         } }
16968                 } else {
16969                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
16970                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16971                         } }
16972                 }
16973         }
16974 }
16975 #[no_mangle]
16976 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16977 /// but with all dynamically-allocated buffers duplicated in new buffers.
16978 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
16979 #[repr(C)]
16980 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
16981 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
16982         /// A pointer to the contents in the success state.
16983         /// Reading from this pointer when `result_ok` is not set is undefined.
16984         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
16985         /// A pointer to the contents in the error state.
16986         /// Reading from this pointer when `result_ok` is set is undefined.
16987         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16988 }
16989 #[repr(C)]
16990 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
16991 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16993 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
16994         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
16995         /// `err` or `result` depending on the state of `result_ok`.
16996         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
16997         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
16998         pub result_ok: bool,
16999 }
17000 #[no_mangle]
17001 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
17002 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
17003         CResult_UpdateFailHTLCDecodeErrorZ {
17004                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17005                         result: Box::into_raw(Box::new(o)),
17006                 },
17007                 result_ok: true,
17008         }
17009 }
17010 #[no_mangle]
17011 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
17012 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
17013         CResult_UpdateFailHTLCDecodeErrorZ {
17014                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17015                         err: Box::into_raw(Box::new(e)),
17016                 },
17017                 result_ok: false,
17018         }
17019 }
17020 /// Checks if the given object is currently in the success state
17021 #[no_mangle]
17022 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
17023         o.result_ok
17024 }
17025 #[no_mangle]
17026 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
17027 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
17028 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
17029         fn drop(&mut self) {
17030                 if self.result_ok {
17031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17033                         }
17034                 } else {
17035                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17036                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17037                         }
17038                 }
17039         }
17040 }
17041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
17042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17043                 let contents = if o.result_ok {
17044                         let result = unsafe { o.contents.result };
17045                         unsafe { o.contents.result = core::ptr::null_mut() };
17046                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
17047                 } else {
17048                         let err = unsafe { o.contents.err };
17049                         unsafe { o.contents.err = core::ptr::null_mut(); }
17050                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
17051                 };
17052                 Self {
17053                         contents,
17054                         result_ok: o.result_ok,
17055                 }
17056         }
17057 }
17058 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
17059         fn clone(&self) -> Self {
17060                 if self.result_ok {
17061                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17062                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
17063                         } }
17064                 } else {
17065                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17066                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17067                         } }
17068                 }
17069         }
17070 }
17071 #[no_mangle]
17072 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
17073 /// but with all dynamically-allocated buffers duplicated in new buffers.
17074 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
17075 #[repr(C)]
17076 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
17077 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17078         /// A pointer to the contents in the success state.
17079         /// Reading from this pointer when `result_ok` is not set is undefined.
17080         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
17081         /// A pointer to the contents in the error state.
17082         /// Reading from this pointer when `result_ok` is set is undefined.
17083         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17084 }
17085 #[repr(C)]
17086 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
17087 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17089 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17090         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
17091         /// `err` or `result` depending on the state of `result_ok`.
17092         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
17093         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
17094         pub result_ok: bool,
17095 }
17096 #[no_mangle]
17097 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
17098 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17099         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17100                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17101                         result: Box::into_raw(Box::new(o)),
17102                 },
17103                 result_ok: true,
17104         }
17105 }
17106 #[no_mangle]
17107 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
17108 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17109         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17110                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17111                         err: Box::into_raw(Box::new(e)),
17112                 },
17113                 result_ok: false,
17114         }
17115 }
17116 /// Checks if the given object is currently in the success state
17117 #[no_mangle]
17118 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
17119         o.result_ok
17120 }
17121 #[no_mangle]
17122 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
17123 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
17124 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17125         fn drop(&mut self) {
17126                 if self.result_ok {
17127                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17128                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17129                         }
17130                 } else {
17131                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17132                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17133                         }
17134                 }
17135         }
17136 }
17137 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17138         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17139                 let contents = if o.result_ok {
17140                         let result = unsafe { o.contents.result };
17141                         unsafe { o.contents.result = core::ptr::null_mut() };
17142                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
17143                 } else {
17144                         let err = unsafe { o.contents.err };
17145                         unsafe { o.contents.err = core::ptr::null_mut(); }
17146                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
17147                 };
17148                 Self {
17149                         contents,
17150                         result_ok: o.result_ok,
17151                 }
17152         }
17153 }
17154 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17155         fn clone(&self) -> Self {
17156                 if self.result_ok {
17157                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17158                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
17159                         } }
17160                 } else {
17161                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17162                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17163                         } }
17164                 }
17165         }
17166 }
17167 #[no_mangle]
17168 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
17169 /// but with all dynamically-allocated buffers duplicated in new buffers.
17170 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
17171 #[repr(C)]
17172 /// The contents of CResult_UpdateFeeDecodeErrorZ
17173 pub union CResult_UpdateFeeDecodeErrorZPtr {
17174         /// A pointer to the contents in the success state.
17175         /// Reading from this pointer when `result_ok` is not set is undefined.
17176         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
17177         /// A pointer to the contents in the error state.
17178         /// Reading from this pointer when `result_ok` is set is undefined.
17179         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17180 }
17181 #[repr(C)]
17182 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
17183 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
17184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17185 pub struct CResult_UpdateFeeDecodeErrorZ {
17186         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
17187         /// `err` or `result` depending on the state of `result_ok`.
17188         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
17189         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
17190         pub result_ok: bool,
17191 }
17192 #[no_mangle]
17193 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
17194 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
17195         CResult_UpdateFeeDecodeErrorZ {
17196                 contents: CResult_UpdateFeeDecodeErrorZPtr {
17197                         result: Box::into_raw(Box::new(o)),
17198                 },
17199                 result_ok: true,
17200         }
17201 }
17202 #[no_mangle]
17203 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
17204 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
17205         CResult_UpdateFeeDecodeErrorZ {
17206                 contents: CResult_UpdateFeeDecodeErrorZPtr {
17207                         err: Box::into_raw(Box::new(e)),
17208                 },
17209                 result_ok: false,
17210         }
17211 }
17212 /// Checks if the given object is currently in the success state
17213 #[no_mangle]
17214 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
17215         o.result_ok
17216 }
17217 #[no_mangle]
17218 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
17219 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
17220 impl Drop for CResult_UpdateFeeDecodeErrorZ {
17221         fn drop(&mut self) {
17222                 if self.result_ok {
17223                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17224                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17225                         }
17226                 } else {
17227                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17228                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17229                         }
17230                 }
17231         }
17232 }
17233 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
17234         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
17235                 let contents = if o.result_ok {
17236                         let result = unsafe { o.contents.result };
17237                         unsafe { o.contents.result = core::ptr::null_mut() };
17238                         CResult_UpdateFeeDecodeErrorZPtr { result }
17239                 } else {
17240                         let err = unsafe { o.contents.err };
17241                         unsafe { o.contents.err = core::ptr::null_mut(); }
17242                         CResult_UpdateFeeDecodeErrorZPtr { err }
17243                 };
17244                 Self {
17245                         contents,
17246                         result_ok: o.result_ok,
17247                 }
17248         }
17249 }
17250 impl Clone for CResult_UpdateFeeDecodeErrorZ {
17251         fn clone(&self) -> Self {
17252                 if self.result_ok {
17253                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
17254                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
17255                         } }
17256                 } else {
17257                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
17258                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17259                         } }
17260                 }
17261         }
17262 }
17263 #[no_mangle]
17264 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
17265 /// but with all dynamically-allocated buffers duplicated in new buffers.
17266 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
17267 #[repr(C)]
17268 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
17269 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17270         /// A pointer to the contents in the success state.
17271         /// Reading from this pointer when `result_ok` is not set is undefined.
17272         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
17273         /// A pointer to the contents in the error state.
17274         /// Reading from this pointer when `result_ok` is set is undefined.
17275         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17276 }
17277 #[repr(C)]
17278 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
17279 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17281 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
17282         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
17283         /// `err` or `result` depending on the state of `result_ok`.
17284         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
17285         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
17286         pub result_ok: bool,
17287 }
17288 #[no_mangle]
17289 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
17290 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
17291         CResult_UpdateFulfillHTLCDecodeErrorZ {
17292                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17293                         result: Box::into_raw(Box::new(o)),
17294                 },
17295                 result_ok: true,
17296         }
17297 }
17298 #[no_mangle]
17299 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
17300 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
17301         CResult_UpdateFulfillHTLCDecodeErrorZ {
17302                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17303                         err: Box::into_raw(Box::new(e)),
17304                 },
17305                 result_ok: false,
17306         }
17307 }
17308 /// Checks if the given object is currently in the success state
17309 #[no_mangle]
17310 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
17311         o.result_ok
17312 }
17313 #[no_mangle]
17314 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
17315 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
17316 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
17317         fn drop(&mut self) {
17318                 if self.result_ok {
17319                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17320                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17321                         }
17322                 } else {
17323                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17324                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17325                         }
17326                 }
17327         }
17328 }
17329 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
17330         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17331                 let contents = if o.result_ok {
17332                         let result = unsafe { o.contents.result };
17333                         unsafe { o.contents.result = core::ptr::null_mut() };
17334                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
17335                 } else {
17336                         let err = unsafe { o.contents.err };
17337                         unsafe { o.contents.err = core::ptr::null_mut(); }
17338                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
17339                 };
17340                 Self {
17341                         contents,
17342                         result_ok: o.result_ok,
17343                 }
17344         }
17345 }
17346 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
17347         fn clone(&self) -> Self {
17348                 if self.result_ok {
17349                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17350                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
17351                         } }
17352                 } else {
17353                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17354                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17355                         } }
17356                 }
17357         }
17358 }
17359 #[no_mangle]
17360 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
17361 /// but with all dynamically-allocated buffers duplicated in new buffers.
17362 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
17363 #[repr(C)]
17364 /// The contents of CResult_OnionPacketDecodeErrorZ
17365 pub union CResult_OnionPacketDecodeErrorZPtr {
17366         /// A pointer to the contents in the success state.
17367         /// Reading from this pointer when `result_ok` is not set is undefined.
17368         pub result: *mut crate::lightning::ln::msgs::OnionPacket,
17369         /// A pointer to the contents in the error state.
17370         /// Reading from this pointer when `result_ok` is set is undefined.
17371         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17372 }
17373 #[repr(C)]
17374 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
17375 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
17376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17377 pub struct CResult_OnionPacketDecodeErrorZ {
17378         /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
17379         /// `err` or `result` depending on the state of `result_ok`.
17380         pub contents: CResult_OnionPacketDecodeErrorZPtr,
17381         /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
17382         pub result_ok: bool,
17383 }
17384 #[no_mangle]
17385 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
17386 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
17387         CResult_OnionPacketDecodeErrorZ {
17388                 contents: CResult_OnionPacketDecodeErrorZPtr {
17389                         result: Box::into_raw(Box::new(o)),
17390                 },
17391                 result_ok: true,
17392         }
17393 }
17394 #[no_mangle]
17395 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
17396 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
17397         CResult_OnionPacketDecodeErrorZ {
17398                 contents: CResult_OnionPacketDecodeErrorZPtr {
17399                         err: Box::into_raw(Box::new(e)),
17400                 },
17401                 result_ok: false,
17402         }
17403 }
17404 /// Checks if the given object is currently in the success state
17405 #[no_mangle]
17406 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
17407         o.result_ok
17408 }
17409 #[no_mangle]
17410 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
17411 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
17412 impl Drop for CResult_OnionPacketDecodeErrorZ {
17413         fn drop(&mut self) {
17414                 if self.result_ok {
17415                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17416                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17417                         }
17418                 } else {
17419                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17420                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17421                         }
17422                 }
17423         }
17424 }
17425 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
17426         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
17427                 let contents = if o.result_ok {
17428                         let result = unsafe { o.contents.result };
17429                         unsafe { o.contents.result = core::ptr::null_mut() };
17430                         CResult_OnionPacketDecodeErrorZPtr { result }
17431                 } else {
17432                         let err = unsafe { o.contents.err };
17433                         unsafe { o.contents.err = core::ptr::null_mut(); }
17434                         CResult_OnionPacketDecodeErrorZPtr { err }
17435                 };
17436                 Self {
17437                         contents,
17438                         result_ok: o.result_ok,
17439                 }
17440         }
17441 }
17442 impl Clone for CResult_OnionPacketDecodeErrorZ {
17443         fn clone(&self) -> Self {
17444                 if self.result_ok {
17445                         Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
17446                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
17447                         } }
17448                 } else {
17449                         Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
17450                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17451                         } }
17452                 }
17453         }
17454 }
17455 #[no_mangle]
17456 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
17457 /// but with all dynamically-allocated buffers duplicated in new buffers.
17458 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
17459 #[repr(C)]
17460 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
17461 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
17462         /// A pointer to the contents in the success state.
17463         /// Reading from this pointer when `result_ok` is not set is undefined.
17464         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
17465         /// A pointer to the contents in the error state.
17466         /// Reading from this pointer when `result_ok` is set is undefined.
17467         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17468 }
17469 #[repr(C)]
17470 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
17471 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17473 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
17474         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
17475         /// `err` or `result` depending on the state of `result_ok`.
17476         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
17477         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
17478         pub result_ok: bool,
17479 }
17480 #[no_mangle]
17481 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
17482 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
17483         CResult_UpdateAddHTLCDecodeErrorZ {
17484                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17485                         result: Box::into_raw(Box::new(o)),
17486                 },
17487                 result_ok: true,
17488         }
17489 }
17490 #[no_mangle]
17491 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
17492 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
17493         CResult_UpdateAddHTLCDecodeErrorZ {
17494                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17495                         err: Box::into_raw(Box::new(e)),
17496                 },
17497                 result_ok: false,
17498         }
17499 }
17500 /// Checks if the given object is currently in the success state
17501 #[no_mangle]
17502 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
17503         o.result_ok
17504 }
17505 #[no_mangle]
17506 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
17507 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
17508 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
17509         fn drop(&mut self) {
17510                 if self.result_ok {
17511                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17512                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17513                         }
17514                 } else {
17515                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17516                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17517                         }
17518                 }
17519         }
17520 }
17521 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
17522         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17523                 let contents = if o.result_ok {
17524                         let result = unsafe { o.contents.result };
17525                         unsafe { o.contents.result = core::ptr::null_mut() };
17526                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
17527                 } else {
17528                         let err = unsafe { o.contents.err };
17529                         unsafe { o.contents.err = core::ptr::null_mut(); }
17530                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
17531                 };
17532                 Self {
17533                         contents,
17534                         result_ok: o.result_ok,
17535                 }
17536         }
17537 }
17538 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
17539         fn clone(&self) -> Self {
17540                 if self.result_ok {
17541                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17542                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
17543                         } }
17544                 } else {
17545                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17546                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17547                         } }
17548                 }
17549         }
17550 }
17551 #[no_mangle]
17552 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
17553 /// but with all dynamically-allocated buffers duplicated in new buffers.
17554 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
17555 #[repr(C)]
17556 /// The contents of CResult_OnionMessageDecodeErrorZ
17557 pub union CResult_OnionMessageDecodeErrorZPtr {
17558         /// A pointer to the contents in the success state.
17559         /// Reading from this pointer when `result_ok` is not set is undefined.
17560         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
17561         /// A pointer to the contents in the error state.
17562         /// Reading from this pointer when `result_ok` is set is undefined.
17563         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17564 }
17565 #[repr(C)]
17566 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
17567 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17569 pub struct CResult_OnionMessageDecodeErrorZ {
17570         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
17571         /// `err` or `result` depending on the state of `result_ok`.
17572         pub contents: CResult_OnionMessageDecodeErrorZPtr,
17573         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
17574         pub result_ok: bool,
17575 }
17576 #[no_mangle]
17577 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
17578 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
17579         CResult_OnionMessageDecodeErrorZ {
17580                 contents: CResult_OnionMessageDecodeErrorZPtr {
17581                         result: Box::into_raw(Box::new(o)),
17582                 },
17583                 result_ok: true,
17584         }
17585 }
17586 #[no_mangle]
17587 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
17588 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
17589         CResult_OnionMessageDecodeErrorZ {
17590                 contents: CResult_OnionMessageDecodeErrorZPtr {
17591                         err: Box::into_raw(Box::new(e)),
17592                 },
17593                 result_ok: false,
17594         }
17595 }
17596 /// Checks if the given object is currently in the success state
17597 #[no_mangle]
17598 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
17599         o.result_ok
17600 }
17601 #[no_mangle]
17602 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
17603 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
17604 impl Drop for CResult_OnionMessageDecodeErrorZ {
17605         fn drop(&mut self) {
17606                 if self.result_ok {
17607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17609                         }
17610                 } else {
17611                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17612                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17613                         }
17614                 }
17615         }
17616 }
17617 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
17618         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17619                 let contents = if o.result_ok {
17620                         let result = unsafe { o.contents.result };
17621                         unsafe { o.contents.result = core::ptr::null_mut() };
17622                         CResult_OnionMessageDecodeErrorZPtr { result }
17623                 } else {
17624                         let err = unsafe { o.contents.err };
17625                         unsafe { o.contents.err = core::ptr::null_mut(); }
17626                         CResult_OnionMessageDecodeErrorZPtr { err }
17627                 };
17628                 Self {
17629                         contents,
17630                         result_ok: o.result_ok,
17631                 }
17632         }
17633 }
17634 impl Clone for CResult_OnionMessageDecodeErrorZ {
17635         fn clone(&self) -> Self {
17636                 if self.result_ok {
17637                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
17638                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
17639                         } }
17640                 } else {
17641                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
17642                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17643                         } }
17644                 }
17645         }
17646 }
17647 #[no_mangle]
17648 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
17649 /// but with all dynamically-allocated buffers duplicated in new buffers.
17650 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
17651 #[repr(C)]
17652 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
17653 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
17654         /// A pointer to the contents in the success state.
17655         /// Reading from this pointer when `result_ok` is not set is undefined.
17656         pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
17657         /// A pointer to the contents in the error state.
17658         /// Reading from this pointer when `result_ok` is set is undefined.
17659         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17660 }
17661 #[repr(C)]
17662 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
17663 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
17664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17665 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
17666         /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
17667         /// `err` or `result` depending on the state of `result_ok`.
17668         pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
17669         /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
17670         pub result_ok: bool,
17671 }
17672 #[no_mangle]
17673 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
17674 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
17675         CResult_FinalOnionHopDataDecodeErrorZ {
17676                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17677                         result: Box::into_raw(Box::new(o)),
17678                 },
17679                 result_ok: true,
17680         }
17681 }
17682 #[no_mangle]
17683 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
17684 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
17685         CResult_FinalOnionHopDataDecodeErrorZ {
17686                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17687                         err: Box::into_raw(Box::new(e)),
17688                 },
17689                 result_ok: false,
17690         }
17691 }
17692 /// Checks if the given object is currently in the success state
17693 #[no_mangle]
17694 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
17695         o.result_ok
17696 }
17697 #[no_mangle]
17698 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
17699 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
17700 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
17701         fn drop(&mut self) {
17702                 if self.result_ok {
17703                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17704                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17705                         }
17706                 } else {
17707                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17708                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17709                         }
17710                 }
17711         }
17712 }
17713 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
17714         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
17715                 let contents = if o.result_ok {
17716                         let result = unsafe { o.contents.result };
17717                         unsafe { o.contents.result = core::ptr::null_mut() };
17718                         CResult_FinalOnionHopDataDecodeErrorZPtr { result }
17719                 } else {
17720                         let err = unsafe { o.contents.err };
17721                         unsafe { o.contents.err = core::ptr::null_mut(); }
17722                         CResult_FinalOnionHopDataDecodeErrorZPtr { err }
17723                 };
17724                 Self {
17725                         contents,
17726                         result_ok: o.result_ok,
17727                 }
17728         }
17729 }
17730 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
17731         fn clone(&self) -> Self {
17732                 if self.result_ok {
17733                         Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17734                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
17735                         } }
17736                 } else {
17737                         Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17738                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17739                         } }
17740                 }
17741         }
17742 }
17743 #[no_mangle]
17744 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
17745 /// but with all dynamically-allocated buffers duplicated in new buffers.
17746 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
17747 #[repr(C)]
17748 /// The contents of CResult_PingDecodeErrorZ
17749 pub union CResult_PingDecodeErrorZPtr {
17750         /// A pointer to the contents in the success state.
17751         /// Reading from this pointer when `result_ok` is not set is undefined.
17752         pub result: *mut crate::lightning::ln::msgs::Ping,
17753         /// A pointer to the contents in the error state.
17754         /// Reading from this pointer when `result_ok` is set is undefined.
17755         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17756 }
17757 #[repr(C)]
17758 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
17759 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
17760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17761 pub struct CResult_PingDecodeErrorZ {
17762         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
17763         /// `err` or `result` depending on the state of `result_ok`.
17764         pub contents: CResult_PingDecodeErrorZPtr,
17765         /// Whether this CResult_PingDecodeErrorZ represents a success state.
17766         pub result_ok: bool,
17767 }
17768 #[no_mangle]
17769 /// Creates a new CResult_PingDecodeErrorZ in the success state.
17770 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
17771         CResult_PingDecodeErrorZ {
17772                 contents: CResult_PingDecodeErrorZPtr {
17773                         result: Box::into_raw(Box::new(o)),
17774                 },
17775                 result_ok: true,
17776         }
17777 }
17778 #[no_mangle]
17779 /// Creates a new CResult_PingDecodeErrorZ in the error state.
17780 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
17781         CResult_PingDecodeErrorZ {
17782                 contents: CResult_PingDecodeErrorZPtr {
17783                         err: Box::into_raw(Box::new(e)),
17784                 },
17785                 result_ok: false,
17786         }
17787 }
17788 /// Checks if the given object is currently in the success state
17789 #[no_mangle]
17790 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
17791         o.result_ok
17792 }
17793 #[no_mangle]
17794 /// Frees any resources used by the CResult_PingDecodeErrorZ.
17795 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
17796 impl Drop for CResult_PingDecodeErrorZ {
17797         fn drop(&mut self) {
17798                 if self.result_ok {
17799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17801                         }
17802                 } else {
17803                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17804                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17805                         }
17806                 }
17807         }
17808 }
17809 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
17810         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
17811                 let contents = if o.result_ok {
17812                         let result = unsafe { o.contents.result };
17813                         unsafe { o.contents.result = core::ptr::null_mut() };
17814                         CResult_PingDecodeErrorZPtr { result }
17815                 } else {
17816                         let err = unsafe { o.contents.err };
17817                         unsafe { o.contents.err = core::ptr::null_mut(); }
17818                         CResult_PingDecodeErrorZPtr { err }
17819                 };
17820                 Self {
17821                         contents,
17822                         result_ok: o.result_ok,
17823                 }
17824         }
17825 }
17826 impl Clone for CResult_PingDecodeErrorZ {
17827         fn clone(&self) -> Self {
17828                 if self.result_ok {
17829                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
17830                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
17831                         } }
17832                 } else {
17833                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
17834                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17835                         } }
17836                 }
17837         }
17838 }
17839 #[no_mangle]
17840 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
17841 /// but with all dynamically-allocated buffers duplicated in new buffers.
17842 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
17843 #[repr(C)]
17844 /// The contents of CResult_PongDecodeErrorZ
17845 pub union CResult_PongDecodeErrorZPtr {
17846         /// A pointer to the contents in the success state.
17847         /// Reading from this pointer when `result_ok` is not set is undefined.
17848         pub result: *mut crate::lightning::ln::msgs::Pong,
17849         /// A pointer to the contents in the error state.
17850         /// Reading from this pointer when `result_ok` is set is undefined.
17851         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17852 }
17853 #[repr(C)]
17854 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
17855 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
17856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17857 pub struct CResult_PongDecodeErrorZ {
17858         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
17859         /// `err` or `result` depending on the state of `result_ok`.
17860         pub contents: CResult_PongDecodeErrorZPtr,
17861         /// Whether this CResult_PongDecodeErrorZ represents a success state.
17862         pub result_ok: bool,
17863 }
17864 #[no_mangle]
17865 /// Creates a new CResult_PongDecodeErrorZ in the success state.
17866 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
17867         CResult_PongDecodeErrorZ {
17868                 contents: CResult_PongDecodeErrorZPtr {
17869                         result: Box::into_raw(Box::new(o)),
17870                 },
17871                 result_ok: true,
17872         }
17873 }
17874 #[no_mangle]
17875 /// Creates a new CResult_PongDecodeErrorZ in the error state.
17876 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
17877         CResult_PongDecodeErrorZ {
17878                 contents: CResult_PongDecodeErrorZPtr {
17879                         err: Box::into_raw(Box::new(e)),
17880                 },
17881                 result_ok: false,
17882         }
17883 }
17884 /// Checks if the given object is currently in the success state
17885 #[no_mangle]
17886 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
17887         o.result_ok
17888 }
17889 #[no_mangle]
17890 /// Frees any resources used by the CResult_PongDecodeErrorZ.
17891 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
17892 impl Drop for CResult_PongDecodeErrorZ {
17893         fn drop(&mut self) {
17894                 if self.result_ok {
17895                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17896                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17897                         }
17898                 } else {
17899                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17900                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17901                         }
17902                 }
17903         }
17904 }
17905 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
17906         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
17907                 let contents = if o.result_ok {
17908                         let result = unsafe { o.contents.result };
17909                         unsafe { o.contents.result = core::ptr::null_mut() };
17910                         CResult_PongDecodeErrorZPtr { result }
17911                 } else {
17912                         let err = unsafe { o.contents.err };
17913                         unsafe { o.contents.err = core::ptr::null_mut(); }
17914                         CResult_PongDecodeErrorZPtr { err }
17915                 };
17916                 Self {
17917                         contents,
17918                         result_ok: o.result_ok,
17919                 }
17920         }
17921 }
17922 impl Clone for CResult_PongDecodeErrorZ {
17923         fn clone(&self) -> Self {
17924                 if self.result_ok {
17925                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
17926                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
17927                         } }
17928                 } else {
17929                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
17930                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17931                         } }
17932                 }
17933         }
17934 }
17935 #[no_mangle]
17936 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
17937 /// but with all dynamically-allocated buffers duplicated in new buffers.
17938 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
17939 #[repr(C)]
17940 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
17941 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17942         /// A pointer to the contents in the success state.
17943         /// Reading from this pointer when `result_ok` is not set is undefined.
17944         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
17945         /// A pointer to the contents in the error state.
17946         /// Reading from this pointer when `result_ok` is set is undefined.
17947         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17948 }
17949 #[repr(C)]
17950 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
17951 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17952 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17953 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17954         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
17955         /// `err` or `result` depending on the state of `result_ok`.
17956         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
17957         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
17958         pub result_ok: bool,
17959 }
17960 #[no_mangle]
17961 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
17962 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17963         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17964                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17965                         result: Box::into_raw(Box::new(o)),
17966                 },
17967                 result_ok: true,
17968         }
17969 }
17970 #[no_mangle]
17971 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
17972 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17973         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17974                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17975                         err: Box::into_raw(Box::new(e)),
17976                 },
17977                 result_ok: false,
17978         }
17979 }
17980 /// Checks if the given object is currently in the success state
17981 #[no_mangle]
17982 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
17983         o.result_ok
17984 }
17985 #[no_mangle]
17986 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
17987 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
17988 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17989         fn drop(&mut self) {
17990                 if self.result_ok {
17991                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17992                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17993                         }
17994                 } else {
17995                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17996                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17997                         }
17998                 }
17999         }
18000 }
18001 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
18002         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18003                 let contents = if o.result_ok {
18004                         let result = unsafe { o.contents.result };
18005                         unsafe { o.contents.result = core::ptr::null_mut() };
18006                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
18007                 } else {
18008                         let err = unsafe { o.contents.err };
18009                         unsafe { o.contents.err = core::ptr::null_mut(); }
18010                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
18011                 };
18012                 Self {
18013                         contents,
18014                         result_ok: o.result_ok,
18015                 }
18016         }
18017 }
18018 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
18019         fn clone(&self) -> Self {
18020                 if self.result_ok {
18021                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
18022                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
18023                         } }
18024                 } else {
18025                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
18026                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18027                         } }
18028                 }
18029         }
18030 }
18031 #[no_mangle]
18032 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18033 /// but with all dynamically-allocated buffers duplicated in new buffers.
18034 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18035 #[repr(C)]
18036 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
18037 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
18038         /// A pointer to the contents in the success state.
18039         /// Reading from this pointer when `result_ok` is not set is undefined.
18040         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
18041         /// A pointer to the contents in the error state.
18042         /// Reading from this pointer when `result_ok` is set is undefined.
18043         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18044 }
18045 #[repr(C)]
18046 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
18047 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18049 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
18050         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
18051         /// `err` or `result` depending on the state of `result_ok`.
18052         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
18053         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
18054         pub result_ok: bool,
18055 }
18056 #[no_mangle]
18057 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
18058 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
18059         CResult_ChannelAnnouncementDecodeErrorZ {
18060                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18061                         result: Box::into_raw(Box::new(o)),
18062                 },
18063                 result_ok: true,
18064         }
18065 }
18066 #[no_mangle]
18067 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
18068 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
18069         CResult_ChannelAnnouncementDecodeErrorZ {
18070                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18071                         err: Box::into_raw(Box::new(e)),
18072                 },
18073                 result_ok: false,
18074         }
18075 }
18076 /// Checks if the given object is currently in the success state
18077 #[no_mangle]
18078 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
18079         o.result_ok
18080 }
18081 #[no_mangle]
18082 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
18083 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
18084 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
18085         fn drop(&mut self) {
18086                 if self.result_ok {
18087                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18088                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18089                         }
18090                 } else {
18091                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18092                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18093                         }
18094                 }
18095         }
18096 }
18097 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
18098         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18099                 let contents = if o.result_ok {
18100                         let result = unsafe { o.contents.result };
18101                         unsafe { o.contents.result = core::ptr::null_mut() };
18102                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
18103                 } else {
18104                         let err = unsafe { o.contents.err };
18105                         unsafe { o.contents.err = core::ptr::null_mut(); }
18106                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
18107                 };
18108                 Self {
18109                         contents,
18110                         result_ok: o.result_ok,
18111                 }
18112         }
18113 }
18114 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
18115         fn clone(&self) -> Self {
18116                 if self.result_ok {
18117                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18118                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
18119                         } }
18120                 } else {
18121                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18122                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18123                         } }
18124                 }
18125         }
18126 }
18127 #[no_mangle]
18128 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18129 /// but with all dynamically-allocated buffers duplicated in new buffers.
18130 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18131 #[repr(C)]
18132 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
18133 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18134         /// A pointer to the contents in the success state.
18135         /// Reading from this pointer when `result_ok` is not set is undefined.
18136         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
18137         /// A pointer to the contents in the error state.
18138         /// Reading from this pointer when `result_ok` is set is undefined.
18139         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18140 }
18141 #[repr(C)]
18142 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
18143 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
18144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18145 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
18146         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
18147         /// `err` or `result` depending on the state of `result_ok`.
18148         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
18149         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
18150         pub result_ok: bool,
18151 }
18152 #[no_mangle]
18153 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
18154 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
18155         CResult_UnsignedChannelUpdateDecodeErrorZ {
18156                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18157                         result: Box::into_raw(Box::new(o)),
18158                 },
18159                 result_ok: true,
18160         }
18161 }
18162 #[no_mangle]
18163 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
18164 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
18165         CResult_UnsignedChannelUpdateDecodeErrorZ {
18166                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18167                         err: Box::into_raw(Box::new(e)),
18168                 },
18169                 result_ok: false,
18170         }
18171 }
18172 /// Checks if the given object is currently in the success state
18173 #[no_mangle]
18174 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
18175         o.result_ok
18176 }
18177 #[no_mangle]
18178 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
18179 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
18180 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
18181         fn drop(&mut self) {
18182                 if self.result_ok {
18183                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18184                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18185                         }
18186                 } else {
18187                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18188                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18189                         }
18190                 }
18191         }
18192 }
18193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
18194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
18195                 let contents = if o.result_ok {
18196                         let result = unsafe { o.contents.result };
18197                         unsafe { o.contents.result = core::ptr::null_mut() };
18198                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
18199                 } else {
18200                         let err = unsafe { o.contents.err };
18201                         unsafe { o.contents.err = core::ptr::null_mut(); }
18202                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
18203                 };
18204                 Self {
18205                         contents,
18206                         result_ok: o.result_ok,
18207                 }
18208         }
18209 }
18210 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
18211         fn clone(&self) -> Self {
18212                 if self.result_ok {
18213                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18214                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
18215                         } }
18216                 } else {
18217                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18218                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18219                         } }
18220                 }
18221         }
18222 }
18223 #[no_mangle]
18224 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
18225 /// but with all dynamically-allocated buffers duplicated in new buffers.
18226 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
18227 #[repr(C)]
18228 /// The contents of CResult_ChannelUpdateDecodeErrorZ
18229 pub union CResult_ChannelUpdateDecodeErrorZPtr {
18230         /// A pointer to the contents in the success state.
18231         /// Reading from this pointer when `result_ok` is not set is undefined.
18232         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
18233         /// A pointer to the contents in the error state.
18234         /// Reading from this pointer when `result_ok` is set is undefined.
18235         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18236 }
18237 #[repr(C)]
18238 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
18239 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
18240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18241 pub struct CResult_ChannelUpdateDecodeErrorZ {
18242         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
18243         /// `err` or `result` depending on the state of `result_ok`.
18244         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
18245         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
18246         pub result_ok: bool,
18247 }
18248 #[no_mangle]
18249 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
18250 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
18251         CResult_ChannelUpdateDecodeErrorZ {
18252                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
18253                         result: Box::into_raw(Box::new(o)),
18254                 },
18255                 result_ok: true,
18256         }
18257 }
18258 #[no_mangle]
18259 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
18260 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
18261         CResult_ChannelUpdateDecodeErrorZ {
18262                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
18263                         err: Box::into_raw(Box::new(e)),
18264                 },
18265                 result_ok: false,
18266         }
18267 }
18268 /// Checks if the given object is currently in the success state
18269 #[no_mangle]
18270 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
18271         o.result_ok
18272 }
18273 #[no_mangle]
18274 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
18275 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
18276 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
18277         fn drop(&mut self) {
18278                 if self.result_ok {
18279                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18280                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18281                         }
18282                 } else {
18283                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18284                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18285                         }
18286                 }
18287         }
18288 }
18289 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
18290         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
18291                 let contents = if o.result_ok {
18292                         let result = unsafe { o.contents.result };
18293                         unsafe { o.contents.result = core::ptr::null_mut() };
18294                         CResult_ChannelUpdateDecodeErrorZPtr { result }
18295                 } else {
18296                         let err = unsafe { o.contents.err };
18297                         unsafe { o.contents.err = core::ptr::null_mut(); }
18298                         CResult_ChannelUpdateDecodeErrorZPtr { err }
18299                 };
18300                 Self {
18301                         contents,
18302                         result_ok: o.result_ok,
18303                 }
18304         }
18305 }
18306 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
18307         fn clone(&self) -> Self {
18308                 if self.result_ok {
18309                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
18310                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
18311                         } }
18312                 } else {
18313                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
18314                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18315                         } }
18316                 }
18317         }
18318 }
18319 #[no_mangle]
18320 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
18321 /// but with all dynamically-allocated buffers duplicated in new buffers.
18322 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
18323 #[repr(C)]
18324 /// The contents of CResult_ErrorMessageDecodeErrorZ
18325 pub union CResult_ErrorMessageDecodeErrorZPtr {
18326         /// A pointer to the contents in the success state.
18327         /// Reading from this pointer when `result_ok` is not set is undefined.
18328         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
18329         /// A pointer to the contents in the error state.
18330         /// Reading from this pointer when `result_ok` is set is undefined.
18331         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18332 }
18333 #[repr(C)]
18334 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
18335 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18337 pub struct CResult_ErrorMessageDecodeErrorZ {
18338         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
18339         /// `err` or `result` depending on the state of `result_ok`.
18340         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
18341         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
18342         pub result_ok: bool,
18343 }
18344 #[no_mangle]
18345 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
18346 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
18347         CResult_ErrorMessageDecodeErrorZ {
18348                 contents: CResult_ErrorMessageDecodeErrorZPtr {
18349                         result: Box::into_raw(Box::new(o)),
18350                 },
18351                 result_ok: true,
18352         }
18353 }
18354 #[no_mangle]
18355 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
18356 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
18357         CResult_ErrorMessageDecodeErrorZ {
18358                 contents: CResult_ErrorMessageDecodeErrorZPtr {
18359                         err: Box::into_raw(Box::new(e)),
18360                 },
18361                 result_ok: false,
18362         }
18363 }
18364 /// Checks if the given object is currently in the success state
18365 #[no_mangle]
18366 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
18367         o.result_ok
18368 }
18369 #[no_mangle]
18370 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
18371 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
18372 impl Drop for CResult_ErrorMessageDecodeErrorZ {
18373         fn drop(&mut self) {
18374                 if self.result_ok {
18375                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18376                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18377                         }
18378                 } else {
18379                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18380                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18381                         }
18382                 }
18383         }
18384 }
18385 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
18386         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18387                 let contents = if o.result_ok {
18388                         let result = unsafe { o.contents.result };
18389                         unsafe { o.contents.result = core::ptr::null_mut() };
18390                         CResult_ErrorMessageDecodeErrorZPtr { result }
18391                 } else {
18392                         let err = unsafe { o.contents.err };
18393                         unsafe { o.contents.err = core::ptr::null_mut(); }
18394                         CResult_ErrorMessageDecodeErrorZPtr { err }
18395                 };
18396                 Self {
18397                         contents,
18398                         result_ok: o.result_ok,
18399                 }
18400         }
18401 }
18402 impl Clone for CResult_ErrorMessageDecodeErrorZ {
18403         fn clone(&self) -> Self {
18404                 if self.result_ok {
18405                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
18406                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
18407                         } }
18408                 } else {
18409                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
18410                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18411                         } }
18412                 }
18413         }
18414 }
18415 #[no_mangle]
18416 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
18417 /// but with all dynamically-allocated buffers duplicated in new buffers.
18418 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
18419 #[repr(C)]
18420 /// The contents of CResult_WarningMessageDecodeErrorZ
18421 pub union CResult_WarningMessageDecodeErrorZPtr {
18422         /// A pointer to the contents in the success state.
18423         /// Reading from this pointer when `result_ok` is not set is undefined.
18424         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
18425         /// A pointer to the contents in the error state.
18426         /// Reading from this pointer when `result_ok` is set is undefined.
18427         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18428 }
18429 #[repr(C)]
18430 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
18431 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18433 pub struct CResult_WarningMessageDecodeErrorZ {
18434         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
18435         /// `err` or `result` depending on the state of `result_ok`.
18436         pub contents: CResult_WarningMessageDecodeErrorZPtr,
18437         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
18438         pub result_ok: bool,
18439 }
18440 #[no_mangle]
18441 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
18442 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
18443         CResult_WarningMessageDecodeErrorZ {
18444                 contents: CResult_WarningMessageDecodeErrorZPtr {
18445                         result: Box::into_raw(Box::new(o)),
18446                 },
18447                 result_ok: true,
18448         }
18449 }
18450 #[no_mangle]
18451 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
18452 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
18453         CResult_WarningMessageDecodeErrorZ {
18454                 contents: CResult_WarningMessageDecodeErrorZPtr {
18455                         err: Box::into_raw(Box::new(e)),
18456                 },
18457                 result_ok: false,
18458         }
18459 }
18460 /// Checks if the given object is currently in the success state
18461 #[no_mangle]
18462 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
18463         o.result_ok
18464 }
18465 #[no_mangle]
18466 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
18467 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
18468 impl Drop for CResult_WarningMessageDecodeErrorZ {
18469         fn drop(&mut self) {
18470                 if self.result_ok {
18471                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18472                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18473                         }
18474                 } else {
18475                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18476                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18477                         }
18478                 }
18479         }
18480 }
18481 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
18482         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18483                 let contents = if o.result_ok {
18484                         let result = unsafe { o.contents.result };
18485                         unsafe { o.contents.result = core::ptr::null_mut() };
18486                         CResult_WarningMessageDecodeErrorZPtr { result }
18487                 } else {
18488                         let err = unsafe { o.contents.err };
18489                         unsafe { o.contents.err = core::ptr::null_mut(); }
18490                         CResult_WarningMessageDecodeErrorZPtr { err }
18491                 };
18492                 Self {
18493                         contents,
18494                         result_ok: o.result_ok,
18495                 }
18496         }
18497 }
18498 impl Clone for CResult_WarningMessageDecodeErrorZ {
18499         fn clone(&self) -> Self {
18500                 if self.result_ok {
18501                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
18502                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
18503                         } }
18504                 } else {
18505                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
18506                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18507                         } }
18508                 }
18509         }
18510 }
18511 #[no_mangle]
18512 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
18513 /// but with all dynamically-allocated buffers duplicated in new buffers.
18514 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
18515 #[repr(C)]
18516 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
18517 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18518         /// A pointer to the contents in the success state.
18519         /// Reading from this pointer when `result_ok` is not set is undefined.
18520         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
18521         /// A pointer to the contents in the error state.
18522         /// Reading from this pointer when `result_ok` is set is undefined.
18523         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18524 }
18525 #[repr(C)]
18526 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
18527 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18528 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18529 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18530         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
18531         /// `err` or `result` depending on the state of `result_ok`.
18532         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
18533         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
18534         pub result_ok: bool,
18535 }
18536 #[no_mangle]
18537 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
18538 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18539         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18540                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18541                         result: Box::into_raw(Box::new(o)),
18542                 },
18543                 result_ok: true,
18544         }
18545 }
18546 #[no_mangle]
18547 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
18548 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18549         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18550                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18551                         err: Box::into_raw(Box::new(e)),
18552                 },
18553                 result_ok: false,
18554         }
18555 }
18556 /// Checks if the given object is currently in the success state
18557 #[no_mangle]
18558 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
18559         o.result_ok
18560 }
18561 #[no_mangle]
18562 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
18563 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
18564 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18565         fn drop(&mut self) {
18566                 if self.result_ok {
18567                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18568                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18569                         }
18570                 } else {
18571                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18572                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18573                         }
18574                 }
18575         }
18576 }
18577 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18578         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18579                 let contents = if o.result_ok {
18580                         let result = unsafe { o.contents.result };
18581                         unsafe { o.contents.result = core::ptr::null_mut() };
18582                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
18583                 } else {
18584                         let err = unsafe { o.contents.err };
18585                         unsafe { o.contents.err = core::ptr::null_mut(); }
18586                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
18587                 };
18588                 Self {
18589                         contents,
18590                         result_ok: o.result_ok,
18591                 }
18592         }
18593 }
18594 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18595         fn clone(&self) -> Self {
18596                 if self.result_ok {
18597                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18598                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
18599                         } }
18600                 } else {
18601                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18602                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18603                         } }
18604                 }
18605         }
18606 }
18607 #[no_mangle]
18608 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
18609 /// but with all dynamically-allocated buffers duplicated in new buffers.
18610 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18611 #[repr(C)]
18612 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
18613 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
18614         /// A pointer to the contents in the success state.
18615         /// Reading from this pointer when `result_ok` is not set is undefined.
18616         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
18617         /// A pointer to the contents in the error state.
18618         /// Reading from this pointer when `result_ok` is set is undefined.
18619         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18620 }
18621 #[repr(C)]
18622 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
18623 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18625 pub struct CResult_NodeAnnouncementDecodeErrorZ {
18626         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
18627         /// `err` or `result` depending on the state of `result_ok`.
18628         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
18629         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
18630         pub result_ok: bool,
18631 }
18632 #[no_mangle]
18633 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
18634 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
18635         CResult_NodeAnnouncementDecodeErrorZ {
18636                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18637                         result: Box::into_raw(Box::new(o)),
18638                 },
18639                 result_ok: true,
18640         }
18641 }
18642 #[no_mangle]
18643 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
18644 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
18645         CResult_NodeAnnouncementDecodeErrorZ {
18646                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18647                         err: Box::into_raw(Box::new(e)),
18648                 },
18649                 result_ok: false,
18650         }
18651 }
18652 /// Checks if the given object is currently in the success state
18653 #[no_mangle]
18654 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
18655         o.result_ok
18656 }
18657 #[no_mangle]
18658 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
18659 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
18660 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
18661         fn drop(&mut self) {
18662                 if self.result_ok {
18663                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18664                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18665                         }
18666                 } else {
18667                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18668                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18669                         }
18670                 }
18671         }
18672 }
18673 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
18674         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18675                 let contents = if o.result_ok {
18676                         let result = unsafe { o.contents.result };
18677                         unsafe { o.contents.result = core::ptr::null_mut() };
18678                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
18679                 } else {
18680                         let err = unsafe { o.contents.err };
18681                         unsafe { o.contents.err = core::ptr::null_mut(); }
18682                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
18683                 };
18684                 Self {
18685                         contents,
18686                         result_ok: o.result_ok,
18687                 }
18688         }
18689 }
18690 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
18691         fn clone(&self) -> Self {
18692                 if self.result_ok {
18693                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18694                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
18695                         } }
18696                 } else {
18697                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18698                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18699                         } }
18700                 }
18701         }
18702 }
18703 #[no_mangle]
18704 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
18705 /// but with all dynamically-allocated buffers duplicated in new buffers.
18706 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18707 #[repr(C)]
18708 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
18709 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
18710         /// A pointer to the contents in the success state.
18711         /// Reading from this pointer when `result_ok` is not set is undefined.
18712         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
18713         /// A pointer to the contents in the error state.
18714         /// Reading from this pointer when `result_ok` is set is undefined.
18715         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18716 }
18717 #[repr(C)]
18718 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
18719 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
18720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18721 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
18722         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
18723         /// `err` or `result` depending on the state of `result_ok`.
18724         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
18725         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
18726         pub result_ok: bool,
18727 }
18728 #[no_mangle]
18729 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
18730 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
18731         CResult_QueryShortChannelIdsDecodeErrorZ {
18732                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18733                         result: Box::into_raw(Box::new(o)),
18734                 },
18735                 result_ok: true,
18736         }
18737 }
18738 #[no_mangle]
18739 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
18740 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
18741         CResult_QueryShortChannelIdsDecodeErrorZ {
18742                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18743                         err: Box::into_raw(Box::new(e)),
18744                 },
18745                 result_ok: false,
18746         }
18747 }
18748 /// Checks if the given object is currently in the success state
18749 #[no_mangle]
18750 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
18751         o.result_ok
18752 }
18753 #[no_mangle]
18754 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
18755 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
18756 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
18757         fn drop(&mut self) {
18758                 if self.result_ok {
18759                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18760                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18761                         }
18762                 } else {
18763                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18764                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18765                         }
18766                 }
18767         }
18768 }
18769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
18770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
18771                 let contents = if o.result_ok {
18772                         let result = unsafe { o.contents.result };
18773                         unsafe { o.contents.result = core::ptr::null_mut() };
18774                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
18775                 } else {
18776                         let err = unsafe { o.contents.err };
18777                         unsafe { o.contents.err = core::ptr::null_mut(); }
18778                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
18779                 };
18780                 Self {
18781                         contents,
18782                         result_ok: o.result_ok,
18783                 }
18784         }
18785 }
18786 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
18787         fn clone(&self) -> Self {
18788                 if self.result_ok {
18789                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18790                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
18791                         } }
18792                 } else {
18793                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18794                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18795                         } }
18796                 }
18797         }
18798 }
18799 #[no_mangle]
18800 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
18801 /// but with all dynamically-allocated buffers duplicated in new buffers.
18802 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
18803 #[repr(C)]
18804 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
18805 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18806         /// A pointer to the contents in the success state.
18807         /// Reading from this pointer when `result_ok` is not set is undefined.
18808         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
18809         /// A pointer to the contents in the error state.
18810         /// Reading from this pointer when `result_ok` is set is undefined.
18811         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18812 }
18813 #[repr(C)]
18814 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
18815 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
18816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18817 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18818         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
18819         /// `err` or `result` depending on the state of `result_ok`.
18820         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
18821         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
18822         pub result_ok: bool,
18823 }
18824 #[no_mangle]
18825 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
18826 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18827         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18828                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18829                         result: Box::into_raw(Box::new(o)),
18830                 },
18831                 result_ok: true,
18832         }
18833 }
18834 #[no_mangle]
18835 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
18836 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18837         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18838                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18839                         err: Box::into_raw(Box::new(e)),
18840                 },
18841                 result_ok: false,
18842         }
18843 }
18844 /// Checks if the given object is currently in the success state
18845 #[no_mangle]
18846 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
18847         o.result_ok
18848 }
18849 #[no_mangle]
18850 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
18851 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
18852 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18853         fn drop(&mut self) {
18854                 if self.result_ok {
18855                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18856                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18857                         }
18858                 } else {
18859                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18860                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18861                         }
18862                 }
18863         }
18864 }
18865 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18866         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
18867                 let contents = if o.result_ok {
18868                         let result = unsafe { o.contents.result };
18869                         unsafe { o.contents.result = core::ptr::null_mut() };
18870                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
18871                 } else {
18872                         let err = unsafe { o.contents.err };
18873                         unsafe { o.contents.err = core::ptr::null_mut(); }
18874                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
18875                 };
18876                 Self {
18877                         contents,
18878                         result_ok: o.result_ok,
18879                 }
18880         }
18881 }
18882 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18883         fn clone(&self) -> Self {
18884                 if self.result_ok {
18885                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18886                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
18887                         } }
18888                 } else {
18889                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18890                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18891                         } }
18892                 }
18893         }
18894 }
18895 #[no_mangle]
18896 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
18897 /// but with all dynamically-allocated buffers duplicated in new buffers.
18898 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
18899 #[repr(C)]
18900 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
18901 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
18902         /// A pointer to the contents in the success state.
18903         /// Reading from this pointer when `result_ok` is not set is undefined.
18904         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
18905         /// A pointer to the contents in the error state.
18906         /// Reading from this pointer when `result_ok` is set is undefined.
18907         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18908 }
18909 #[repr(C)]
18910 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
18911 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
18912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18913 pub struct CResult_QueryChannelRangeDecodeErrorZ {
18914         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
18915         /// `err` or `result` depending on the state of `result_ok`.
18916         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
18917         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
18918         pub result_ok: bool,
18919 }
18920 #[no_mangle]
18921 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
18922 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
18923         CResult_QueryChannelRangeDecodeErrorZ {
18924                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18925                         result: Box::into_raw(Box::new(o)),
18926                 },
18927                 result_ok: true,
18928         }
18929 }
18930 #[no_mangle]
18931 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
18932 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
18933         CResult_QueryChannelRangeDecodeErrorZ {
18934                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18935                         err: Box::into_raw(Box::new(e)),
18936                 },
18937                 result_ok: false,
18938         }
18939 }
18940 /// Checks if the given object is currently in the success state
18941 #[no_mangle]
18942 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
18943         o.result_ok
18944 }
18945 #[no_mangle]
18946 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
18947 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
18948 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
18949         fn drop(&mut self) {
18950                 if self.result_ok {
18951                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18952                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18953                         }
18954                 } else {
18955                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18956                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18957                         }
18958                 }
18959         }
18960 }
18961 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
18962         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
18963                 let contents = if o.result_ok {
18964                         let result = unsafe { o.contents.result };
18965                         unsafe { o.contents.result = core::ptr::null_mut() };
18966                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
18967                 } else {
18968                         let err = unsafe { o.contents.err };
18969                         unsafe { o.contents.err = core::ptr::null_mut(); }
18970                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
18971                 };
18972                 Self {
18973                         contents,
18974                         result_ok: o.result_ok,
18975                 }
18976         }
18977 }
18978 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
18979         fn clone(&self) -> Self {
18980                 if self.result_ok {
18981                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18982                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
18983                         } }
18984                 } else {
18985                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18986                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18987                         } }
18988                 }
18989         }
18990 }
18991 #[no_mangle]
18992 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
18993 /// but with all dynamically-allocated buffers duplicated in new buffers.
18994 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
18995 #[repr(C)]
18996 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
18997 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
18998         /// A pointer to the contents in the success state.
18999         /// Reading from this pointer when `result_ok` is not set is undefined.
19000         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
19001         /// A pointer to the contents in the error state.
19002         /// Reading from this pointer when `result_ok` is set is undefined.
19003         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19004 }
19005 #[repr(C)]
19006 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
19007 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
19008 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19009 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
19010         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
19011         /// `err` or `result` depending on the state of `result_ok`.
19012         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
19013         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
19014         pub result_ok: bool,
19015 }
19016 #[no_mangle]
19017 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
19018 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
19019         CResult_ReplyChannelRangeDecodeErrorZ {
19020                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19021                         result: Box::into_raw(Box::new(o)),
19022                 },
19023                 result_ok: true,
19024         }
19025 }
19026 #[no_mangle]
19027 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
19028 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
19029         CResult_ReplyChannelRangeDecodeErrorZ {
19030                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19031                         err: Box::into_raw(Box::new(e)),
19032                 },
19033                 result_ok: false,
19034         }
19035 }
19036 /// Checks if the given object is currently in the success state
19037 #[no_mangle]
19038 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
19039         o.result_ok
19040 }
19041 #[no_mangle]
19042 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
19043 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
19044 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
19045         fn drop(&mut self) {
19046                 if self.result_ok {
19047                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19048                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19049                         }
19050                 } else {
19051                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19052                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19053                         }
19054                 }
19055         }
19056 }
19057 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
19058         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
19059                 let contents = if o.result_ok {
19060                         let result = unsafe { o.contents.result };
19061                         unsafe { o.contents.result = core::ptr::null_mut() };
19062                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
19063                 } else {
19064                         let err = unsafe { o.contents.err };
19065                         unsafe { o.contents.err = core::ptr::null_mut(); }
19066                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
19067                 };
19068                 Self {
19069                         contents,
19070                         result_ok: o.result_ok,
19071                 }
19072         }
19073 }
19074 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
19075         fn clone(&self) -> Self {
19076                 if self.result_ok {
19077                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19078                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
19079                         } }
19080                 } else {
19081                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19082                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19083                         } }
19084                 }
19085         }
19086 }
19087 #[no_mangle]
19088 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
19089 /// but with all dynamically-allocated buffers duplicated in new buffers.
19090 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
19091 #[repr(C)]
19092 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
19093 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
19094         /// A pointer to the contents in the success state.
19095         /// Reading from this pointer when `result_ok` is not set is undefined.
19096         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
19097         /// A pointer to the contents in the error state.
19098         /// Reading from this pointer when `result_ok` is set is undefined.
19099         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19100 }
19101 #[repr(C)]
19102 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
19103 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
19104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19105 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
19106         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
19107         /// `err` or `result` depending on the state of `result_ok`.
19108         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
19109         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
19110         pub result_ok: bool,
19111 }
19112 #[no_mangle]
19113 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
19114 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
19115         CResult_GossipTimestampFilterDecodeErrorZ {
19116                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19117                         result: Box::into_raw(Box::new(o)),
19118                 },
19119                 result_ok: true,
19120         }
19121 }
19122 #[no_mangle]
19123 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
19124 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
19125         CResult_GossipTimestampFilterDecodeErrorZ {
19126                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19127                         err: Box::into_raw(Box::new(e)),
19128                 },
19129                 result_ok: false,
19130         }
19131 }
19132 /// Checks if the given object is currently in the success state
19133 #[no_mangle]
19134 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
19135         o.result_ok
19136 }
19137 #[no_mangle]
19138 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
19139 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
19140 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
19141         fn drop(&mut self) {
19142                 if self.result_ok {
19143                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19144                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19145                         }
19146                 } else {
19147                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19148                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19149                         }
19150                 }
19151         }
19152 }
19153 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
19154         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
19155                 let contents = if o.result_ok {
19156                         let result = unsafe { o.contents.result };
19157                         unsafe { o.contents.result = core::ptr::null_mut() };
19158                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
19159                 } else {
19160                         let err = unsafe { o.contents.err };
19161                         unsafe { o.contents.err = core::ptr::null_mut(); }
19162                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
19163                 };
19164                 Self {
19165                         contents,
19166                         result_ok: o.result_ok,
19167                 }
19168         }
19169 }
19170 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
19171         fn clone(&self) -> Self {
19172                 if self.result_ok {
19173                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19174                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
19175                         } }
19176                 } else {
19177                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19178                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19179                         } }
19180                 }
19181         }
19182 }
19183 #[no_mangle]
19184 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
19185 /// but with all dynamically-allocated buffers duplicated in new buffers.
19186 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
19187 #[repr(C)]
19188 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
19189 /// This corresponds to std::vector in C++
19190 pub struct CVec_PhantomRouteHintsZ {
19191         /// The elements in the array.
19192         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19193         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
19194         /// The number of elements pointed to by `data`.
19195         pub datalen: usize
19196 }
19197 impl CVec_PhantomRouteHintsZ {
19198         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
19199                 if self.datalen == 0 { return Vec::new(); }
19200                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19201                 self.data = core::ptr::null_mut();
19202                 self.datalen = 0;
19203                 ret
19204         }
19205         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
19206                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19207         }
19208 }
19209 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
19210         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
19211                 let datalen = v.len();
19212                 let data = Box::into_raw(v.into_boxed_slice());
19213                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19214         }
19215 }
19216 #[no_mangle]
19217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19218 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
19219 impl Drop for CVec_PhantomRouteHintsZ {
19220         fn drop(&mut self) {
19221                 if self.datalen == 0 { return; }
19222                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19223         }
19224 }
19225 impl Clone for CVec_PhantomRouteHintsZ {
19226         fn clone(&self) -> Self {
19227                 let mut res = Vec::new();
19228                 if self.datalen == 0 { return Self::from(res); }
19229                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19230                 Self::from(res)
19231         }
19232 }
19233 #[repr(C)]
19234 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
19235 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19236         /// A pointer to the contents in the success state.
19237         /// Reading from this pointer when `result_ok` is not set is undefined.
19238         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19239         /// A pointer to the contents in the error state.
19240         /// Reading from this pointer when `result_ok` is set is undefined.
19241         pub err: *mut crate::lightning_invoice::SignOrCreationError,
19242 }
19243 #[repr(C)]
19244 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
19245 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
19246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19247 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
19248         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
19249         /// `err` or `result` depending on the state of `result_ok`.
19250         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
19251         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
19252         pub result_ok: bool,
19253 }
19254 #[no_mangle]
19255 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
19256 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
19257         CResult_Bolt11InvoiceSignOrCreationErrorZ {
19258                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19259                         result: Box::into_raw(Box::new(o)),
19260                 },
19261                 result_ok: true,
19262         }
19263 }
19264 #[no_mangle]
19265 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
19266 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
19267         CResult_Bolt11InvoiceSignOrCreationErrorZ {
19268                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19269                         err: Box::into_raw(Box::new(e)),
19270                 },
19271                 result_ok: false,
19272         }
19273 }
19274 /// Checks if the given object is currently in the success state
19275 #[no_mangle]
19276 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
19277         o.result_ok
19278 }
19279 #[no_mangle]
19280 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
19281 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
19282 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19283         fn drop(&mut self) {
19284                 if self.result_ok {
19285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19287                         }
19288                 } else {
19289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19291                         }
19292                 }
19293         }
19294 }
19295 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19296         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
19297                 let contents = if o.result_ok {
19298                         let result = unsafe { o.contents.result };
19299                         unsafe { o.contents.result = core::ptr::null_mut() };
19300                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
19301                 } else {
19302                         let err = unsafe { o.contents.err };
19303                         unsafe { o.contents.err = core::ptr::null_mut(); }
19304                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
19305                 };
19306                 Self {
19307                         contents,
19308                         result_ok: o.result_ok,
19309                 }
19310         }
19311 }
19312 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19313         fn clone(&self) -> Self {
19314                 if self.result_ok {
19315                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19316                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19317                         } }
19318                 } else {
19319                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19320                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
19321                         } }
19322                 }
19323         }
19324 }
19325 #[no_mangle]
19326 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
19327 /// but with all dynamically-allocated buffers duplicated in new buffers.
19328 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
19329 #[repr(C)]
19330 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
19331 /// This corresponds to std::vector in C++
19332 pub struct CVec_FutureZ {
19333         /// The elements in the array.
19334         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19335         pub data: *mut crate::lightning::util::wakers::Future,
19336         /// The number of elements pointed to by `data`.
19337         pub datalen: usize
19338 }
19339 impl CVec_FutureZ {
19340         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
19341                 if self.datalen == 0 { return Vec::new(); }
19342                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19343                 self.data = core::ptr::null_mut();
19344                 self.datalen = 0;
19345                 ret
19346         }
19347         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
19348                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19349         }
19350 }
19351 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
19352         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
19353                 let datalen = v.len();
19354                 let data = Box::into_raw(v.into_boxed_slice());
19355                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19356         }
19357 }
19358 #[no_mangle]
19359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19360 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
19361 impl Drop for CVec_FutureZ {
19362         fn drop(&mut self) {
19363                 if self.datalen == 0 { return; }
19364                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19365         }
19366 }
19367 impl Clone for CVec_FutureZ {
19368         fn clone(&self) -> Self {
19369                 let mut res = Vec::new();
19370                 if self.datalen == 0 { return Self::from(res); }
19371                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19372                 Self::from(res)
19373         }
19374 }
19375 #[repr(C)]
19376 /// The contents of CResult_OffersMessageDecodeErrorZ
19377 pub union CResult_OffersMessageDecodeErrorZPtr {
19378         /// A pointer to the contents in the success state.
19379         /// Reading from this pointer when `result_ok` is not set is undefined.
19380         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
19381         /// A pointer to the contents in the error state.
19382         /// Reading from this pointer when `result_ok` is set is undefined.
19383         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19384 }
19385 #[repr(C)]
19386 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
19387 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19388 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19389 pub struct CResult_OffersMessageDecodeErrorZ {
19390         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
19391         /// `err` or `result` depending on the state of `result_ok`.
19392         pub contents: CResult_OffersMessageDecodeErrorZPtr,
19393         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
19394         pub result_ok: bool,
19395 }
19396 #[no_mangle]
19397 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
19398 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
19399         CResult_OffersMessageDecodeErrorZ {
19400                 contents: CResult_OffersMessageDecodeErrorZPtr {
19401                         result: Box::into_raw(Box::new(o)),
19402                 },
19403                 result_ok: true,
19404         }
19405 }
19406 #[no_mangle]
19407 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
19408 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
19409         CResult_OffersMessageDecodeErrorZ {
19410                 contents: CResult_OffersMessageDecodeErrorZPtr {
19411                         err: Box::into_raw(Box::new(e)),
19412                 },
19413                 result_ok: false,
19414         }
19415 }
19416 /// Checks if the given object is currently in the success state
19417 #[no_mangle]
19418 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
19419         o.result_ok
19420 }
19421 #[no_mangle]
19422 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
19423 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
19424 impl Drop for CResult_OffersMessageDecodeErrorZ {
19425         fn drop(&mut self) {
19426                 if self.result_ok {
19427                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19428                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19429                         }
19430                 } else {
19431                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19432                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19433                         }
19434                 }
19435         }
19436 }
19437 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
19438         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19439                 let contents = if o.result_ok {
19440                         let result = unsafe { o.contents.result };
19441                         unsafe { o.contents.result = core::ptr::null_mut() };
19442                         CResult_OffersMessageDecodeErrorZPtr { result }
19443                 } else {
19444                         let err = unsafe { o.contents.err };
19445                         unsafe { o.contents.err = core::ptr::null_mut(); }
19446                         CResult_OffersMessageDecodeErrorZPtr { err }
19447                 };
19448                 Self {
19449                         contents,
19450                         result_ok: o.result_ok,
19451                 }
19452         }
19453 }
19454 impl Clone for CResult_OffersMessageDecodeErrorZ {
19455         fn clone(&self) -> Self {
19456                 if self.result_ok {
19457                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
19458                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
19459                         } }
19460                 } else {
19461                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
19462                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19463                         } }
19464                 }
19465         }
19466 }
19467 #[no_mangle]
19468 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
19469 /// but with all dynamically-allocated buffers duplicated in new buffers.
19470 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
19471 #[repr(C)]
19472 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
19473 pub enum COption_HTLCClaimZ {
19474         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
19475         Some(crate::lightning::ln::chan_utils::HTLCClaim),
19476         /// When we're in this state, this COption_HTLCClaimZ contains nothing
19477         None
19478 }
19479 impl COption_HTLCClaimZ {
19480         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19481                 if let Self::None = self { false } else { true }
19482         }
19483         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19484                 !self.is_some()
19485         }
19486         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
19487                 if let Self::Some(v) = self { v } else { unreachable!() }
19488         }
19489 }
19490 #[no_mangle]
19491 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
19492 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
19493         COption_HTLCClaimZ::Some(o)
19494 }
19495 #[no_mangle]
19496 /// Constructs a new COption_HTLCClaimZ containing nothing
19497 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
19498         COption_HTLCClaimZ::None
19499 }
19500 #[no_mangle]
19501 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
19502 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
19503 #[repr(C)]
19504 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
19505 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19506         /// A pointer to the contents in the success state.
19507         /// Reading from this pointer when `result_ok` is not set is undefined.
19508         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
19509         /// A pointer to the contents in the error state.
19510         /// Reading from this pointer when `result_ok` is set is undefined.
19511         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19512 }
19513 #[repr(C)]
19514 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
19515 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
19516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19517 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19518         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
19519         /// `err` or `result` depending on the state of `result_ok`.
19520         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
19521         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
19522         pub result_ok: bool,
19523 }
19524 #[no_mangle]
19525 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
19526 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19527         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19528                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19529                         result: Box::into_raw(Box::new(o)),
19530                 },
19531                 result_ok: true,
19532         }
19533 }
19534 #[no_mangle]
19535 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
19536 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19537         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19538                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19539                         err: Box::into_raw(Box::new(e)),
19540                 },
19541                 result_ok: false,
19542         }
19543 }
19544 /// Checks if the given object is currently in the success state
19545 #[no_mangle]
19546 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
19547         o.result_ok
19548 }
19549 #[no_mangle]
19550 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
19551 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
19552 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19553         fn drop(&mut self) {
19554                 if self.result_ok {
19555                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19556                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19557                         }
19558                 } else {
19559                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19560                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19561                         }
19562                 }
19563         }
19564 }
19565 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19566         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
19567                 let contents = if o.result_ok {
19568                         let result = unsafe { o.contents.result };
19569                         unsafe { o.contents.result = core::ptr::null_mut() };
19570                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
19571                 } else {
19572                         let err = unsafe { o.contents.err };
19573                         unsafe { o.contents.err = core::ptr::null_mut(); }
19574                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
19575                 };
19576                 Self {
19577                         contents,
19578                         result_ok: o.result_ok,
19579                 }
19580         }
19581 }
19582 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19583         fn clone(&self) -> Self {
19584                 if self.result_ok {
19585                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19586                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
19587                         } }
19588                 } else {
19589                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19590                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19591                         } }
19592                 }
19593         }
19594 }
19595 #[no_mangle]
19596 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
19597 /// but with all dynamically-allocated buffers duplicated in new buffers.
19598 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
19599 #[repr(C)]
19600 /// The contents of CResult_TxCreationKeysDecodeErrorZ
19601 pub union CResult_TxCreationKeysDecodeErrorZPtr {
19602         /// A pointer to the contents in the success state.
19603         /// Reading from this pointer when `result_ok` is not set is undefined.
19604         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
19605         /// A pointer to the contents in the error state.
19606         /// Reading from this pointer when `result_ok` is set is undefined.
19607         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19608 }
19609 #[repr(C)]
19610 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
19611 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
19612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19613 pub struct CResult_TxCreationKeysDecodeErrorZ {
19614         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
19615         /// `err` or `result` depending on the state of `result_ok`.
19616         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
19617         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
19618         pub result_ok: bool,
19619 }
19620 #[no_mangle]
19621 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
19622 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
19623         CResult_TxCreationKeysDecodeErrorZ {
19624                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
19625                         result: Box::into_raw(Box::new(o)),
19626                 },
19627                 result_ok: true,
19628         }
19629 }
19630 #[no_mangle]
19631 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
19632 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
19633         CResult_TxCreationKeysDecodeErrorZ {
19634                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
19635                         err: Box::into_raw(Box::new(e)),
19636                 },
19637                 result_ok: false,
19638         }
19639 }
19640 /// Checks if the given object is currently in the success state
19641 #[no_mangle]
19642 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
19643         o.result_ok
19644 }
19645 #[no_mangle]
19646 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
19647 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
19648 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
19649         fn drop(&mut self) {
19650                 if self.result_ok {
19651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19653                         }
19654                 } else {
19655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19657                         }
19658                 }
19659         }
19660 }
19661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
19662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
19663                 let contents = if o.result_ok {
19664                         let result = unsafe { o.contents.result };
19665                         unsafe { o.contents.result = core::ptr::null_mut() };
19666                         CResult_TxCreationKeysDecodeErrorZPtr { result }
19667                 } else {
19668                         let err = unsafe { o.contents.err };
19669                         unsafe { o.contents.err = core::ptr::null_mut(); }
19670                         CResult_TxCreationKeysDecodeErrorZPtr { err }
19671                 };
19672                 Self {
19673                         contents,
19674                         result_ok: o.result_ok,
19675                 }
19676         }
19677 }
19678 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
19679         fn clone(&self) -> Self {
19680                 if self.result_ok {
19681                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
19682                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
19683                         } }
19684                 } else {
19685                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
19686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19687                         } }
19688                 }
19689         }
19690 }
19691 #[no_mangle]
19692 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
19693 /// but with all dynamically-allocated buffers duplicated in new buffers.
19694 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
19695 #[repr(C)]
19696 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
19697 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
19698         /// A pointer to the contents in the success state.
19699         /// Reading from this pointer when `result_ok` is not set is undefined.
19700         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
19701         /// A pointer to the contents in the error state.
19702         /// Reading from this pointer when `result_ok` is set is undefined.
19703         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19704 }
19705 #[repr(C)]
19706 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
19707 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
19708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19709 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
19710         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
19711         /// `err` or `result` depending on the state of `result_ok`.
19712         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
19713         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
19714         pub result_ok: bool,
19715 }
19716 #[no_mangle]
19717 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
19718 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
19719         CResult_ChannelPublicKeysDecodeErrorZ {
19720                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19721                         result: Box::into_raw(Box::new(o)),
19722                 },
19723                 result_ok: true,
19724         }
19725 }
19726 #[no_mangle]
19727 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
19728 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
19729         CResult_ChannelPublicKeysDecodeErrorZ {
19730                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19731                         err: Box::into_raw(Box::new(e)),
19732                 },
19733                 result_ok: false,
19734         }
19735 }
19736 /// Checks if the given object is currently in the success state
19737 #[no_mangle]
19738 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
19739         o.result_ok
19740 }
19741 #[no_mangle]
19742 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
19743 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
19744 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
19745         fn drop(&mut self) {
19746                 if self.result_ok {
19747                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19748                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19749                         }
19750                 } else {
19751                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19752                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19753                         }
19754                 }
19755         }
19756 }
19757 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
19758         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
19759                 let contents = if o.result_ok {
19760                         let result = unsafe { o.contents.result };
19761                         unsafe { o.contents.result = core::ptr::null_mut() };
19762                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
19763                 } else {
19764                         let err = unsafe { o.contents.err };
19765                         unsafe { o.contents.err = core::ptr::null_mut(); }
19766                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
19767                 };
19768                 Self {
19769                         contents,
19770                         result_ok: o.result_ok,
19771                 }
19772         }
19773 }
19774 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
19775         fn clone(&self) -> Self {
19776                 if self.result_ok {
19777                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19778                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
19779                         } }
19780                 } else {
19781                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19782                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19783                         } }
19784                 }
19785         }
19786 }
19787 #[no_mangle]
19788 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
19789 /// but with all dynamically-allocated buffers duplicated in new buffers.
19790 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
19791 #[repr(C)]
19792 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
19793 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19794         /// A pointer to the contents in the success state.
19795         /// Reading from this pointer when `result_ok` is not set is undefined.
19796         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
19797         /// A pointer to the contents in the error state.
19798         /// Reading from this pointer when `result_ok` is set is undefined.
19799         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19800 }
19801 #[repr(C)]
19802 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
19803 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
19804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19805 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
19806         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
19807         /// `err` or `result` depending on the state of `result_ok`.
19808         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
19809         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
19810         pub result_ok: bool,
19811 }
19812 #[no_mangle]
19813 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
19814 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
19815         CResult_HTLCOutputInCommitmentDecodeErrorZ {
19816                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19817                         result: Box::into_raw(Box::new(o)),
19818                 },
19819                 result_ok: true,
19820         }
19821 }
19822 #[no_mangle]
19823 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
19824 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
19825         CResult_HTLCOutputInCommitmentDecodeErrorZ {
19826                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19827                         err: Box::into_raw(Box::new(e)),
19828                 },
19829                 result_ok: false,
19830         }
19831 }
19832 /// Checks if the given object is currently in the success state
19833 #[no_mangle]
19834 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
19835         o.result_ok
19836 }
19837 #[no_mangle]
19838 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
19839 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
19840 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19841         fn drop(&mut self) {
19842                 if self.result_ok {
19843                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19844                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19845                         }
19846                 } else {
19847                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19848                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19849                         }
19850                 }
19851         }
19852 }
19853 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19854         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
19855                 let contents = if o.result_ok {
19856                         let result = unsafe { o.contents.result };
19857                         unsafe { o.contents.result = core::ptr::null_mut() };
19858                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
19859                 } else {
19860                         let err = unsafe { o.contents.err };
19861                         unsafe { o.contents.err = core::ptr::null_mut(); }
19862                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
19863                 };
19864                 Self {
19865                         contents,
19866                         result_ok: o.result_ok,
19867                 }
19868         }
19869 }
19870 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19871         fn clone(&self) -> Self {
19872                 if self.result_ok {
19873                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19874                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
19875                         } }
19876                 } else {
19877                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19878                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19879                         } }
19880                 }
19881         }
19882 }
19883 #[no_mangle]
19884 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
19885 /// but with all dynamically-allocated buffers duplicated in new buffers.
19886 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
19887 #[repr(C)]
19888 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
19889 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19890         /// A pointer to the contents in the success state.
19891         /// Reading from this pointer when `result_ok` is not set is undefined.
19892         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
19893         /// A pointer to the contents in the error state.
19894         /// Reading from this pointer when `result_ok` is set is undefined.
19895         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19896 }
19897 #[repr(C)]
19898 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
19899 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
19900 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19901 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19902         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
19903         /// `err` or `result` depending on the state of `result_ok`.
19904         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
19905         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
19906         pub result_ok: bool,
19907 }
19908 #[no_mangle]
19909 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
19910 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19911         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19912                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19913                         result: Box::into_raw(Box::new(o)),
19914                 },
19915                 result_ok: true,
19916         }
19917 }
19918 #[no_mangle]
19919 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
19920 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19921         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19922                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19923                         err: Box::into_raw(Box::new(e)),
19924                 },
19925                 result_ok: false,
19926         }
19927 }
19928 /// Checks if the given object is currently in the success state
19929 #[no_mangle]
19930 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
19931         o.result_ok
19932 }
19933 #[no_mangle]
19934 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
19935 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
19936 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19937         fn drop(&mut self) {
19938                 if self.result_ok {
19939                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19940                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19941                         }
19942                 } else {
19943                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19944                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19945                         }
19946                 }
19947         }
19948 }
19949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19950         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
19951                 let contents = if o.result_ok {
19952                         let result = unsafe { o.contents.result };
19953                         unsafe { o.contents.result = core::ptr::null_mut() };
19954                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
19955                 } else {
19956                         let err = unsafe { o.contents.err };
19957                         unsafe { o.contents.err = core::ptr::null_mut(); }
19958                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
19959                 };
19960                 Self {
19961                         contents,
19962                         result_ok: o.result_ok,
19963                 }
19964         }
19965 }
19966 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19967         fn clone(&self) -> Self {
19968                 if self.result_ok {
19969                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19970                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
19971                         } }
19972                 } else {
19973                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19974                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19975                         } }
19976                 }
19977         }
19978 }
19979 #[no_mangle]
19980 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
19981 /// but with all dynamically-allocated buffers duplicated in new buffers.
19982 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
19983 #[repr(C)]
19984 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
19985 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
19986         /// A pointer to the contents in the success state.
19987         /// Reading from this pointer when `result_ok` is not set is undefined.
19988         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
19989         /// A pointer to the contents in the error state.
19990         /// Reading from this pointer when `result_ok` is set is undefined.
19991         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19992 }
19993 #[repr(C)]
19994 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
19995 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
19996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19997 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
19998         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
19999         /// `err` or `result` depending on the state of `result_ok`.
20000         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
20001         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
20002         pub result_ok: bool,
20003 }
20004 #[no_mangle]
20005 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
20006 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
20007         CResult_ChannelTransactionParametersDecodeErrorZ {
20008                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20009                         result: Box::into_raw(Box::new(o)),
20010                 },
20011                 result_ok: true,
20012         }
20013 }
20014 #[no_mangle]
20015 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
20016 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
20017         CResult_ChannelTransactionParametersDecodeErrorZ {
20018                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20019                         err: Box::into_raw(Box::new(e)),
20020                 },
20021                 result_ok: false,
20022         }
20023 }
20024 /// Checks if the given object is currently in the success state
20025 #[no_mangle]
20026 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
20027         o.result_ok
20028 }
20029 #[no_mangle]
20030 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
20031 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
20032 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
20033         fn drop(&mut self) {
20034                 if self.result_ok {
20035                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20036                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20037                         }
20038                 } else {
20039                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20040                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20041                         }
20042                 }
20043         }
20044 }
20045 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
20046         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
20047                 let contents = if o.result_ok {
20048                         let result = unsafe { o.contents.result };
20049                         unsafe { o.contents.result = core::ptr::null_mut() };
20050                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
20051                 } else {
20052                         let err = unsafe { o.contents.err };
20053                         unsafe { o.contents.err = core::ptr::null_mut(); }
20054                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
20055                 };
20056                 Self {
20057                         contents,
20058                         result_ok: o.result_ok,
20059                 }
20060         }
20061 }
20062 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
20063         fn clone(&self) -> Self {
20064                 if self.result_ok {
20065                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20066                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
20067                         } }
20068                 } else {
20069                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20070                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20071                         } }
20072                 }
20073         }
20074 }
20075 #[no_mangle]
20076 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
20077 /// but with all dynamically-allocated buffers duplicated in new buffers.
20078 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
20079 #[repr(C)]
20080 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
20081 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20082         /// A pointer to the contents in the success state.
20083         /// Reading from this pointer when `result_ok` is not set is undefined.
20084         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
20085         /// A pointer to the contents in the error state.
20086         /// Reading from this pointer when `result_ok` is set is undefined.
20087         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20088 }
20089 #[repr(C)]
20090 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20091 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20093 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
20094         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
20095         /// `err` or `result` depending on the state of `result_ok`.
20096         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
20097         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
20098         pub result_ok: bool,
20099 }
20100 #[no_mangle]
20101 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
20102 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
20103         CResult_HolderCommitmentTransactionDecodeErrorZ {
20104                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20105                         result: Box::into_raw(Box::new(o)),
20106                 },
20107                 result_ok: true,
20108         }
20109 }
20110 #[no_mangle]
20111 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
20112 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
20113         CResult_HolderCommitmentTransactionDecodeErrorZ {
20114                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20115                         err: Box::into_raw(Box::new(e)),
20116                 },
20117                 result_ok: false,
20118         }
20119 }
20120 /// Checks if the given object is currently in the success state
20121 #[no_mangle]
20122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
20123         o.result_ok
20124 }
20125 #[no_mangle]
20126 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
20127 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
20128 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
20129         fn drop(&mut self) {
20130                 if self.result_ok {
20131                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20132                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20133                         }
20134                 } else {
20135                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20136                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20137                         }
20138                 }
20139         }
20140 }
20141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
20142         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20143                 let contents = if o.result_ok {
20144                         let result = unsafe { o.contents.result };
20145                         unsafe { o.contents.result = core::ptr::null_mut() };
20146                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
20147                 } else {
20148                         let err = unsafe { o.contents.err };
20149                         unsafe { o.contents.err = core::ptr::null_mut(); }
20150                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
20151                 };
20152                 Self {
20153                         contents,
20154                         result_ok: o.result_ok,
20155                 }
20156         }
20157 }
20158 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
20159         fn clone(&self) -> Self {
20160                 if self.result_ok {
20161                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20162                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20163                         } }
20164                 } else {
20165                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20166                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20167                         } }
20168                 }
20169         }
20170 }
20171 #[no_mangle]
20172 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
20173 /// but with all dynamically-allocated buffers duplicated in new buffers.
20174 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20175 #[repr(C)]
20176 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
20177 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20178         /// A pointer to the contents in the success state.
20179         /// Reading from this pointer when `result_ok` is not set is undefined.
20180         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
20181         /// A pointer to the contents in the error state.
20182         /// Reading from this pointer when `result_ok` is set is undefined.
20183         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20184 }
20185 #[repr(C)]
20186 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20187 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20189 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
20190         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
20191         /// `err` or `result` depending on the state of `result_ok`.
20192         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
20193         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
20194         pub result_ok: bool,
20195 }
20196 #[no_mangle]
20197 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
20198 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
20199         CResult_BuiltCommitmentTransactionDecodeErrorZ {
20200                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20201                         result: Box::into_raw(Box::new(o)),
20202                 },
20203                 result_ok: true,
20204         }
20205 }
20206 #[no_mangle]
20207 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
20208 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
20209         CResult_BuiltCommitmentTransactionDecodeErrorZ {
20210                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20211                         err: Box::into_raw(Box::new(e)),
20212                 },
20213                 result_ok: false,
20214         }
20215 }
20216 /// Checks if the given object is currently in the success state
20217 #[no_mangle]
20218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
20219         o.result_ok
20220 }
20221 #[no_mangle]
20222 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
20223 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
20224 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20225         fn drop(&mut self) {
20226                 if self.result_ok {
20227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20229                         }
20230                 } else {
20231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20233                         }
20234                 }
20235         }
20236 }
20237 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20238         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20239                 let contents = if o.result_ok {
20240                         let result = unsafe { o.contents.result };
20241                         unsafe { o.contents.result = core::ptr::null_mut() };
20242                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
20243                 } else {
20244                         let err = unsafe { o.contents.err };
20245                         unsafe { o.contents.err = core::ptr::null_mut(); }
20246                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
20247                 };
20248                 Self {
20249                         contents,
20250                         result_ok: o.result_ok,
20251                 }
20252         }
20253 }
20254 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20255         fn clone(&self) -> Self {
20256                 if self.result_ok {
20257                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20258                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20259                         } }
20260                 } else {
20261                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20262                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20263                         } }
20264                 }
20265         }
20266 }
20267 #[no_mangle]
20268 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
20269 /// but with all dynamically-allocated buffers duplicated in new buffers.
20270 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20271 #[repr(C)]
20272 /// The contents of CResult_TrustedClosingTransactionNoneZ
20273 pub union CResult_TrustedClosingTransactionNoneZPtr {
20274         /// A pointer to the contents in the success state.
20275         /// Reading from this pointer when `result_ok` is not set is undefined.
20276         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
20277         /// Note that this value is always NULL, as there are no contents in the Err variant
20278         pub err: *mut core::ffi::c_void,
20279 }
20280 #[repr(C)]
20281 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
20282 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
20283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20284 pub struct CResult_TrustedClosingTransactionNoneZ {
20285         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
20286         /// `err` or `result` depending on the state of `result_ok`.
20287         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
20288         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
20289         pub result_ok: bool,
20290 }
20291 #[no_mangle]
20292 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
20293 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
20294         CResult_TrustedClosingTransactionNoneZ {
20295                 contents: CResult_TrustedClosingTransactionNoneZPtr {
20296                         result: Box::into_raw(Box::new(o)),
20297                 },
20298                 result_ok: true,
20299         }
20300 }
20301 #[no_mangle]
20302 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
20303 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
20304         CResult_TrustedClosingTransactionNoneZ {
20305                 contents: CResult_TrustedClosingTransactionNoneZPtr {
20306                         err: core::ptr::null_mut(),
20307                 },
20308                 result_ok: false,
20309         }
20310 }
20311 /// Checks if the given object is currently in the success state
20312 #[no_mangle]
20313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
20314         o.result_ok
20315 }
20316 #[no_mangle]
20317 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
20318 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
20319 impl Drop for CResult_TrustedClosingTransactionNoneZ {
20320         fn drop(&mut self) {
20321                 if self.result_ok {
20322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20324                         }
20325                 } else {
20326                 }
20327         }
20328 }
20329 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
20330         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
20331                 let contents = if o.result_ok {
20332                         let result = unsafe { o.contents.result };
20333                         unsafe { o.contents.result = core::ptr::null_mut() };
20334                         CResult_TrustedClosingTransactionNoneZPtr { result }
20335                 } else {
20336                         let _ = unsafe { Box::from_raw(o.contents.err) };
20337                         o.contents.err = core::ptr::null_mut();
20338                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
20339                 };
20340                 Self {
20341                         contents,
20342                         result_ok: o.result_ok,
20343                 }
20344         }
20345 }
20346 #[repr(C)]
20347 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
20348 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
20349         /// A pointer to the contents in the success state.
20350         /// Reading from this pointer when `result_ok` is not set is undefined.
20351         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
20352         /// A pointer to the contents in the error state.
20353         /// Reading from this pointer when `result_ok` is set is undefined.
20354         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20355 }
20356 #[repr(C)]
20357 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20358 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20360 pub struct CResult_CommitmentTransactionDecodeErrorZ {
20361         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
20362         /// `err` or `result` depending on the state of `result_ok`.
20363         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
20364         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
20365         pub result_ok: bool,
20366 }
20367 #[no_mangle]
20368 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
20369 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
20370         CResult_CommitmentTransactionDecodeErrorZ {
20371                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20372                         result: Box::into_raw(Box::new(o)),
20373                 },
20374                 result_ok: true,
20375         }
20376 }
20377 #[no_mangle]
20378 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
20379 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
20380         CResult_CommitmentTransactionDecodeErrorZ {
20381                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20382                         err: Box::into_raw(Box::new(e)),
20383                 },
20384                 result_ok: false,
20385         }
20386 }
20387 /// Checks if the given object is currently in the success state
20388 #[no_mangle]
20389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
20390         o.result_ok
20391 }
20392 #[no_mangle]
20393 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
20394 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
20395 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
20396         fn drop(&mut self) {
20397                 if self.result_ok {
20398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20400                         }
20401                 } else {
20402                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20403                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20404                         }
20405                 }
20406         }
20407 }
20408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
20409         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20410                 let contents = if o.result_ok {
20411                         let result = unsafe { o.contents.result };
20412                         unsafe { o.contents.result = core::ptr::null_mut() };
20413                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
20414                 } else {
20415                         let err = unsafe { o.contents.err };
20416                         unsafe { o.contents.err = core::ptr::null_mut(); }
20417                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
20418                 };
20419                 Self {
20420                         contents,
20421                         result_ok: o.result_ok,
20422                 }
20423         }
20424 }
20425 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
20426         fn clone(&self) -> Self {
20427                 if self.result_ok {
20428                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20429                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20430                         } }
20431                 } else {
20432                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20433                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20434                         } }
20435                 }
20436         }
20437 }
20438 #[no_mangle]
20439 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
20440 /// but with all dynamically-allocated buffers duplicated in new buffers.
20441 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20442 #[repr(C)]
20443 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
20444 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
20445         /// A pointer to the contents in the success state.
20446         /// Reading from this pointer when `result_ok` is not set is undefined.
20447         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
20448         /// Note that this value is always NULL, as there are no contents in the Err variant
20449         pub err: *mut core::ffi::c_void,
20450 }
20451 #[repr(C)]
20452 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
20453 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
20454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20455 pub struct CResult_TrustedCommitmentTransactionNoneZ {
20456         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
20457         /// `err` or `result` depending on the state of `result_ok`.
20458         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
20459         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
20460         pub result_ok: bool,
20461 }
20462 #[no_mangle]
20463 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
20464 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
20465         CResult_TrustedCommitmentTransactionNoneZ {
20466                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
20467                         result: Box::into_raw(Box::new(o)),
20468                 },
20469                 result_ok: true,
20470         }
20471 }
20472 #[no_mangle]
20473 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
20474 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
20475         CResult_TrustedCommitmentTransactionNoneZ {
20476                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
20477                         err: core::ptr::null_mut(),
20478                 },
20479                 result_ok: false,
20480         }
20481 }
20482 /// Checks if the given object is currently in the success state
20483 #[no_mangle]
20484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
20485         o.result_ok
20486 }
20487 #[no_mangle]
20488 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
20489 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
20490 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
20491         fn drop(&mut self) {
20492                 if self.result_ok {
20493                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20494                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20495                         }
20496                 } else {
20497                 }
20498         }
20499 }
20500 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
20501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
20502                 let contents = if o.result_ok {
20503                         let result = unsafe { o.contents.result };
20504                         unsafe { o.contents.result = core::ptr::null_mut() };
20505                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
20506                 } else {
20507                         let _ = unsafe { Box::from_raw(o.contents.err) };
20508                         o.contents.err = core::ptr::null_mut();
20509                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
20510                 };
20511                 Self {
20512                         contents,
20513                         result_ok: o.result_ok,
20514                 }
20515         }
20516 }
20517 #[repr(C)]
20518 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
20519 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
20520         /// A pointer to the contents in the success state.
20521         /// Reading from this pointer when `result_ok` is not set is undefined.
20522         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
20523         /// Note that this value is always NULL, as there are no contents in the Err variant
20524         pub err: *mut core::ffi::c_void,
20525 }
20526 #[repr(C)]
20527 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
20528 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
20529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20530 pub struct CResult_CVec_ECDSASignatureZNoneZ {
20531         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
20532         /// `err` or `result` depending on the state of `result_ok`.
20533         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
20534         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
20535         pub result_ok: bool,
20536 }
20537 #[no_mangle]
20538 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
20539 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
20540         CResult_CVec_ECDSASignatureZNoneZ {
20541                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20542                         result: Box::into_raw(Box::new(o)),
20543                 },
20544                 result_ok: true,
20545         }
20546 }
20547 #[no_mangle]
20548 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
20549 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
20550         CResult_CVec_ECDSASignatureZNoneZ {
20551                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20552                         err: core::ptr::null_mut(),
20553                 },
20554                 result_ok: false,
20555         }
20556 }
20557 /// Checks if the given object is currently in the success state
20558 #[no_mangle]
20559 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
20560         o.result_ok
20561 }
20562 #[no_mangle]
20563 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
20564 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
20565 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
20566         fn drop(&mut self) {
20567                 if self.result_ok {
20568                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20569                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20570                         }
20571                 } else {
20572                 }
20573         }
20574 }
20575 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
20576         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> 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_CVec_ECDSASignatureZNoneZPtr { result }
20581                 } else {
20582                         let _ = unsafe { Box::from_raw(o.contents.err) };
20583                         o.contents.err = core::ptr::null_mut();
20584                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
20585                 };
20586                 Self {
20587                         contents,
20588                         result_ok: o.result_ok,
20589                 }
20590         }
20591 }
20592 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
20593         fn clone(&self) -> Self {
20594                 if self.result_ok {
20595                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20596                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
20597                         } }
20598                 } else {
20599                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20600                                 err: core::ptr::null_mut()
20601                         } }
20602                 }
20603         }
20604 }
20605 #[no_mangle]
20606 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
20607 /// but with all dynamically-allocated buffers duplicated in new buffers.
20608 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
20609 #[repr(C)]
20610 #[derive(Clone)]
20611 /// An enum which can either contain a usize or not
20612 pub enum COption_usizeZ {
20613         /// When we're in this state, this COption_usizeZ contains a usize
20614         Some(usize),
20615         /// When we're in this state, this COption_usizeZ contains nothing
20616         None
20617 }
20618 impl COption_usizeZ {
20619         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20620                 if let Self::None = self { false } else { true }
20621         }
20622         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20623                 !self.is_some()
20624         }
20625         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
20626                 if let Self::Some(v) = self { v } else { unreachable!() }
20627         }
20628 }
20629 #[no_mangle]
20630 /// Constructs a new COption_usizeZ containing a usize
20631 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
20632         COption_usizeZ::Some(o)
20633 }
20634 #[no_mangle]
20635 /// Constructs a new COption_usizeZ containing nothing
20636 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
20637         COption_usizeZ::None
20638 }
20639 #[no_mangle]
20640 /// Frees any resources associated with the usize, if we are in the Some state
20641 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
20642 #[no_mangle]
20643 /// Creates a new COption_usizeZ which has the same data as `orig`
20644 /// but with all dynamically-allocated buffers duplicated in new buffers.
20645 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
20646 #[repr(C)]
20647 /// The contents of CResult_ShutdownScriptDecodeErrorZ
20648 pub union CResult_ShutdownScriptDecodeErrorZPtr {
20649         /// A pointer to the contents in the success state.
20650         /// Reading from this pointer when `result_ok` is not set is undefined.
20651         pub result: *mut crate::lightning::ln::script::ShutdownScript,
20652         /// A pointer to the contents in the error state.
20653         /// Reading from this pointer when `result_ok` is set is undefined.
20654         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20655 }
20656 #[repr(C)]
20657 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
20658 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
20659 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20660 pub struct CResult_ShutdownScriptDecodeErrorZ {
20661         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
20662         /// `err` or `result` depending on the state of `result_ok`.
20663         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
20664         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
20665         pub result_ok: bool,
20666 }
20667 #[no_mangle]
20668 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
20669 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
20670         CResult_ShutdownScriptDecodeErrorZ {
20671                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
20672                         result: Box::into_raw(Box::new(o)),
20673                 },
20674                 result_ok: true,
20675         }
20676 }
20677 #[no_mangle]
20678 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
20679 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
20680         CResult_ShutdownScriptDecodeErrorZ {
20681                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
20682                         err: Box::into_raw(Box::new(e)),
20683                 },
20684                 result_ok: false,
20685         }
20686 }
20687 /// Checks if the given object is currently in the success state
20688 #[no_mangle]
20689 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
20690         o.result_ok
20691 }
20692 #[no_mangle]
20693 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
20694 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
20695 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
20696         fn drop(&mut self) {
20697                 if self.result_ok {
20698                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20699                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20700                         }
20701                 } else {
20702                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20703                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20704                         }
20705                 }
20706         }
20707 }
20708 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
20709         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
20710                 let contents = if o.result_ok {
20711                         let result = unsafe { o.contents.result };
20712                         unsafe { o.contents.result = core::ptr::null_mut() };
20713                         CResult_ShutdownScriptDecodeErrorZPtr { result }
20714                 } else {
20715                         let err = unsafe { o.contents.err };
20716                         unsafe { o.contents.err = core::ptr::null_mut(); }
20717                         CResult_ShutdownScriptDecodeErrorZPtr { err }
20718                 };
20719                 Self {
20720                         contents,
20721                         result_ok: o.result_ok,
20722                 }
20723         }
20724 }
20725 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
20726         fn clone(&self) -> Self {
20727                 if self.result_ok {
20728                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
20729                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
20730                         } }
20731                 } else {
20732                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
20733                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20734                         } }
20735                 }
20736         }
20737 }
20738 #[no_mangle]
20739 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
20740 /// but with all dynamically-allocated buffers duplicated in new buffers.
20741 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
20742 #[repr(C)]
20743 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
20744 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20745         /// A pointer to the contents in the success state.
20746         /// Reading from this pointer when `result_ok` is not set is undefined.
20747         pub result: *mut crate::lightning::ln::script::ShutdownScript,
20748         /// A pointer to the contents in the error state.
20749         /// Reading from this pointer when `result_ok` is set is undefined.
20750         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
20751 }
20752 #[repr(C)]
20753 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
20754 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
20755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20756 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
20757         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
20758         /// `err` or `result` depending on the state of `result_ok`.
20759         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
20760         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
20761         pub result_ok: bool,
20762 }
20763 #[no_mangle]
20764 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
20765 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
20766         CResult_ShutdownScriptInvalidShutdownScriptZ {
20767                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20768                         result: Box::into_raw(Box::new(o)),
20769                 },
20770                 result_ok: true,
20771         }
20772 }
20773 #[no_mangle]
20774 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
20775 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
20776         CResult_ShutdownScriptInvalidShutdownScriptZ {
20777                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20778                         err: Box::into_raw(Box::new(e)),
20779                 },
20780                 result_ok: false,
20781         }
20782 }
20783 /// Checks if the given object is currently in the success state
20784 #[no_mangle]
20785 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
20786         o.result_ok
20787 }
20788 #[no_mangle]
20789 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
20790 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
20791 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
20792         fn drop(&mut self) {
20793                 if self.result_ok {
20794                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20795                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20796                         }
20797                 } else {
20798                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20799                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20800                         }
20801                 }
20802         }
20803 }
20804 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
20805         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
20806                 let contents = if o.result_ok {
20807                         let result = unsafe { o.contents.result };
20808                         unsafe { o.contents.result = core::ptr::null_mut() };
20809                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
20810                 } else {
20811                         let err = unsafe { o.contents.err };
20812                         unsafe { o.contents.err = core::ptr::null_mut(); }
20813                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
20814                 };
20815                 Self {
20816                         contents,
20817                         result_ok: o.result_ok,
20818                 }
20819         }
20820 }
20821 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
20822         fn clone(&self) -> Self {
20823                 if self.result_ok {
20824                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20825                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
20826                         } }
20827                 } else {
20828                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20829                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
20830                         } }
20831                 }
20832         }
20833 }
20834 #[no_mangle]
20835 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
20836 /// but with all dynamically-allocated buffers duplicated in new buffers.
20837 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
20838 #[repr(C)]
20839 /// The contents of CResult_PaymentPurposeDecodeErrorZ
20840 pub union CResult_PaymentPurposeDecodeErrorZPtr {
20841         /// A pointer to the contents in the success state.
20842         /// Reading from this pointer when `result_ok` is not set is undefined.
20843         pub result: *mut crate::lightning::events::PaymentPurpose,
20844         /// A pointer to the contents in the error state.
20845         /// Reading from this pointer when `result_ok` is set is undefined.
20846         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20847 }
20848 #[repr(C)]
20849 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
20850 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
20851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20852 pub struct CResult_PaymentPurposeDecodeErrorZ {
20853         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
20854         /// `err` or `result` depending on the state of `result_ok`.
20855         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
20856         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
20857         pub result_ok: bool,
20858 }
20859 #[no_mangle]
20860 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
20861 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
20862         CResult_PaymentPurposeDecodeErrorZ {
20863                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
20864                         result: Box::into_raw(Box::new(o)),
20865                 },
20866                 result_ok: true,
20867         }
20868 }
20869 #[no_mangle]
20870 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
20871 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
20872         CResult_PaymentPurposeDecodeErrorZ {
20873                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
20874                         err: Box::into_raw(Box::new(e)),
20875                 },
20876                 result_ok: false,
20877         }
20878 }
20879 /// Checks if the given object is currently in the success state
20880 #[no_mangle]
20881 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
20882         o.result_ok
20883 }
20884 #[no_mangle]
20885 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
20886 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
20887 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
20888         fn drop(&mut self) {
20889                 if self.result_ok {
20890                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20891                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20892                         }
20893                 } else {
20894                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20895                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20896                         }
20897                 }
20898         }
20899 }
20900 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
20901         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
20902                 let contents = if o.result_ok {
20903                         let result = unsafe { o.contents.result };
20904                         unsafe { o.contents.result = core::ptr::null_mut() };
20905                         CResult_PaymentPurposeDecodeErrorZPtr { result }
20906                 } else {
20907                         let err = unsafe { o.contents.err };
20908                         unsafe { o.contents.err = core::ptr::null_mut(); }
20909                         CResult_PaymentPurposeDecodeErrorZPtr { err }
20910                 };
20911                 Self {
20912                         contents,
20913                         result_ok: o.result_ok,
20914                 }
20915         }
20916 }
20917 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
20918         fn clone(&self) -> Self {
20919                 if self.result_ok {
20920                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
20921                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
20922                         } }
20923                 } else {
20924                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
20925                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20926                         } }
20927                 }
20928         }
20929 }
20930 #[no_mangle]
20931 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
20932 /// but with all dynamically-allocated buffers duplicated in new buffers.
20933 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
20934 #[repr(C)]
20935 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
20936 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
20937         /// A pointer to the contents in the success state.
20938         /// Reading from this pointer when `result_ok` is not set is undefined.
20939         pub result: *mut crate::lightning::events::ClaimedHTLC,
20940         /// A pointer to the contents in the error state.
20941         /// Reading from this pointer when `result_ok` is set is undefined.
20942         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20943 }
20944 #[repr(C)]
20945 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
20946 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
20947 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20948 pub struct CResult_ClaimedHTLCDecodeErrorZ {
20949         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
20950         /// `err` or `result` depending on the state of `result_ok`.
20951         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
20952         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
20953         pub result_ok: bool,
20954 }
20955 #[no_mangle]
20956 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
20957 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
20958         CResult_ClaimedHTLCDecodeErrorZ {
20959                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
20960                         result: Box::into_raw(Box::new(o)),
20961                 },
20962                 result_ok: true,
20963         }
20964 }
20965 #[no_mangle]
20966 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
20967 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
20968         CResult_ClaimedHTLCDecodeErrorZ {
20969                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
20970                         err: Box::into_raw(Box::new(e)),
20971                 },
20972                 result_ok: false,
20973         }
20974 }
20975 /// Checks if the given object is currently in the success state
20976 #[no_mangle]
20977 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
20978         o.result_ok
20979 }
20980 #[no_mangle]
20981 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
20982 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
20983 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
20984         fn drop(&mut self) {
20985                 if self.result_ok {
20986                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20987                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20988                         }
20989                 } else {
20990                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20991                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20992                         }
20993                 }
20994         }
20995 }
20996 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
20997         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
20998                 let contents = if o.result_ok {
20999                         let result = unsafe { o.contents.result };
21000                         unsafe { o.contents.result = core::ptr::null_mut() };
21001                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
21002                 } else {
21003                         let err = unsafe { o.contents.err };
21004                         unsafe { o.contents.err = core::ptr::null_mut(); }
21005                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
21006                 };
21007                 Self {
21008                         contents,
21009                         result_ok: o.result_ok,
21010                 }
21011         }
21012 }
21013 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
21014         fn clone(&self) -> Self {
21015                 if self.result_ok {
21016                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
21017                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
21018                         } }
21019                 } else {
21020                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
21021                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21022                         } }
21023                 }
21024         }
21025 }
21026 #[no_mangle]
21027 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
21028 /// but with all dynamically-allocated buffers duplicated in new buffers.
21029 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
21030 #[repr(C)]
21031 #[derive(Clone)]
21032 /// An enum which can either contain a crate::lightning::events::PathFailure or not
21033 pub enum COption_PathFailureZ {
21034         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
21035         Some(crate::lightning::events::PathFailure),
21036         /// When we're in this state, this COption_PathFailureZ contains nothing
21037         None
21038 }
21039 impl COption_PathFailureZ {
21040         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21041                 if let Self::None = self { false } else { true }
21042         }
21043         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21044                 !self.is_some()
21045         }
21046         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
21047                 if let Self::Some(v) = self { v } else { unreachable!() }
21048         }
21049 }
21050 #[no_mangle]
21051 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
21052 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
21053         COption_PathFailureZ::Some(o)
21054 }
21055 #[no_mangle]
21056 /// Constructs a new COption_PathFailureZ containing nothing
21057 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
21058         COption_PathFailureZ::None
21059 }
21060 #[no_mangle]
21061 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
21062 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
21063 #[no_mangle]
21064 /// Creates a new COption_PathFailureZ which has the same data as `orig`
21065 /// but with all dynamically-allocated buffers duplicated in new buffers.
21066 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
21067 #[repr(C)]
21068 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
21069 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
21070         /// A pointer to the contents in the success state.
21071         /// Reading from this pointer when `result_ok` is not set is undefined.
21072         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
21073         /// A pointer to the contents in the error state.
21074         /// Reading from this pointer when `result_ok` is set is undefined.
21075         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21076 }
21077 #[repr(C)]
21078 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
21079 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21081 pub struct CResult_COption_PathFailureZDecodeErrorZ {
21082         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
21083         /// `err` or `result` depending on the state of `result_ok`.
21084         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
21085         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
21086         pub result_ok: bool,
21087 }
21088 #[no_mangle]
21089 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
21090 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
21091         CResult_COption_PathFailureZDecodeErrorZ {
21092                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21093                         result: Box::into_raw(Box::new(o)),
21094                 },
21095                 result_ok: true,
21096         }
21097 }
21098 #[no_mangle]
21099 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
21100 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
21101         CResult_COption_PathFailureZDecodeErrorZ {
21102                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21103                         err: Box::into_raw(Box::new(e)),
21104                 },
21105                 result_ok: false,
21106         }
21107 }
21108 /// Checks if the given object is currently in the success state
21109 #[no_mangle]
21110 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
21111         o.result_ok
21112 }
21113 #[no_mangle]
21114 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
21115 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
21116 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
21117         fn drop(&mut self) {
21118                 if self.result_ok {
21119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21121                         }
21122                 } else {
21123                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21124                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21125                         }
21126                 }
21127         }
21128 }
21129 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
21130         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21131                 let contents = if o.result_ok {
21132                         let result = unsafe { o.contents.result };
21133                         unsafe { o.contents.result = core::ptr::null_mut() };
21134                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
21135                 } else {
21136                         let err = unsafe { o.contents.err };
21137                         unsafe { o.contents.err = core::ptr::null_mut(); }
21138                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
21139                 };
21140                 Self {
21141                         contents,
21142                         result_ok: o.result_ok,
21143                 }
21144         }
21145 }
21146 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
21147         fn clone(&self) -> Self {
21148                 if self.result_ok {
21149                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21150                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
21151                         } }
21152                 } else {
21153                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21154                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21155                         } }
21156                 }
21157         }
21158 }
21159 #[no_mangle]
21160 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
21161 /// but with all dynamically-allocated buffers duplicated in new buffers.
21162 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
21163 #[repr(C)]
21164 #[derive(Clone)]
21165 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
21166 pub enum COption_ClosureReasonZ {
21167         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
21168         Some(crate::lightning::events::ClosureReason),
21169         /// When we're in this state, this COption_ClosureReasonZ contains nothing
21170         None
21171 }
21172 impl COption_ClosureReasonZ {
21173         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21174                 if let Self::None = self { false } else { true }
21175         }
21176         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21177                 !self.is_some()
21178         }
21179         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
21180                 if let Self::Some(v) = self { v } else { unreachable!() }
21181         }
21182 }
21183 #[no_mangle]
21184 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
21185 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
21186         COption_ClosureReasonZ::Some(o)
21187 }
21188 #[no_mangle]
21189 /// Constructs a new COption_ClosureReasonZ containing nothing
21190 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
21191         COption_ClosureReasonZ::None
21192 }
21193 #[no_mangle]
21194 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
21195 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
21196 #[no_mangle]
21197 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
21198 /// but with all dynamically-allocated buffers duplicated in new buffers.
21199 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
21200 #[repr(C)]
21201 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
21202 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
21203         /// A pointer to the contents in the success state.
21204         /// Reading from this pointer when `result_ok` is not set is undefined.
21205         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
21206         /// A pointer to the contents in the error state.
21207         /// Reading from this pointer when `result_ok` is set is undefined.
21208         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21209 }
21210 #[repr(C)]
21211 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
21212 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21214 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
21215         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
21216         /// `err` or `result` depending on the state of `result_ok`.
21217         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
21218         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
21219         pub result_ok: bool,
21220 }
21221 #[no_mangle]
21222 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
21223 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
21224         CResult_COption_ClosureReasonZDecodeErrorZ {
21225                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21226                         result: Box::into_raw(Box::new(o)),
21227                 },
21228                 result_ok: true,
21229         }
21230 }
21231 #[no_mangle]
21232 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
21233 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
21234         CResult_COption_ClosureReasonZDecodeErrorZ {
21235                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21236                         err: Box::into_raw(Box::new(e)),
21237                 },
21238                 result_ok: false,
21239         }
21240 }
21241 /// Checks if the given object is currently in the success state
21242 #[no_mangle]
21243 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
21244         o.result_ok
21245 }
21246 #[no_mangle]
21247 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
21248 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
21249 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
21250         fn drop(&mut self) {
21251                 if self.result_ok {
21252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21254                         }
21255                 } else {
21256                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21257                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21258                         }
21259                 }
21260         }
21261 }
21262 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
21263         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21264                 let contents = if o.result_ok {
21265                         let result = unsafe { o.contents.result };
21266                         unsafe { o.contents.result = core::ptr::null_mut() };
21267                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
21268                 } else {
21269                         let err = unsafe { o.contents.err };
21270                         unsafe { o.contents.err = core::ptr::null_mut(); }
21271                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
21272                 };
21273                 Self {
21274                         contents,
21275                         result_ok: o.result_ok,
21276                 }
21277         }
21278 }
21279 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
21280         fn clone(&self) -> Self {
21281                 if self.result_ok {
21282                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21283                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
21284                         } }
21285                 } else {
21286                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21287                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21288                         } }
21289                 }
21290         }
21291 }
21292 #[no_mangle]
21293 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
21294 /// but with all dynamically-allocated buffers duplicated in new buffers.
21295 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
21296 #[repr(C)]
21297 #[derive(Clone)]
21298 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
21299 pub enum COption_HTLCDestinationZ {
21300         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
21301         Some(crate::lightning::events::HTLCDestination),
21302         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
21303         None
21304 }
21305 impl COption_HTLCDestinationZ {
21306         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21307                 if let Self::None = self { false } else { true }
21308         }
21309         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21310                 !self.is_some()
21311         }
21312         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
21313                 if let Self::Some(v) = self { v } else { unreachable!() }
21314         }
21315 }
21316 #[no_mangle]
21317 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
21318 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
21319         COption_HTLCDestinationZ::Some(o)
21320 }
21321 #[no_mangle]
21322 /// Constructs a new COption_HTLCDestinationZ containing nothing
21323 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
21324         COption_HTLCDestinationZ::None
21325 }
21326 #[no_mangle]
21327 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
21328 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
21329 #[no_mangle]
21330 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
21331 /// but with all dynamically-allocated buffers duplicated in new buffers.
21332 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
21333 #[repr(C)]
21334 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
21335 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21336         /// A pointer to the contents in the success state.
21337         /// Reading from this pointer when `result_ok` is not set is undefined.
21338         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
21339         /// A pointer to the contents in the error state.
21340         /// Reading from this pointer when `result_ok` is set is undefined.
21341         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21342 }
21343 #[repr(C)]
21344 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
21345 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21347 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
21348         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
21349         /// `err` or `result` depending on the state of `result_ok`.
21350         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
21351         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
21352         pub result_ok: bool,
21353 }
21354 #[no_mangle]
21355 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
21356 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
21357         CResult_COption_HTLCDestinationZDecodeErrorZ {
21358                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21359                         result: Box::into_raw(Box::new(o)),
21360                 },
21361                 result_ok: true,
21362         }
21363 }
21364 #[no_mangle]
21365 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
21366 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
21367         CResult_COption_HTLCDestinationZDecodeErrorZ {
21368                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21369                         err: Box::into_raw(Box::new(e)),
21370                 },
21371                 result_ok: false,
21372         }
21373 }
21374 /// Checks if the given object is currently in the success state
21375 #[no_mangle]
21376 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
21377         o.result_ok
21378 }
21379 #[no_mangle]
21380 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
21381 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
21382 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
21383         fn drop(&mut self) {
21384                 if self.result_ok {
21385                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21386                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21387                         }
21388                 } else {
21389                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21390                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21391                         }
21392                 }
21393         }
21394 }
21395 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
21396         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21397                 let contents = if o.result_ok {
21398                         let result = unsafe { o.contents.result };
21399                         unsafe { o.contents.result = core::ptr::null_mut() };
21400                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
21401                 } else {
21402                         let err = unsafe { o.contents.err };
21403                         unsafe { o.contents.err = core::ptr::null_mut(); }
21404                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
21405                 };
21406                 Self {
21407                         contents,
21408                         result_ok: o.result_ok,
21409                 }
21410         }
21411 }
21412 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
21413         fn clone(&self) -> Self {
21414                 if self.result_ok {
21415                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21416                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
21417                         } }
21418                 } else {
21419                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21420                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21421                         } }
21422                 }
21423         }
21424 }
21425 #[no_mangle]
21426 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
21427 /// but with all dynamically-allocated buffers duplicated in new buffers.
21428 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
21429 #[repr(C)]
21430 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
21431 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
21432         /// A pointer to the contents in the success state.
21433         /// Reading from this pointer when `result_ok` is not set is undefined.
21434         pub result: *mut crate::lightning::events::PaymentFailureReason,
21435         /// A pointer to the contents in the error state.
21436         /// Reading from this pointer when `result_ok` is set is undefined.
21437         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21438 }
21439 #[repr(C)]
21440 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
21441 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
21442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21443 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
21444         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
21445         /// `err` or `result` depending on the state of `result_ok`.
21446         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
21447         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
21448         pub result_ok: bool,
21449 }
21450 #[no_mangle]
21451 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
21452 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
21453         CResult_PaymentFailureReasonDecodeErrorZ {
21454                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21455                         result: Box::into_raw(Box::new(o)),
21456                 },
21457                 result_ok: true,
21458         }
21459 }
21460 #[no_mangle]
21461 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
21462 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
21463         CResult_PaymentFailureReasonDecodeErrorZ {
21464                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21465                         err: Box::into_raw(Box::new(e)),
21466                 },
21467                 result_ok: false,
21468         }
21469 }
21470 /// Checks if the given object is currently in the success state
21471 #[no_mangle]
21472 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
21473         o.result_ok
21474 }
21475 #[no_mangle]
21476 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
21477 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
21478 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
21479         fn drop(&mut self) {
21480                 if self.result_ok {
21481                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21482                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21483                         }
21484                 } else {
21485                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21486                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21487                         }
21488                 }
21489         }
21490 }
21491 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
21492         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
21493                 let contents = if o.result_ok {
21494                         let result = unsafe { o.contents.result };
21495                         unsafe { o.contents.result = core::ptr::null_mut() };
21496                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
21497                 } else {
21498                         let err = unsafe { o.contents.err };
21499                         unsafe { o.contents.err = core::ptr::null_mut(); }
21500                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
21501                 };
21502                 Self {
21503                         contents,
21504                         result_ok: o.result_ok,
21505                 }
21506         }
21507 }
21508 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
21509         fn clone(&self) -> Self {
21510                 if self.result_ok {
21511                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21512                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
21513                         } }
21514                 } else {
21515                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21516                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21517                         } }
21518                 }
21519         }
21520 }
21521 #[no_mangle]
21522 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
21523 /// but with all dynamically-allocated buffers duplicated in new buffers.
21524 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
21525 #[repr(C)]
21526 #[derive(Clone)]
21527 /// An enum which can either contain a crate::c_types::U128 or not
21528 pub enum COption_U128Z {
21529         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
21530         Some(crate::c_types::U128),
21531         /// When we're in this state, this COption_U128Z contains nothing
21532         None
21533 }
21534 impl COption_U128Z {
21535         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21536                 if let Self::None = self { false } else { true }
21537         }
21538         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21539                 !self.is_some()
21540         }
21541         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
21542                 if let Self::Some(v) = self { v } else { unreachable!() }
21543         }
21544 }
21545 #[no_mangle]
21546 /// Constructs a new COption_U128Z containing a crate::c_types::U128
21547 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
21548         COption_U128Z::Some(o)
21549 }
21550 #[no_mangle]
21551 /// Constructs a new COption_U128Z containing nothing
21552 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
21553         COption_U128Z::None
21554 }
21555 #[no_mangle]
21556 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
21557 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
21558 #[no_mangle]
21559 /// Creates a new COption_U128Z which has the same data as `orig`
21560 /// but with all dynamically-allocated buffers duplicated in new buffers.
21561 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
21562 #[repr(C)]
21563 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
21564 /// This corresponds to std::vector in C++
21565 pub struct CVec_ClaimedHTLCZ {
21566         /// The elements in the array.
21567         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21568         pub data: *mut crate::lightning::events::ClaimedHTLC,
21569         /// The number of elements pointed to by `data`.
21570         pub datalen: usize
21571 }
21572 impl CVec_ClaimedHTLCZ {
21573         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
21574                 if self.datalen == 0 { return Vec::new(); }
21575                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21576                 self.data = core::ptr::null_mut();
21577                 self.datalen = 0;
21578                 ret
21579         }
21580         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
21581                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21582         }
21583 }
21584 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
21585         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
21586                 let datalen = v.len();
21587                 let data = Box::into_raw(v.into_boxed_slice());
21588                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21589         }
21590 }
21591 #[no_mangle]
21592 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21593 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
21594 impl Drop for CVec_ClaimedHTLCZ {
21595         fn drop(&mut self) {
21596                 if self.datalen == 0 { return; }
21597                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21598         }
21599 }
21600 impl Clone for CVec_ClaimedHTLCZ {
21601         fn clone(&self) -> Self {
21602                 let mut res = Vec::new();
21603                 if self.datalen == 0 { return Self::from(res); }
21604                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21605                 Self::from(res)
21606         }
21607 }
21608 #[repr(C)]
21609 #[derive(Clone)]
21610 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
21611 pub enum COption_PaymentFailureReasonZ {
21612         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
21613         Some(crate::lightning::events::PaymentFailureReason),
21614         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
21615         None
21616 }
21617 impl COption_PaymentFailureReasonZ {
21618         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21619                 if let Self::None = self { false } else { true }
21620         }
21621         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21622                 !self.is_some()
21623         }
21624         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
21625                 if let Self::Some(v) = self { v } else { unreachable!() }
21626         }
21627 }
21628 #[no_mangle]
21629 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
21630 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
21631         COption_PaymentFailureReasonZ::Some(o)
21632 }
21633 #[no_mangle]
21634 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
21635 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
21636         COption_PaymentFailureReasonZ::None
21637 }
21638 #[no_mangle]
21639 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
21640 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
21641 #[no_mangle]
21642 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
21643 /// but with all dynamically-allocated buffers duplicated in new buffers.
21644 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
21645 #[repr(C)]
21646 #[derive(Clone)]
21647 /// An enum which can either contain a crate::lightning::events::Event or not
21648 pub enum COption_EventZ {
21649         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
21650         Some(crate::lightning::events::Event),
21651         /// When we're in this state, this COption_EventZ contains nothing
21652         None
21653 }
21654 impl COption_EventZ {
21655         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21656                 if let Self::None = self { false } else { true }
21657         }
21658         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21659                 !self.is_some()
21660         }
21661         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
21662                 if let Self::Some(v) = self { v } else { unreachable!() }
21663         }
21664 }
21665 #[no_mangle]
21666 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
21667 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
21668         COption_EventZ::Some(o)
21669 }
21670 #[no_mangle]
21671 /// Constructs a new COption_EventZ containing nothing
21672 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
21673         COption_EventZ::None
21674 }
21675 #[no_mangle]
21676 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
21677 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
21678 #[no_mangle]
21679 /// Creates a new COption_EventZ which has the same data as `orig`
21680 /// but with all dynamically-allocated buffers duplicated in new buffers.
21681 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
21682 #[repr(C)]
21683 /// The contents of CResult_COption_EventZDecodeErrorZ
21684 pub union CResult_COption_EventZDecodeErrorZPtr {
21685         /// A pointer to the contents in the success state.
21686         /// Reading from this pointer when `result_ok` is not set is undefined.
21687         pub result: *mut crate::c_types::derived::COption_EventZ,
21688         /// A pointer to the contents in the error state.
21689         /// Reading from this pointer when `result_ok` is set is undefined.
21690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21691 }
21692 #[repr(C)]
21693 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
21694 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21696 pub struct CResult_COption_EventZDecodeErrorZ {
21697         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
21698         /// `err` or `result` depending on the state of `result_ok`.
21699         pub contents: CResult_COption_EventZDecodeErrorZPtr,
21700         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
21701         pub result_ok: bool,
21702 }
21703 #[no_mangle]
21704 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
21705 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
21706         CResult_COption_EventZDecodeErrorZ {
21707                 contents: CResult_COption_EventZDecodeErrorZPtr {
21708                         result: Box::into_raw(Box::new(o)),
21709                 },
21710                 result_ok: true,
21711         }
21712 }
21713 #[no_mangle]
21714 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
21715 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
21716         CResult_COption_EventZDecodeErrorZ {
21717                 contents: CResult_COption_EventZDecodeErrorZPtr {
21718                         err: Box::into_raw(Box::new(e)),
21719                 },
21720                 result_ok: false,
21721         }
21722 }
21723 /// Checks if the given object is currently in the success state
21724 #[no_mangle]
21725 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
21726         o.result_ok
21727 }
21728 #[no_mangle]
21729 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
21730 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
21731 impl Drop for CResult_COption_EventZDecodeErrorZ {
21732         fn drop(&mut self) {
21733                 if self.result_ok {
21734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21736                         }
21737                 } else {
21738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21740                         }
21741                 }
21742         }
21743 }
21744 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
21745         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21746                 let contents = if o.result_ok {
21747                         let result = unsafe { o.contents.result };
21748                         unsafe { o.contents.result = core::ptr::null_mut() };
21749                         CResult_COption_EventZDecodeErrorZPtr { result }
21750                 } else {
21751                         let err = unsafe { o.contents.err };
21752                         unsafe { o.contents.err = core::ptr::null_mut(); }
21753                         CResult_COption_EventZDecodeErrorZPtr { err }
21754                 };
21755                 Self {
21756                         contents,
21757                         result_ok: o.result_ok,
21758                 }
21759         }
21760 }
21761 impl Clone for CResult_COption_EventZDecodeErrorZ {
21762         fn clone(&self) -> Self {
21763                 if self.result_ok {
21764                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
21765                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
21766                         } }
21767                 } else {
21768                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
21769                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21770                         } }
21771                 }
21772         }
21773 }
21774 #[no_mangle]
21775 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
21776 /// but with all dynamically-allocated buffers duplicated in new buffers.
21777 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
21778 #[repr(C)]
21779 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
21780 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
21781         /// A pointer to the contents in the success state.
21782         /// Reading from this pointer when `result_ok` is not set is undefined.
21783         pub result: *mut crate::lightning_invoice::SiPrefix,
21784         /// A pointer to the contents in the error state.
21785         /// Reading from this pointer when `result_ok` is set is undefined.
21786         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
21787 }
21788 #[repr(C)]
21789 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
21790 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
21791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21792 pub struct CResult_SiPrefixBolt11ParseErrorZ {
21793         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
21794         /// `err` or `result` depending on the state of `result_ok`.
21795         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
21796         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
21797         pub result_ok: bool,
21798 }
21799 #[no_mangle]
21800 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
21801 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
21802         CResult_SiPrefixBolt11ParseErrorZ {
21803                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21804                         result: Box::into_raw(Box::new(o)),
21805                 },
21806                 result_ok: true,
21807         }
21808 }
21809 #[no_mangle]
21810 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
21811 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
21812         CResult_SiPrefixBolt11ParseErrorZ {
21813                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21814                         err: Box::into_raw(Box::new(e)),
21815                 },
21816                 result_ok: false,
21817         }
21818 }
21819 /// Checks if the given object is currently in the success state
21820 #[no_mangle]
21821 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
21822         o.result_ok
21823 }
21824 #[no_mangle]
21825 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
21826 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
21827 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
21828         fn drop(&mut self) {
21829                 if self.result_ok {
21830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21832                         }
21833                 } else {
21834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21836                         }
21837                 }
21838         }
21839 }
21840 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
21841         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
21842                 let contents = if o.result_ok {
21843                         let result = unsafe { o.contents.result };
21844                         unsafe { o.contents.result = core::ptr::null_mut() };
21845                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
21846                 } else {
21847                         let err = unsafe { o.contents.err };
21848                         unsafe { o.contents.err = core::ptr::null_mut(); }
21849                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
21850                 };
21851                 Self {
21852                         contents,
21853                         result_ok: o.result_ok,
21854                 }
21855         }
21856 }
21857 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
21858         fn clone(&self) -> Self {
21859                 if self.result_ok {
21860                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21861                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
21862                         } }
21863                 } else {
21864                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21865                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
21866                         } }
21867                 }
21868         }
21869 }
21870 #[no_mangle]
21871 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
21872 /// but with all dynamically-allocated buffers duplicated in new buffers.
21873 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
21874 #[repr(C)]
21875 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
21876 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21877         /// A pointer to the contents in the success state.
21878         /// Reading from this pointer when `result_ok` is not set is undefined.
21879         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
21880         /// A pointer to the contents in the error state.
21881         /// Reading from this pointer when `result_ok` is set is undefined.
21882         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
21883 }
21884 #[repr(C)]
21885 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
21886 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
21887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21888 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21889         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
21890         /// `err` or `result` depending on the state of `result_ok`.
21891         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
21892         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
21893         pub result_ok: bool,
21894 }
21895 #[no_mangle]
21896 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
21897 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21898         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21899                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21900                         result: Box::into_raw(Box::new(o)),
21901                 },
21902                 result_ok: true,
21903         }
21904 }
21905 #[no_mangle]
21906 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
21907 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21908         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21909                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21910                         err: Box::into_raw(Box::new(e)),
21911                 },
21912                 result_ok: false,
21913         }
21914 }
21915 /// Checks if the given object is currently in the success state
21916 #[no_mangle]
21917 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
21918         o.result_ok
21919 }
21920 #[no_mangle]
21921 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
21922 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
21923 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21924         fn drop(&mut self) {
21925                 if self.result_ok {
21926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21928                         }
21929                 } else {
21930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21932                         }
21933                 }
21934         }
21935 }
21936 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
21938                 let contents = if o.result_ok {
21939                         let result = unsafe { o.contents.result };
21940                         unsafe { o.contents.result = core::ptr::null_mut() };
21941                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
21942                 } else {
21943                         let err = unsafe { o.contents.err };
21944                         unsafe { o.contents.err = core::ptr::null_mut(); }
21945                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
21946                 };
21947                 Self {
21948                         contents,
21949                         result_ok: o.result_ok,
21950                 }
21951         }
21952 }
21953 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21954         fn clone(&self) -> Self {
21955                 if self.result_ok {
21956                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21957                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
21958                         } }
21959                 } else {
21960                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21961                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
21962                         } }
21963                 }
21964         }
21965 }
21966 #[no_mangle]
21967 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
21968 /// but with all dynamically-allocated buffers duplicated in new buffers.
21969 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
21970 #[repr(C)]
21971 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
21972 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
21973         /// A pointer to the contents in the success state.
21974         /// Reading from this pointer when `result_ok` is not set is undefined.
21975         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
21976         /// A pointer to the contents in the error state.
21977         /// Reading from this pointer when `result_ok` is set is undefined.
21978         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
21979 }
21980 #[repr(C)]
21981 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
21982 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
21983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21984 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21985         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
21986         /// `err` or `result` depending on the state of `result_ok`.
21987         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
21988         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
21989         pub result_ok: bool,
21990 }
21991 #[no_mangle]
21992 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
21993 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21994         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21995                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
21996                         result: Box::into_raw(Box::new(o)),
21997                 },
21998                 result_ok: true,
21999         }
22000 }
22001 #[no_mangle]
22002 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
22003 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22004         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22005                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22006                         err: Box::into_raw(Box::new(e)),
22007                 },
22008                 result_ok: false,
22009         }
22010 }
22011 /// Checks if the given object is currently in the success state
22012 #[no_mangle]
22013 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
22014         o.result_ok
22015 }
22016 #[no_mangle]
22017 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
22018 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
22019 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22020         fn drop(&mut self) {
22021                 if self.result_ok {
22022                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22023                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22024                         }
22025                 } else {
22026                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22027                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22028                         }
22029                 }
22030         }
22031 }
22032 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22033         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
22034                 let contents = if o.result_ok {
22035                         let result = unsafe { o.contents.result };
22036                         unsafe { o.contents.result = core::ptr::null_mut() };
22037                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
22038                 } else {
22039                         let err = unsafe { o.contents.err };
22040                         unsafe { o.contents.err = core::ptr::null_mut(); }
22041                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
22042                 };
22043                 Self {
22044                         contents,
22045                         result_ok: o.result_ok,
22046                 }
22047         }
22048 }
22049 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22050         fn clone(&self) -> Self {
22051                 if self.result_ok {
22052                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22053                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
22054                         } }
22055                 } else {
22056                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22057                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
22058                         } }
22059                 }
22060         }
22061 }
22062 #[no_mangle]
22063 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
22064 /// but with all dynamically-allocated buffers duplicated in new buffers.
22065 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
22066 #[repr(C)]
22067 /// A tuple of 3 elements. See the individual fields for the types contained.
22068 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22069         /// The element at position 0
22070         pub a: crate::lightning_invoice::RawBolt11Invoice,
22071         /// The element at position 1
22072         pub b: crate::c_types::ThirtyTwoBytes,
22073         /// The element at position 2
22074         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
22075 }
22076 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22077         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
22078                 Self {
22079                         a: tup.0,
22080                         b: tup.1,
22081                         c: tup.2,
22082                 }
22083         }
22084 }
22085 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22086         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
22087                 (self.a, self.b, self.c)
22088         }
22089 }
22090 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22091         fn clone(&self) -> Self {
22092                 Self {
22093                         a: Clone::clone(&self.a),
22094                         b: Clone::clone(&self.b),
22095                         c: Clone::clone(&self.c),
22096                 }
22097         }
22098 }
22099 #[no_mangle]
22100 /// Creates a new tuple which has the same data as `orig`
22101 /// but with all dynamically-allocated buffers duplicated in new buffers.
22102 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
22103 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
22104 #[no_mangle]
22105 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 {
22106         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
22107 }
22108
22109 #[no_mangle]
22110 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
22111 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
22112 #[repr(C)]
22113 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
22114 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
22115         /// A pointer to the contents in the success state.
22116         /// Reading from this pointer when `result_ok` is not set is undefined.
22117         pub result: *mut crate::lightning_invoice::PayeePubKey,
22118         /// A pointer to the contents in the error state.
22119         /// Reading from this pointer when `result_ok` is set is undefined.
22120         pub err: *mut crate::c_types::Secp256k1Error,
22121 }
22122 #[repr(C)]
22123 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
22124 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
22125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22126 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
22127         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
22128         /// `err` or `result` depending on the state of `result_ok`.
22129         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
22130         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
22131         pub result_ok: bool,
22132 }
22133 #[no_mangle]
22134 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
22135 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
22136         CResult_PayeePubKeySecp256k1ErrorZ {
22137                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22138                         result: Box::into_raw(Box::new(o)),
22139                 },
22140                 result_ok: true,
22141         }
22142 }
22143 #[no_mangle]
22144 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
22145 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
22146         CResult_PayeePubKeySecp256k1ErrorZ {
22147                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22148                         err: Box::into_raw(Box::new(e)),
22149                 },
22150                 result_ok: false,
22151         }
22152 }
22153 /// Checks if the given object is currently in the success state
22154 #[no_mangle]
22155 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
22156         o.result_ok
22157 }
22158 #[no_mangle]
22159 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
22160 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
22161 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
22162         fn drop(&mut self) {
22163                 if self.result_ok {
22164                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22165                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22166                         }
22167                 } else {
22168                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22169                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22170                         }
22171                 }
22172         }
22173 }
22174 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
22175         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
22176                 let contents = if o.result_ok {
22177                         let result = unsafe { o.contents.result };
22178                         unsafe { o.contents.result = core::ptr::null_mut() };
22179                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
22180                 } else {
22181                         let err = unsafe { o.contents.err };
22182                         unsafe { o.contents.err = core::ptr::null_mut(); }
22183                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
22184                 };
22185                 Self {
22186                         contents,
22187                         result_ok: o.result_ok,
22188                 }
22189         }
22190 }
22191 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
22192         fn clone(&self) -> Self {
22193                 if self.result_ok {
22194                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22195                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
22196                         } }
22197                 } else {
22198                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22199                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22200                         } }
22201                 }
22202         }
22203 }
22204 #[no_mangle]
22205 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
22206 /// but with all dynamically-allocated buffers duplicated in new buffers.
22207 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
22208 #[repr(C)]
22209 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
22210 /// This corresponds to std::vector in C++
22211 pub struct CVec_PrivateRouteZ {
22212         /// The elements in the array.
22213         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22214         pub data: *mut crate::lightning_invoice::PrivateRoute,
22215         /// The number of elements pointed to by `data`.
22216         pub datalen: usize
22217 }
22218 impl CVec_PrivateRouteZ {
22219         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
22220                 if self.datalen == 0 { return Vec::new(); }
22221                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22222                 self.data = core::ptr::null_mut();
22223                 self.datalen = 0;
22224                 ret
22225         }
22226         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
22227                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22228         }
22229 }
22230 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
22231         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
22232                 let datalen = v.len();
22233                 let data = Box::into_raw(v.into_boxed_slice());
22234                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22235         }
22236 }
22237 #[no_mangle]
22238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22239 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
22240 impl Drop for CVec_PrivateRouteZ {
22241         fn drop(&mut self) {
22242                 if self.datalen == 0 { return; }
22243                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22244         }
22245 }
22246 impl Clone for CVec_PrivateRouteZ {
22247         fn clone(&self) -> Self {
22248                 let mut res = Vec::new();
22249                 if self.datalen == 0 { return Self::from(res); }
22250                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22251                 Self::from(res)
22252         }
22253 }
22254 #[repr(C)]
22255 /// The contents of CResult_PositiveTimestampCreationErrorZ
22256 pub union CResult_PositiveTimestampCreationErrorZPtr {
22257         /// A pointer to the contents in the success state.
22258         /// Reading from this pointer when `result_ok` is not set is undefined.
22259         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
22260         /// A pointer to the contents in the error state.
22261         /// Reading from this pointer when `result_ok` is set is undefined.
22262         pub err: *mut crate::lightning_invoice::CreationError,
22263 }
22264 #[repr(C)]
22265 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
22266 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
22267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22268 pub struct CResult_PositiveTimestampCreationErrorZ {
22269         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
22270         /// `err` or `result` depending on the state of `result_ok`.
22271         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
22272         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
22273         pub result_ok: bool,
22274 }
22275 #[no_mangle]
22276 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
22277 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
22278         CResult_PositiveTimestampCreationErrorZ {
22279                 contents: CResult_PositiveTimestampCreationErrorZPtr {
22280                         result: Box::into_raw(Box::new(o)),
22281                 },
22282                 result_ok: true,
22283         }
22284 }
22285 #[no_mangle]
22286 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
22287 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
22288         CResult_PositiveTimestampCreationErrorZ {
22289                 contents: CResult_PositiveTimestampCreationErrorZPtr {
22290                         err: Box::into_raw(Box::new(e)),
22291                 },
22292                 result_ok: false,
22293         }
22294 }
22295 /// Checks if the given object is currently in the success state
22296 #[no_mangle]
22297 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
22298         o.result_ok
22299 }
22300 #[no_mangle]
22301 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
22302 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
22303 impl Drop for CResult_PositiveTimestampCreationErrorZ {
22304         fn drop(&mut self) {
22305                 if self.result_ok {
22306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22308                         }
22309                 } else {
22310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22312                         }
22313                 }
22314         }
22315 }
22316 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
22317         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
22318                 let contents = if o.result_ok {
22319                         let result = unsafe { o.contents.result };
22320                         unsafe { o.contents.result = core::ptr::null_mut() };
22321                         CResult_PositiveTimestampCreationErrorZPtr { result }
22322                 } else {
22323                         let err = unsafe { o.contents.err };
22324                         unsafe { o.contents.err = core::ptr::null_mut(); }
22325                         CResult_PositiveTimestampCreationErrorZPtr { err }
22326                 };
22327                 Self {
22328                         contents,
22329                         result_ok: o.result_ok,
22330                 }
22331         }
22332 }
22333 impl Clone for CResult_PositiveTimestampCreationErrorZ {
22334         fn clone(&self) -> Self {
22335                 if self.result_ok {
22336                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
22337                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
22338                         } }
22339                 } else {
22340                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
22341                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22342                         } }
22343                 }
22344         }
22345 }
22346 #[no_mangle]
22347 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
22348 /// but with all dynamically-allocated buffers duplicated in new buffers.
22349 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
22350 #[repr(C)]
22351 /// The contents of CResult_NoneBolt11SemanticErrorZ
22352 pub union CResult_NoneBolt11SemanticErrorZPtr {
22353         /// Note that this value is always NULL, as there are no contents in the OK variant
22354         pub result: *mut core::ffi::c_void,
22355         /// A pointer to the contents in the error state.
22356         /// Reading from this pointer when `result_ok` is set is undefined.
22357         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
22358 }
22359 #[repr(C)]
22360 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
22361 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
22362 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22363 pub struct CResult_NoneBolt11SemanticErrorZ {
22364         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
22365         /// `err` or `result` depending on the state of `result_ok`.
22366         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
22367         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
22368         pub result_ok: bool,
22369 }
22370 #[no_mangle]
22371 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
22372 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
22373         CResult_NoneBolt11SemanticErrorZ {
22374                 contents: CResult_NoneBolt11SemanticErrorZPtr {
22375                         result: core::ptr::null_mut(),
22376                 },
22377                 result_ok: true,
22378         }
22379 }
22380 #[no_mangle]
22381 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
22382 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
22383         CResult_NoneBolt11SemanticErrorZ {
22384                 contents: CResult_NoneBolt11SemanticErrorZPtr {
22385                         err: Box::into_raw(Box::new(e)),
22386                 },
22387                 result_ok: false,
22388         }
22389 }
22390 /// Checks if the given object is currently in the success state
22391 #[no_mangle]
22392 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
22393         o.result_ok
22394 }
22395 #[no_mangle]
22396 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
22397 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
22398 impl Drop for CResult_NoneBolt11SemanticErrorZ {
22399         fn drop(&mut self) {
22400                 if self.result_ok {
22401                 } else {
22402                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22403                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22404                         }
22405                 }
22406         }
22407 }
22408 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
22409         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
22410                 let contents = if o.result_ok {
22411                         let _ = unsafe { Box::from_raw(o.contents.result) };
22412                         o.contents.result = core::ptr::null_mut();
22413                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
22414                 } else {
22415                         let err = unsafe { o.contents.err };
22416                         unsafe { o.contents.err = core::ptr::null_mut(); }
22417                         CResult_NoneBolt11SemanticErrorZPtr { err }
22418                 };
22419                 Self {
22420                         contents,
22421                         result_ok: o.result_ok,
22422                 }
22423         }
22424 }
22425 impl Clone for CResult_NoneBolt11SemanticErrorZ {
22426         fn clone(&self) -> Self {
22427                 if self.result_ok {
22428                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
22429                                 result: core::ptr::null_mut()
22430                         } }
22431                 } else {
22432                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
22433                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
22434                         } }
22435                 }
22436         }
22437 }
22438 #[no_mangle]
22439 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
22440 /// but with all dynamically-allocated buffers duplicated in new buffers.
22441 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
22442 #[repr(C)]
22443 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
22444 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22445         /// A pointer to the contents in the success state.
22446         /// Reading from this pointer when `result_ok` is not set is undefined.
22447         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
22448         /// A pointer to the contents in the error state.
22449         /// Reading from this pointer when `result_ok` is set is undefined.
22450         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
22451 }
22452 #[repr(C)]
22453 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
22454 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
22455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22456 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22457         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
22458         /// `err` or `result` depending on the state of `result_ok`.
22459         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
22460         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
22461         pub result_ok: bool,
22462 }
22463 #[no_mangle]
22464 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
22465 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22466         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22467                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22468                         result: Box::into_raw(Box::new(o)),
22469                 },
22470                 result_ok: true,
22471         }
22472 }
22473 #[no_mangle]
22474 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
22475 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22476         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22477                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22478                         err: Box::into_raw(Box::new(e)),
22479                 },
22480                 result_ok: false,
22481         }
22482 }
22483 /// Checks if the given object is currently in the success state
22484 #[no_mangle]
22485 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
22486         o.result_ok
22487 }
22488 #[no_mangle]
22489 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
22490 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
22491 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22492         fn drop(&mut self) {
22493                 if self.result_ok {
22494                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22495                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22496                         }
22497                 } else {
22498                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22499                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22500                         }
22501                 }
22502         }
22503 }
22504 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22505         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
22506                 let contents = if o.result_ok {
22507                         let result = unsafe { o.contents.result };
22508                         unsafe { o.contents.result = core::ptr::null_mut() };
22509                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
22510                 } else {
22511                         let err = unsafe { o.contents.err };
22512                         unsafe { o.contents.err = core::ptr::null_mut(); }
22513                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
22514                 };
22515                 Self {
22516                         contents,
22517                         result_ok: o.result_ok,
22518                 }
22519         }
22520 }
22521 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22522         fn clone(&self) -> Self {
22523                 if self.result_ok {
22524                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22525                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
22526                         } }
22527                 } else {
22528                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22529                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
22530                         } }
22531                 }
22532         }
22533 }
22534 #[no_mangle]
22535 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
22536 /// but with all dynamically-allocated buffers duplicated in new buffers.
22537 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
22538 #[repr(C)]
22539 /// The contents of CResult_DescriptionCreationErrorZ
22540 pub union CResult_DescriptionCreationErrorZPtr {
22541         /// A pointer to the contents in the success state.
22542         /// Reading from this pointer when `result_ok` is not set is undefined.
22543         pub result: *mut crate::lightning_invoice::Description,
22544         /// A pointer to the contents in the error state.
22545         /// Reading from this pointer when `result_ok` is set is undefined.
22546         pub err: *mut crate::lightning_invoice::CreationError,
22547 }
22548 #[repr(C)]
22549 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
22550 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
22551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22552 pub struct CResult_DescriptionCreationErrorZ {
22553         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
22554         /// `err` or `result` depending on the state of `result_ok`.
22555         pub contents: CResult_DescriptionCreationErrorZPtr,
22556         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
22557         pub result_ok: bool,
22558 }
22559 #[no_mangle]
22560 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
22561 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
22562         CResult_DescriptionCreationErrorZ {
22563                 contents: CResult_DescriptionCreationErrorZPtr {
22564                         result: Box::into_raw(Box::new(o)),
22565                 },
22566                 result_ok: true,
22567         }
22568 }
22569 #[no_mangle]
22570 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
22571 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
22572         CResult_DescriptionCreationErrorZ {
22573                 contents: CResult_DescriptionCreationErrorZPtr {
22574                         err: Box::into_raw(Box::new(e)),
22575                 },
22576                 result_ok: false,
22577         }
22578 }
22579 /// Checks if the given object is currently in the success state
22580 #[no_mangle]
22581 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
22582         o.result_ok
22583 }
22584 #[no_mangle]
22585 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
22586 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
22587 impl Drop for CResult_DescriptionCreationErrorZ {
22588         fn drop(&mut self) {
22589                 if self.result_ok {
22590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22592                         }
22593                 } else {
22594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22596                         }
22597                 }
22598         }
22599 }
22600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
22601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
22602                 let contents = if o.result_ok {
22603                         let result = unsafe { o.contents.result };
22604                         unsafe { o.contents.result = core::ptr::null_mut() };
22605                         CResult_DescriptionCreationErrorZPtr { result }
22606                 } else {
22607                         let err = unsafe { o.contents.err };
22608                         unsafe { o.contents.err = core::ptr::null_mut(); }
22609                         CResult_DescriptionCreationErrorZPtr { err }
22610                 };
22611                 Self {
22612                         contents,
22613                         result_ok: o.result_ok,
22614                 }
22615         }
22616 }
22617 impl Clone for CResult_DescriptionCreationErrorZ {
22618         fn clone(&self) -> Self {
22619                 if self.result_ok {
22620                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
22621                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
22622                         } }
22623                 } else {
22624                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
22625                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22626                         } }
22627                 }
22628         }
22629 }
22630 #[no_mangle]
22631 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
22632 /// but with all dynamically-allocated buffers duplicated in new buffers.
22633 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
22634 #[repr(C)]
22635 /// The contents of CResult_PrivateRouteCreationErrorZ
22636 pub union CResult_PrivateRouteCreationErrorZPtr {
22637         /// A pointer to the contents in the success state.
22638         /// Reading from this pointer when `result_ok` is not set is undefined.
22639         pub result: *mut crate::lightning_invoice::PrivateRoute,
22640         /// A pointer to the contents in the error state.
22641         /// Reading from this pointer when `result_ok` is set is undefined.
22642         pub err: *mut crate::lightning_invoice::CreationError,
22643 }
22644 #[repr(C)]
22645 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
22646 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
22647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22648 pub struct CResult_PrivateRouteCreationErrorZ {
22649         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
22650         /// `err` or `result` depending on the state of `result_ok`.
22651         pub contents: CResult_PrivateRouteCreationErrorZPtr,
22652         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
22653         pub result_ok: bool,
22654 }
22655 #[no_mangle]
22656 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
22657 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
22658         CResult_PrivateRouteCreationErrorZ {
22659                 contents: CResult_PrivateRouteCreationErrorZPtr {
22660                         result: Box::into_raw(Box::new(o)),
22661                 },
22662                 result_ok: true,
22663         }
22664 }
22665 #[no_mangle]
22666 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
22667 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
22668         CResult_PrivateRouteCreationErrorZ {
22669                 contents: CResult_PrivateRouteCreationErrorZPtr {
22670                         err: Box::into_raw(Box::new(e)),
22671                 },
22672                 result_ok: false,
22673         }
22674 }
22675 /// Checks if the given object is currently in the success state
22676 #[no_mangle]
22677 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
22678         o.result_ok
22679 }
22680 #[no_mangle]
22681 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
22682 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
22683 impl Drop for CResult_PrivateRouteCreationErrorZ {
22684         fn drop(&mut self) {
22685                 if self.result_ok {
22686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22688                         }
22689                 } else {
22690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22692                         }
22693                 }
22694         }
22695 }
22696 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
22697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
22698                 let contents = if o.result_ok {
22699                         let result = unsafe { o.contents.result };
22700                         unsafe { o.contents.result = core::ptr::null_mut() };
22701                         CResult_PrivateRouteCreationErrorZPtr { result }
22702                 } else {
22703                         let err = unsafe { o.contents.err };
22704                         unsafe { o.contents.err = core::ptr::null_mut(); }
22705                         CResult_PrivateRouteCreationErrorZPtr { err }
22706                 };
22707                 Self {
22708                         contents,
22709                         result_ok: o.result_ok,
22710                 }
22711         }
22712 }
22713 impl Clone for CResult_PrivateRouteCreationErrorZ {
22714         fn clone(&self) -> Self {
22715                 if self.result_ok {
22716                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
22717                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
22718                         } }
22719                 } else {
22720                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
22721                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22722                         } }
22723                 }
22724         }
22725 }
22726 #[no_mangle]
22727 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
22728 /// but with all dynamically-allocated buffers duplicated in new buffers.
22729 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
22730 #[repr(C)]
22731 /// The contents of CResult_OutPointDecodeErrorZ
22732 pub union CResult_OutPointDecodeErrorZPtr {
22733         /// A pointer to the contents in the success state.
22734         /// Reading from this pointer when `result_ok` is not set is undefined.
22735         pub result: *mut crate::lightning::chain::transaction::OutPoint,
22736         /// A pointer to the contents in the error state.
22737         /// Reading from this pointer when `result_ok` is set is undefined.
22738         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22739 }
22740 #[repr(C)]
22741 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
22742 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
22743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22744 pub struct CResult_OutPointDecodeErrorZ {
22745         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
22746         /// `err` or `result` depending on the state of `result_ok`.
22747         pub contents: CResult_OutPointDecodeErrorZPtr,
22748         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
22749         pub result_ok: bool,
22750 }
22751 #[no_mangle]
22752 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
22753 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
22754         CResult_OutPointDecodeErrorZ {
22755                 contents: CResult_OutPointDecodeErrorZPtr {
22756                         result: Box::into_raw(Box::new(o)),
22757                 },
22758                 result_ok: true,
22759         }
22760 }
22761 #[no_mangle]
22762 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
22763 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
22764         CResult_OutPointDecodeErrorZ {
22765                 contents: CResult_OutPointDecodeErrorZPtr {
22766                         err: Box::into_raw(Box::new(e)),
22767                 },
22768                 result_ok: false,
22769         }
22770 }
22771 /// Checks if the given object is currently in the success state
22772 #[no_mangle]
22773 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
22774         o.result_ok
22775 }
22776 #[no_mangle]
22777 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
22778 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
22779 impl Drop for CResult_OutPointDecodeErrorZ {
22780         fn drop(&mut self) {
22781                 if self.result_ok {
22782                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22783                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22784                         }
22785                 } else {
22786                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22787                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22788                         }
22789                 }
22790         }
22791 }
22792 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
22793         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
22794                 let contents = if o.result_ok {
22795                         let result = unsafe { o.contents.result };
22796                         unsafe { o.contents.result = core::ptr::null_mut() };
22797                         CResult_OutPointDecodeErrorZPtr { result }
22798                 } else {
22799                         let err = unsafe { o.contents.err };
22800                         unsafe { o.contents.err = core::ptr::null_mut(); }
22801                         CResult_OutPointDecodeErrorZPtr { err }
22802                 };
22803                 Self {
22804                         contents,
22805                         result_ok: o.result_ok,
22806                 }
22807         }
22808 }
22809 impl Clone for CResult_OutPointDecodeErrorZ {
22810         fn clone(&self) -> Self {
22811                 if self.result_ok {
22812                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
22813                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
22814                         } }
22815                 } else {
22816                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
22817                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22818                         } }
22819                 }
22820         }
22821 }
22822 #[no_mangle]
22823 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
22824 /// but with all dynamically-allocated buffers duplicated in new buffers.
22825 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
22826 #[repr(C)]
22827 /// The contents of CResult_BigSizeDecodeErrorZ
22828 pub union CResult_BigSizeDecodeErrorZPtr {
22829         /// A pointer to the contents in the success state.
22830         /// Reading from this pointer when `result_ok` is not set is undefined.
22831         pub result: *mut crate::lightning::util::ser::BigSize,
22832         /// A pointer to the contents in the error state.
22833         /// Reading from this pointer when `result_ok` is set is undefined.
22834         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22835 }
22836 #[repr(C)]
22837 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
22838 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
22839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22840 pub struct CResult_BigSizeDecodeErrorZ {
22841         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
22842         /// `err` or `result` depending on the state of `result_ok`.
22843         pub contents: CResult_BigSizeDecodeErrorZPtr,
22844         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
22845         pub result_ok: bool,
22846 }
22847 #[no_mangle]
22848 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
22849 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
22850         CResult_BigSizeDecodeErrorZ {
22851                 contents: CResult_BigSizeDecodeErrorZPtr {
22852                         result: Box::into_raw(Box::new(o)),
22853                 },
22854                 result_ok: true,
22855         }
22856 }
22857 #[no_mangle]
22858 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
22859 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
22860         CResult_BigSizeDecodeErrorZ {
22861                 contents: CResult_BigSizeDecodeErrorZPtr {
22862                         err: Box::into_raw(Box::new(e)),
22863                 },
22864                 result_ok: false,
22865         }
22866 }
22867 /// Checks if the given object is currently in the success state
22868 #[no_mangle]
22869 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
22870         o.result_ok
22871 }
22872 #[no_mangle]
22873 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
22874 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
22875 impl Drop for CResult_BigSizeDecodeErrorZ {
22876         fn drop(&mut self) {
22877                 if self.result_ok {
22878                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22879                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22880                         }
22881                 } else {
22882                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22883                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22884                         }
22885                 }
22886         }
22887 }
22888 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
22889         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
22890                 let contents = if o.result_ok {
22891                         let result = unsafe { o.contents.result };
22892                         unsafe { o.contents.result = core::ptr::null_mut() };
22893                         CResult_BigSizeDecodeErrorZPtr { result }
22894                 } else {
22895                         let err = unsafe { o.contents.err };
22896                         unsafe { o.contents.err = core::ptr::null_mut(); }
22897                         CResult_BigSizeDecodeErrorZPtr { err }
22898                 };
22899                 Self {
22900                         contents,
22901                         result_ok: o.result_ok,
22902                 }
22903         }
22904 }
22905 impl Clone for CResult_BigSizeDecodeErrorZ {
22906         fn clone(&self) -> Self {
22907                 if self.result_ok {
22908                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
22909                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
22910                         } }
22911                 } else {
22912                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
22913                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22914                         } }
22915                 }
22916         }
22917 }
22918 #[no_mangle]
22919 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
22920 /// but with all dynamically-allocated buffers duplicated in new buffers.
22921 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
22922 #[repr(C)]
22923 /// The contents of CResult_HostnameDecodeErrorZ
22924 pub union CResult_HostnameDecodeErrorZPtr {
22925         /// A pointer to the contents in the success state.
22926         /// Reading from this pointer when `result_ok` is not set is undefined.
22927         pub result: *mut crate::lightning::util::ser::Hostname,
22928         /// A pointer to the contents in the error state.
22929         /// Reading from this pointer when `result_ok` is set is undefined.
22930         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22931 }
22932 #[repr(C)]
22933 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
22934 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
22935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22936 pub struct CResult_HostnameDecodeErrorZ {
22937         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
22938         /// `err` or `result` depending on the state of `result_ok`.
22939         pub contents: CResult_HostnameDecodeErrorZPtr,
22940         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
22941         pub result_ok: bool,
22942 }
22943 #[no_mangle]
22944 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
22945 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
22946         CResult_HostnameDecodeErrorZ {
22947                 contents: CResult_HostnameDecodeErrorZPtr {
22948                         result: Box::into_raw(Box::new(o)),
22949                 },
22950                 result_ok: true,
22951         }
22952 }
22953 #[no_mangle]
22954 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
22955 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
22956         CResult_HostnameDecodeErrorZ {
22957                 contents: CResult_HostnameDecodeErrorZPtr {
22958                         err: Box::into_raw(Box::new(e)),
22959                 },
22960                 result_ok: false,
22961         }
22962 }
22963 /// Checks if the given object is currently in the success state
22964 #[no_mangle]
22965 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
22966         o.result_ok
22967 }
22968 #[no_mangle]
22969 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
22970 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
22971 impl Drop for CResult_HostnameDecodeErrorZ {
22972         fn drop(&mut self) {
22973                 if self.result_ok {
22974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22976                         }
22977                 } else {
22978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22980                         }
22981                 }
22982         }
22983 }
22984 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
22985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
22986                 let contents = if o.result_ok {
22987                         let result = unsafe { o.contents.result };
22988                         unsafe { o.contents.result = core::ptr::null_mut() };
22989                         CResult_HostnameDecodeErrorZPtr { result }
22990                 } else {
22991                         let err = unsafe { o.contents.err };
22992                         unsafe { o.contents.err = core::ptr::null_mut(); }
22993                         CResult_HostnameDecodeErrorZPtr { err }
22994                 };
22995                 Self {
22996                         contents,
22997                         result_ok: o.result_ok,
22998                 }
22999         }
23000 }
23001 impl Clone for CResult_HostnameDecodeErrorZ {
23002         fn clone(&self) -> Self {
23003                 if self.result_ok {
23004                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
23005                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
23006                         } }
23007                 } else {
23008                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
23009                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23010                         } }
23011                 }
23012         }
23013 }
23014 #[no_mangle]
23015 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
23016 /// but with all dynamically-allocated buffers duplicated in new buffers.
23017 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
23018 #[repr(C)]
23019 /// The contents of CResult_TransactionU16LenLimitedNoneZ
23020 pub union CResult_TransactionU16LenLimitedNoneZPtr {
23021         /// A pointer to the contents in the success state.
23022         /// Reading from this pointer when `result_ok` is not set is undefined.
23023         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
23024         /// Note that this value is always NULL, as there are no contents in the Err variant
23025         pub err: *mut core::ffi::c_void,
23026 }
23027 #[repr(C)]
23028 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
23029 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
23030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23031 pub struct CResult_TransactionU16LenLimitedNoneZ {
23032         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
23033         /// `err` or `result` depending on the state of `result_ok`.
23034         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
23035         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
23036         pub result_ok: bool,
23037 }
23038 #[no_mangle]
23039 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
23040 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
23041         CResult_TransactionU16LenLimitedNoneZ {
23042                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
23043                         result: Box::into_raw(Box::new(o)),
23044                 },
23045                 result_ok: true,
23046         }
23047 }
23048 #[no_mangle]
23049 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
23050 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
23051         CResult_TransactionU16LenLimitedNoneZ {
23052                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
23053                         err: core::ptr::null_mut(),
23054                 },
23055                 result_ok: false,
23056         }
23057 }
23058 /// Checks if the given object is currently in the success state
23059 #[no_mangle]
23060 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
23061         o.result_ok
23062 }
23063 #[no_mangle]
23064 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
23065 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
23066 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
23067         fn drop(&mut self) {
23068                 if self.result_ok {
23069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23071                         }
23072                 } else {
23073                 }
23074         }
23075 }
23076 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
23077         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
23078                 let contents = if o.result_ok {
23079                         let result = unsafe { o.contents.result };
23080                         unsafe { o.contents.result = core::ptr::null_mut() };
23081                         CResult_TransactionU16LenLimitedNoneZPtr { result }
23082                 } else {
23083                         let _ = unsafe { Box::from_raw(o.contents.err) };
23084                         o.contents.err = core::ptr::null_mut();
23085                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
23086                 };
23087                 Self {
23088                         contents,
23089                         result_ok: o.result_ok,
23090                 }
23091         }
23092 }
23093 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
23094         fn clone(&self) -> Self {
23095                 if self.result_ok {
23096                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
23097                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
23098                         } }
23099                 } else {
23100                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
23101                                 err: core::ptr::null_mut()
23102                         } }
23103                 }
23104         }
23105 }
23106 #[no_mangle]
23107 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
23108 /// but with all dynamically-allocated buffers duplicated in new buffers.
23109 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
23110 #[repr(C)]
23111 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
23112 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23113         /// A pointer to the contents in the success state.
23114         /// Reading from this pointer when `result_ok` is not set is undefined.
23115         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
23116         /// A pointer to the contents in the error state.
23117         /// Reading from this pointer when `result_ok` is set is undefined.
23118         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23119 }
23120 #[repr(C)]
23121 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
23122 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
23123 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23124 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
23125         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
23126         /// `err` or `result` depending on the state of `result_ok`.
23127         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
23128         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
23129         pub result_ok: bool,
23130 }
23131 #[no_mangle]
23132 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
23133 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
23134         CResult_TransactionU16LenLimitedDecodeErrorZ {
23135                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23136                         result: Box::into_raw(Box::new(o)),
23137                 },
23138                 result_ok: true,
23139         }
23140 }
23141 #[no_mangle]
23142 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
23143 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
23144         CResult_TransactionU16LenLimitedDecodeErrorZ {
23145                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23146                         err: Box::into_raw(Box::new(e)),
23147                 },
23148                 result_ok: false,
23149         }
23150 }
23151 /// Checks if the given object is currently in the success state
23152 #[no_mangle]
23153 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
23154         o.result_ok
23155 }
23156 #[no_mangle]
23157 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
23158 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
23159 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
23160         fn drop(&mut self) {
23161                 if self.result_ok {
23162                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23163                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23164                         }
23165                 } else {
23166                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23167                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23168                         }
23169                 }
23170         }
23171 }
23172 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
23173         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
23174                 let contents = if o.result_ok {
23175                         let result = unsafe { o.contents.result };
23176                         unsafe { o.contents.result = core::ptr::null_mut() };
23177                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
23178                 } else {
23179                         let err = unsafe { o.contents.err };
23180                         unsafe { o.contents.err = core::ptr::null_mut(); }
23181                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
23182                 };
23183                 Self {
23184                         contents,
23185                         result_ok: o.result_ok,
23186                 }
23187         }
23188 }
23189 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
23190         fn clone(&self) -> Self {
23191                 if self.result_ok {
23192                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23193                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
23194                         } }
23195                 } else {
23196                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23197                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23198                         } }
23199                 }
23200         }
23201 }
23202 #[no_mangle]
23203 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
23204 /// but with all dynamically-allocated buffers duplicated in new buffers.
23205 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
23206 #[repr(C)]
23207 /// The contents of CResult_UntrustedStringDecodeErrorZ
23208 pub union CResult_UntrustedStringDecodeErrorZPtr {
23209         /// A pointer to the contents in the success state.
23210         /// Reading from this pointer when `result_ok` is not set is undefined.
23211         pub result: *mut crate::lightning::util::string::UntrustedString,
23212         /// A pointer to the contents in the error state.
23213         /// Reading from this pointer when `result_ok` is set is undefined.
23214         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23215 }
23216 #[repr(C)]
23217 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
23218 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
23219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23220 pub struct CResult_UntrustedStringDecodeErrorZ {
23221         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
23222         /// `err` or `result` depending on the state of `result_ok`.
23223         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
23224         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
23225         pub result_ok: bool,
23226 }
23227 #[no_mangle]
23228 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
23229 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
23230         CResult_UntrustedStringDecodeErrorZ {
23231                 contents: CResult_UntrustedStringDecodeErrorZPtr {
23232                         result: Box::into_raw(Box::new(o)),
23233                 },
23234                 result_ok: true,
23235         }
23236 }
23237 #[no_mangle]
23238 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
23239 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
23240         CResult_UntrustedStringDecodeErrorZ {
23241                 contents: CResult_UntrustedStringDecodeErrorZPtr {
23242                         err: Box::into_raw(Box::new(e)),
23243                 },
23244                 result_ok: false,
23245         }
23246 }
23247 /// Checks if the given object is currently in the success state
23248 #[no_mangle]
23249 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
23250         o.result_ok
23251 }
23252 #[no_mangle]
23253 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
23254 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
23255 impl Drop for CResult_UntrustedStringDecodeErrorZ {
23256         fn drop(&mut self) {
23257                 if self.result_ok {
23258                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23259                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23260                         }
23261                 } else {
23262                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23263                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23264                         }
23265                 }
23266         }
23267 }
23268 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
23269         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
23270                 let contents = if o.result_ok {
23271                         let result = unsafe { o.contents.result };
23272                         unsafe { o.contents.result = core::ptr::null_mut() };
23273                         CResult_UntrustedStringDecodeErrorZPtr { result }
23274                 } else {
23275                         let err = unsafe { o.contents.err };
23276                         unsafe { o.contents.err = core::ptr::null_mut(); }
23277                         CResult_UntrustedStringDecodeErrorZPtr { err }
23278                 };
23279                 Self {
23280                         contents,
23281                         result_ok: o.result_ok,
23282                 }
23283         }
23284 }
23285 impl Clone for CResult_UntrustedStringDecodeErrorZ {
23286         fn clone(&self) -> Self {
23287                 if self.result_ok {
23288                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
23289                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
23290                         } }
23291                 } else {
23292                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
23293                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23294                         } }
23295                 }
23296         }
23297 }
23298 #[no_mangle]
23299 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
23300 /// but with all dynamically-allocated buffers duplicated in new buffers.
23301 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
23302 #[repr(C)]
23303 /// A tuple of 2 elements. See the individual fields for the types contained.
23304 pub struct C2Tuple__u832u16Z {
23305         /// The element at position 0
23306         pub a: crate::c_types::ThirtyTwoBytes,
23307         /// The element at position 1
23308         pub b: u16,
23309 }
23310 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
23311         fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
23312                 Self {
23313                         a: tup.0,
23314                         b: tup.1,
23315                 }
23316         }
23317 }
23318 impl C2Tuple__u832u16Z {
23319         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
23320                 (self.a, self.b)
23321         }
23322 }
23323 impl Clone for C2Tuple__u832u16Z {
23324         fn clone(&self) -> Self {
23325                 Self {
23326                         a: Clone::clone(&self.a),
23327                         b: Clone::clone(&self.b),
23328                 }
23329         }
23330 }
23331 #[no_mangle]
23332 /// Creates a new tuple which has the same data as `orig`
23333 /// but with all dynamically-allocated buffers duplicated in new buffers.
23334 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
23335 /// Creates a new C2Tuple__u832u16Z from the contained elements.
23336 #[no_mangle]
23337 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
23338         C2Tuple__u832u16Z { a, b, }
23339 }
23340
23341 #[no_mangle]
23342 /// Frees any resources used by the C2Tuple__u832u16Z.
23343 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
23344 #[repr(C)]
23345 /// The contents of CResult_PaymentRelayDecodeErrorZ
23346 pub union CResult_PaymentRelayDecodeErrorZPtr {
23347         /// A pointer to the contents in the success state.
23348         /// Reading from this pointer when `result_ok` is not set is undefined.
23349         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
23350         /// A pointer to the contents in the error state.
23351         /// Reading from this pointer when `result_ok` is set is undefined.
23352         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23353 }
23354 #[repr(C)]
23355 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
23356 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
23357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23358 pub struct CResult_PaymentRelayDecodeErrorZ {
23359         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
23360         /// `err` or `result` depending on the state of `result_ok`.
23361         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
23362         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
23363         pub result_ok: bool,
23364 }
23365 #[no_mangle]
23366 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
23367 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
23368         CResult_PaymentRelayDecodeErrorZ {
23369                 contents: CResult_PaymentRelayDecodeErrorZPtr {
23370                         result: Box::into_raw(Box::new(o)),
23371                 },
23372                 result_ok: true,
23373         }
23374 }
23375 #[no_mangle]
23376 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
23377 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
23378         CResult_PaymentRelayDecodeErrorZ {
23379                 contents: CResult_PaymentRelayDecodeErrorZPtr {
23380                         err: Box::into_raw(Box::new(e)),
23381                 },
23382                 result_ok: false,
23383         }
23384 }
23385 /// Checks if the given object is currently in the success state
23386 #[no_mangle]
23387 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
23388         o.result_ok
23389 }
23390 #[no_mangle]
23391 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
23392 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
23393 impl Drop for CResult_PaymentRelayDecodeErrorZ {
23394         fn drop(&mut self) {
23395                 if self.result_ok {
23396                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23397                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23398                         }
23399                 } else {
23400                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23401                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23402                         }
23403                 }
23404         }
23405 }
23406 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
23407         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
23408                 let contents = if o.result_ok {
23409                         let result = unsafe { o.contents.result };
23410                         unsafe { o.contents.result = core::ptr::null_mut() };
23411                         CResult_PaymentRelayDecodeErrorZPtr { result }
23412                 } else {
23413                         let err = unsafe { o.contents.err };
23414                         unsafe { o.contents.err = core::ptr::null_mut(); }
23415                         CResult_PaymentRelayDecodeErrorZPtr { err }
23416                 };
23417                 Self {
23418                         contents,
23419                         result_ok: o.result_ok,
23420                 }
23421         }
23422 }
23423 impl Clone for CResult_PaymentRelayDecodeErrorZ {
23424         fn clone(&self) -> Self {
23425                 if self.result_ok {
23426                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
23427                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
23428                         } }
23429                 } else {
23430                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
23431                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23432                         } }
23433                 }
23434         }
23435 }
23436 #[no_mangle]
23437 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
23438 /// but with all dynamically-allocated buffers duplicated in new buffers.
23439 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
23440 #[repr(C)]
23441 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
23442 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
23443         /// A pointer to the contents in the success state.
23444         /// Reading from this pointer when `result_ok` is not set is undefined.
23445         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
23446         /// A pointer to the contents in the error state.
23447         /// Reading from this pointer when `result_ok` is set is undefined.
23448         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23449 }
23450 #[repr(C)]
23451 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
23452 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
23453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23454 pub struct CResult_PaymentConstraintsDecodeErrorZ {
23455         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
23456         /// `err` or `result` depending on the state of `result_ok`.
23457         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
23458         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
23459         pub result_ok: bool,
23460 }
23461 #[no_mangle]
23462 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
23463 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
23464         CResult_PaymentConstraintsDecodeErrorZ {
23465                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23466                         result: Box::into_raw(Box::new(o)),
23467                 },
23468                 result_ok: true,
23469         }
23470 }
23471 #[no_mangle]
23472 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
23473 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
23474         CResult_PaymentConstraintsDecodeErrorZ {
23475                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23476                         err: Box::into_raw(Box::new(e)),
23477                 },
23478                 result_ok: false,
23479         }
23480 }
23481 /// Checks if the given object is currently in the success state
23482 #[no_mangle]
23483 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
23484         o.result_ok
23485 }
23486 #[no_mangle]
23487 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
23488 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
23489 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
23490         fn drop(&mut self) {
23491                 if self.result_ok {
23492                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23493                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23494                         }
23495                 } else {
23496                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23497                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23498                         }
23499                 }
23500         }
23501 }
23502 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
23503         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
23504                 let contents = if o.result_ok {
23505                         let result = unsafe { o.contents.result };
23506                         unsafe { o.contents.result = core::ptr::null_mut() };
23507                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
23508                 } else {
23509                         let err = unsafe { o.contents.err };
23510                         unsafe { o.contents.err = core::ptr::null_mut(); }
23511                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
23512                 };
23513                 Self {
23514                         contents,
23515                         result_ok: o.result_ok,
23516                 }
23517         }
23518 }
23519 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
23520         fn clone(&self) -> Self {
23521                 if self.result_ok {
23522                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23523                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
23524                         } }
23525                 } else {
23526                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23527                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23528                         } }
23529                 }
23530         }
23531 }
23532 #[no_mangle]
23533 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
23534 /// but with all dynamically-allocated buffers duplicated in new buffers.
23535 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
23536 #[repr(C)]
23537 /// A tuple of 3 elements. See the individual fields for the types contained.
23538 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23539         /// The element at position 0
23540         pub a: crate::c_types::ThirtyTwoBytes,
23541         /// The element at position 1
23542         pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
23543         /// The element at position 2
23544         pub c: crate::lightning::routing::router::RouteParameters,
23545 }
23546 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23547         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
23548                 Self {
23549                         a: tup.0,
23550                         b: tup.1,
23551                         c: tup.2,
23552                 }
23553         }
23554 }
23555 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23556         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
23557                 (self.a, self.b, self.c)
23558         }
23559 }
23560 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23561         fn clone(&self) -> Self {
23562                 Self {
23563                         a: Clone::clone(&self.a),
23564                         b: Clone::clone(&self.b),
23565                         c: Clone::clone(&self.c),
23566                 }
23567         }
23568 }
23569 #[no_mangle]
23570 /// Creates a new tuple which has the same data as `orig`
23571 /// but with all dynamically-allocated buffers duplicated in new buffers.
23572 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
23573 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
23574 #[no_mangle]
23575 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23576         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
23577 }
23578
23579 #[no_mangle]
23580 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
23581 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
23582 #[repr(C)]
23583 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
23584 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23585         /// A pointer to the contents in the success state.
23586         /// Reading from this pointer when `result_ok` is not set is undefined.
23587         pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
23588         /// Note that this value is always NULL, as there are no contents in the Err variant
23589         pub err: *mut core::ffi::c_void,
23590 }
23591 #[repr(C)]
23592 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
23593 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
23594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23595 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23596         /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
23597         /// `err` or `result` depending on the state of `result_ok`.
23598         pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
23599         /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
23600         pub result_ok: bool,
23601 }
23602 #[no_mangle]
23603 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
23604 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23605         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23606                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23607                         result: Box::into_raw(Box::new(o)),
23608                 },
23609                 result_ok: true,
23610         }
23611 }
23612 #[no_mangle]
23613 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
23614 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23615         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23616                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23617                         err: core::ptr::null_mut(),
23618                 },
23619                 result_ok: false,
23620         }
23621 }
23622 /// Checks if the given object is currently in the success state
23623 #[no_mangle]
23624 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
23625         o.result_ok
23626 }
23627 #[no_mangle]
23628 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
23629 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
23630 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23631         fn drop(&mut self) {
23632                 if self.result_ok {
23633                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23634                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23635                         }
23636                 } else {
23637                 }
23638         }
23639 }
23640 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23641         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
23642                 let contents = if o.result_ok {
23643                         let result = unsafe { o.contents.result };
23644                         unsafe { o.contents.result = core::ptr::null_mut() };
23645                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
23646                 } else {
23647                         let _ = unsafe { Box::from_raw(o.contents.err) };
23648                         o.contents.err = core::ptr::null_mut();
23649                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
23650                 };
23651                 Self {
23652                         contents,
23653                         result_ok: o.result_ok,
23654                 }
23655         }
23656 }
23657 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23658         fn clone(&self) -> Self {
23659                 if self.result_ok {
23660                         Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23661                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
23662                         } }
23663                 } else {
23664                         Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23665                                 err: core::ptr::null_mut()
23666                         } }
23667                 }
23668         }
23669 }
23670 #[no_mangle]
23671 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
23672 /// but with all dynamically-allocated buffers duplicated in new buffers.
23673 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
23674 #[repr(C)]
23675 /// The contents of CResult_StrSecp256k1ErrorZ
23676 pub union CResult_StrSecp256k1ErrorZPtr {
23677         /// A pointer to the contents in the success state.
23678         /// Reading from this pointer when `result_ok` is not set is undefined.
23679         pub result: *mut crate::c_types::Str,
23680         /// A pointer to the contents in the error state.
23681         /// Reading from this pointer when `result_ok` is set is undefined.
23682         pub err: *mut crate::c_types::Secp256k1Error,
23683 }
23684 #[repr(C)]
23685 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
23686 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
23687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23688 pub struct CResult_StrSecp256k1ErrorZ {
23689         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
23690         /// `err` or `result` depending on the state of `result_ok`.
23691         pub contents: CResult_StrSecp256k1ErrorZPtr,
23692         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
23693         pub result_ok: bool,
23694 }
23695 #[no_mangle]
23696 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
23697 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
23698         CResult_StrSecp256k1ErrorZ {
23699                 contents: CResult_StrSecp256k1ErrorZPtr {
23700                         result: Box::into_raw(Box::new(o)),
23701                 },
23702                 result_ok: true,
23703         }
23704 }
23705 #[no_mangle]
23706 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
23707 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
23708         CResult_StrSecp256k1ErrorZ {
23709                 contents: CResult_StrSecp256k1ErrorZPtr {
23710                         err: Box::into_raw(Box::new(e)),
23711                 },
23712                 result_ok: false,
23713         }
23714 }
23715 /// Checks if the given object is currently in the success state
23716 #[no_mangle]
23717 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
23718         o.result_ok
23719 }
23720 #[no_mangle]
23721 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
23722 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
23723 impl Drop for CResult_StrSecp256k1ErrorZ {
23724         fn drop(&mut self) {
23725                 if self.result_ok {
23726                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23727                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23728                         }
23729                 } else {
23730                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23731                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23732                         }
23733                 }
23734         }
23735 }
23736 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
23737         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
23738                 let contents = if o.result_ok {
23739                         let result = unsafe { o.contents.result };
23740                         unsafe { o.contents.result = core::ptr::null_mut() };
23741                         CResult_StrSecp256k1ErrorZPtr { result }
23742                 } else {
23743                         let err = unsafe { o.contents.err };
23744                         unsafe { o.contents.err = core::ptr::null_mut(); }
23745                         CResult_StrSecp256k1ErrorZPtr { err }
23746                 };
23747                 Self {
23748                         contents,
23749                         result_ok: o.result_ok,
23750                 }
23751         }
23752 }
23753 impl Clone for CResult_StrSecp256k1ErrorZ {
23754         fn clone(&self) -> Self {
23755                 if self.result_ok {
23756                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
23757                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
23758                         } }
23759                 } else {
23760                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
23761                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23762                         } }
23763                 }
23764         }
23765 }
23766 #[no_mangle]
23767 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
23768 /// but with all dynamically-allocated buffers duplicated in new buffers.
23769 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
23770 #[repr(C)]
23771 /// The contents of CResult_TxOutUtxoLookupErrorZ
23772 pub union CResult_TxOutUtxoLookupErrorZPtr {
23773         /// A pointer to the contents in the success state.
23774         /// Reading from this pointer when `result_ok` is not set is undefined.
23775         pub result: *mut crate::c_types::TxOut,
23776         /// A pointer to the contents in the error state.
23777         /// Reading from this pointer when `result_ok` is set is undefined.
23778         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
23779 }
23780 #[repr(C)]
23781 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
23782 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
23783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23784 pub struct CResult_TxOutUtxoLookupErrorZ {
23785         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
23786         /// `err` or `result` depending on the state of `result_ok`.
23787         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
23788         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
23789         pub result_ok: bool,
23790 }
23791 #[no_mangle]
23792 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
23793 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
23794         CResult_TxOutUtxoLookupErrorZ {
23795                 contents: CResult_TxOutUtxoLookupErrorZPtr {
23796                         result: Box::into_raw(Box::new(o)),
23797                 },
23798                 result_ok: true,
23799         }
23800 }
23801 #[no_mangle]
23802 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
23803 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
23804         CResult_TxOutUtxoLookupErrorZ {
23805                 contents: CResult_TxOutUtxoLookupErrorZPtr {
23806                         err: Box::into_raw(Box::new(e)),
23807                 },
23808                 result_ok: false,
23809         }
23810 }
23811 /// Checks if the given object is currently in the success state
23812 #[no_mangle]
23813 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
23814         o.result_ok
23815 }
23816 #[no_mangle]
23817 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
23818 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
23819 impl Drop for CResult_TxOutUtxoLookupErrorZ {
23820         fn drop(&mut self) {
23821                 if self.result_ok {
23822                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23823                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23824                         }
23825                 } else {
23826                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23827                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23828                         }
23829                 }
23830         }
23831 }
23832 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
23833         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
23834                 let contents = if o.result_ok {
23835                         let result = unsafe { o.contents.result };
23836                         unsafe { o.contents.result = core::ptr::null_mut() };
23837                         CResult_TxOutUtxoLookupErrorZPtr { result }
23838                 } else {
23839                         let err = unsafe { o.contents.err };
23840                         unsafe { o.contents.err = core::ptr::null_mut(); }
23841                         CResult_TxOutUtxoLookupErrorZPtr { err }
23842                 };
23843                 Self {
23844                         contents,
23845                         result_ok: o.result_ok,
23846                 }
23847         }
23848 }
23849 impl Clone for CResult_TxOutUtxoLookupErrorZ {
23850         fn clone(&self) -> Self {
23851                 if self.result_ok {
23852                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
23853                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
23854                         } }
23855                 } else {
23856                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
23857                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
23858                         } }
23859                 }
23860         }
23861 }
23862 #[no_mangle]
23863 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
23864 /// but with all dynamically-allocated buffers duplicated in new buffers.
23865 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
23866 #[repr(C)]
23867 /// A tuple of 3 elements. See the individual fields for the types contained.
23868 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23869         /// The element at position 0
23870         pub a: crate::c_types::PublicKey,
23871         /// The element at position 1
23872         pub b: crate::lightning::ln::msgs::OnionMessage,
23873         /// The element at position 2
23874         pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
23875 }
23876 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23877         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
23878                 Self {
23879                         a: tup.0,
23880                         b: tup.1,
23881                         c: tup.2,
23882                 }
23883         }
23884 }
23885 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23886         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ) {
23887                 (self.a, self.b, self.c)
23888         }
23889 }
23890 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23891         fn clone(&self) -> Self {
23892                 Self {
23893                         a: Clone::clone(&self.a),
23894                         b: Clone::clone(&self.b),
23895                         c: Clone::clone(&self.c),
23896                 }
23897         }
23898 }
23899 #[no_mangle]
23900 /// Creates a new tuple which has the same data as `orig`
23901 /// but with all dynamically-allocated buffers duplicated in new buffers.
23902 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
23903 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
23904 #[no_mangle]
23905 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23906         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
23907 }
23908
23909 #[no_mangle]
23910 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
23911 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
23912 #[repr(C)]
23913 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
23914 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23915         /// A pointer to the contents in the success state.
23916         /// Reading from this pointer when `result_ok` is not set is undefined.
23917         pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
23918         /// A pointer to the contents in the error state.
23919         /// Reading from this pointer when `result_ok` is set is undefined.
23920         pub err: *mut crate::lightning::onion_message::messenger::SendError,
23921 }
23922 #[repr(C)]
23923 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
23924 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
23925 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23926 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23927         /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
23928         /// `err` or `result` depending on the state of `result_ok`.
23929         pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
23930         /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
23931         pub result_ok: bool,
23932 }
23933 #[no_mangle]
23934 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
23935 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23936         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23937                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23938                         result: Box::into_raw(Box::new(o)),
23939                 },
23940                 result_ok: true,
23941         }
23942 }
23943 #[no_mangle]
23944 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
23945 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23946         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23947                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23948                         err: Box::into_raw(Box::new(e)),
23949                 },
23950                 result_ok: false,
23951         }
23952 }
23953 /// Checks if the given object is currently in the success state
23954 #[no_mangle]
23955 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
23956         o.result_ok
23957 }
23958 #[no_mangle]
23959 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
23960 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
23961 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23962         fn drop(&mut self) {
23963                 if self.result_ok {
23964                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23965                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23966                         }
23967                 } else {
23968                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23969                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23970                         }
23971                 }
23972         }
23973 }
23974 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23975         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
23976                 let contents = if o.result_ok {
23977                         let result = unsafe { o.contents.result };
23978                         unsafe { o.contents.result = core::ptr::null_mut() };
23979                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
23980                 } else {
23981                         let err = unsafe { o.contents.err };
23982                         unsafe { o.contents.err = core::ptr::null_mut(); }
23983                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
23984                 };
23985                 Self {
23986                         contents,
23987                         result_ok: o.result_ok,
23988                 }
23989         }
23990 }
23991 #[repr(C)]
23992 /// The contents of CResult_PeeledOnionNoneZ
23993 pub union CResult_PeeledOnionNoneZPtr {
23994         /// A pointer to the contents in the success state.
23995         /// Reading from this pointer when `result_ok` is not set is undefined.
23996         pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
23997         /// Note that this value is always NULL, as there are no contents in the Err variant
23998         pub err: *mut core::ffi::c_void,
23999 }
24000 #[repr(C)]
24001 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
24002 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
24003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24004 pub struct CResult_PeeledOnionNoneZ {
24005         /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
24006         /// `err` or `result` depending on the state of `result_ok`.
24007         pub contents: CResult_PeeledOnionNoneZPtr,
24008         /// Whether this CResult_PeeledOnionNoneZ represents a success state.
24009         pub result_ok: bool,
24010 }
24011 #[no_mangle]
24012 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
24013 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
24014         CResult_PeeledOnionNoneZ {
24015                 contents: CResult_PeeledOnionNoneZPtr {
24016                         result: Box::into_raw(Box::new(o)),
24017                 },
24018                 result_ok: true,
24019         }
24020 }
24021 #[no_mangle]
24022 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
24023 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
24024         CResult_PeeledOnionNoneZ {
24025                 contents: CResult_PeeledOnionNoneZPtr {
24026                         err: core::ptr::null_mut(),
24027                 },
24028                 result_ok: false,
24029         }
24030 }
24031 /// Checks if the given object is currently in the success state
24032 #[no_mangle]
24033 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
24034         o.result_ok
24035 }
24036 #[no_mangle]
24037 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
24038 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
24039 impl Drop for CResult_PeeledOnionNoneZ {
24040         fn drop(&mut self) {
24041                 if self.result_ok {
24042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24044                         }
24045                 } else {
24046                 }
24047         }
24048 }
24049 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
24050         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
24051                 let contents = if o.result_ok {
24052                         let result = unsafe { o.contents.result };
24053                         unsafe { o.contents.result = core::ptr::null_mut() };
24054                         CResult_PeeledOnionNoneZPtr { result }
24055                 } else {
24056                         let _ = unsafe { Box::from_raw(o.contents.err) };
24057                         o.contents.err = core::ptr::null_mut();
24058                         CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
24059                 };
24060                 Self {
24061                         contents,
24062                         result_ok: o.result_ok,
24063                 }
24064         }
24065 }
24066 #[repr(C)]
24067 /// The contents of CResult_SendSuccessSendErrorZ
24068 pub union CResult_SendSuccessSendErrorZPtr {
24069         /// A pointer to the contents in the success state.
24070         /// Reading from this pointer when `result_ok` is not set is undefined.
24071         pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
24072         /// A pointer to the contents in the error state.
24073         /// Reading from this pointer when `result_ok` is set is undefined.
24074         pub err: *mut crate::lightning::onion_message::messenger::SendError,
24075 }
24076 #[repr(C)]
24077 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
24078 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
24079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24080 pub struct CResult_SendSuccessSendErrorZ {
24081         /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
24082         /// `err` or `result` depending on the state of `result_ok`.
24083         pub contents: CResult_SendSuccessSendErrorZPtr,
24084         /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
24085         pub result_ok: bool,
24086 }
24087 #[no_mangle]
24088 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
24089 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
24090         CResult_SendSuccessSendErrorZ {
24091                 contents: CResult_SendSuccessSendErrorZPtr {
24092                         result: Box::into_raw(Box::new(o)),
24093                 },
24094                 result_ok: true,
24095         }
24096 }
24097 #[no_mangle]
24098 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
24099 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
24100         CResult_SendSuccessSendErrorZ {
24101                 contents: CResult_SendSuccessSendErrorZPtr {
24102                         err: Box::into_raw(Box::new(e)),
24103                 },
24104                 result_ok: false,
24105         }
24106 }
24107 /// Checks if the given object is currently in the success state
24108 #[no_mangle]
24109 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
24110         o.result_ok
24111 }
24112 #[no_mangle]
24113 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
24114 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
24115 impl Drop for CResult_SendSuccessSendErrorZ {
24116         fn drop(&mut self) {
24117                 if self.result_ok {
24118                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24119                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24120                         }
24121                 } else {
24122                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24123                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24124                         }
24125                 }
24126         }
24127 }
24128 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
24129         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
24130                 let contents = if o.result_ok {
24131                         let result = unsafe { o.contents.result };
24132                         unsafe { o.contents.result = core::ptr::null_mut() };
24133                         CResult_SendSuccessSendErrorZPtr { result }
24134                 } else {
24135                         let err = unsafe { o.contents.err };
24136                         unsafe { o.contents.err = core::ptr::null_mut(); }
24137                         CResult_SendSuccessSendErrorZPtr { err }
24138                 };
24139                 Self {
24140                         contents,
24141                         result_ok: o.result_ok,
24142                 }
24143         }
24144 }
24145 #[repr(C)]
24146 /// The contents of CResult_BlindedPathNoneZ
24147 pub union CResult_BlindedPathNoneZPtr {
24148         /// A pointer to the contents in the success state.
24149         /// Reading from this pointer when `result_ok` is not set is undefined.
24150         pub result: *mut crate::lightning::blinded_path::BlindedPath,
24151         /// Note that this value is always NULL, as there are no contents in the Err variant
24152         pub err: *mut core::ffi::c_void,
24153 }
24154 #[repr(C)]
24155 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
24156 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
24157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24158 pub struct CResult_BlindedPathNoneZ {
24159         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
24160         /// `err` or `result` depending on the state of `result_ok`.
24161         pub contents: CResult_BlindedPathNoneZPtr,
24162         /// Whether this CResult_BlindedPathNoneZ represents a success state.
24163         pub result_ok: bool,
24164 }
24165 #[no_mangle]
24166 /// Creates a new CResult_BlindedPathNoneZ in the success state.
24167 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
24168         CResult_BlindedPathNoneZ {
24169                 contents: CResult_BlindedPathNoneZPtr {
24170                         result: Box::into_raw(Box::new(o)),
24171                 },
24172                 result_ok: true,
24173         }
24174 }
24175 #[no_mangle]
24176 /// Creates a new CResult_BlindedPathNoneZ in the error state.
24177 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
24178         CResult_BlindedPathNoneZ {
24179                 contents: CResult_BlindedPathNoneZPtr {
24180                         err: core::ptr::null_mut(),
24181                 },
24182                 result_ok: false,
24183         }
24184 }
24185 /// Checks if the given object is currently in the success state
24186 #[no_mangle]
24187 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
24188         o.result_ok
24189 }
24190 #[no_mangle]
24191 /// Frees any resources used by the CResult_BlindedPathNoneZ.
24192 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
24193 impl Drop for CResult_BlindedPathNoneZ {
24194         fn drop(&mut self) {
24195                 if self.result_ok {
24196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24198                         }
24199                 } else {
24200                 }
24201         }
24202 }
24203 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
24204         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
24205                 let contents = if o.result_ok {
24206                         let result = unsafe { o.contents.result };
24207                         unsafe { o.contents.result = core::ptr::null_mut() };
24208                         CResult_BlindedPathNoneZPtr { result }
24209                 } else {
24210                         let _ = unsafe { Box::from_raw(o.contents.err) };
24211                         o.contents.err = core::ptr::null_mut();
24212                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
24213                 };
24214                 Self {
24215                         contents,
24216                         result_ok: o.result_ok,
24217                 }
24218         }
24219 }
24220 impl Clone for CResult_BlindedPathNoneZ {
24221         fn clone(&self) -> Self {
24222                 if self.result_ok {
24223                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
24224                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
24225                         } }
24226                 } else {
24227                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
24228                                 err: core::ptr::null_mut()
24229                         } }
24230                 }
24231         }
24232 }
24233 #[no_mangle]
24234 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
24235 /// but with all dynamically-allocated buffers duplicated in new buffers.
24236 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
24237 #[repr(C)]
24238 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
24239 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24240         /// A pointer to the contents in the success state.
24241         /// Reading from this pointer when `result_ok` is not set is undefined.
24242         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
24243         /// Note that this value is always NULL, as there are no contents in the Err variant
24244         pub err: *mut core::ffi::c_void,
24245 }
24246 #[repr(C)]
24247 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
24248 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
24249 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24250 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24251         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
24252         /// `err` or `result` depending on the state of `result_ok`.
24253         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
24254         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
24255         pub result_ok: bool,
24256 }
24257 #[no_mangle]
24258 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
24259 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24260         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24261                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24262                         result: Box::into_raw(Box::new(o)),
24263                 },
24264                 result_ok: true,
24265         }
24266 }
24267 #[no_mangle]
24268 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
24269 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24270         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24271                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24272                         err: core::ptr::null_mut(),
24273                 },
24274                 result_ok: false,
24275         }
24276 }
24277 /// Checks if the given object is currently in the success state
24278 #[no_mangle]
24279 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
24280         o.result_ok
24281 }
24282 #[no_mangle]
24283 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
24284 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
24285 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24286         fn drop(&mut self) {
24287                 if self.result_ok {
24288                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24289                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24290                         }
24291                 } else {
24292                 }
24293         }
24294 }
24295 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24296         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
24297                 let contents = if o.result_ok {
24298                         let result = unsafe { o.contents.result };
24299                         unsafe { o.contents.result = core::ptr::null_mut() };
24300                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
24301                 } else {
24302                         let _ = unsafe { Box::from_raw(o.contents.err) };
24303                         o.contents.err = core::ptr::null_mut();
24304                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
24305                 };
24306                 Self {
24307                         contents,
24308                         result_ok: o.result_ok,
24309                 }
24310         }
24311 }
24312 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24313         fn clone(&self) -> Self {
24314                 if self.result_ok {
24315                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24316                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
24317                         } }
24318                 } else {
24319                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24320                                 err: core::ptr::null_mut()
24321                         } }
24322                 }
24323         }
24324 }
24325 #[no_mangle]
24326 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
24327 /// but with all dynamically-allocated buffers duplicated in new buffers.
24328 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
24329 #[repr(C)]
24330 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
24331 /// This corresponds to std::vector in C++
24332 pub struct CVec_ForwardNodeZ {
24333         /// The elements in the array.
24334         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24335         pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
24336         /// The number of elements pointed to by `data`.
24337         pub datalen: usize
24338 }
24339 impl CVec_ForwardNodeZ {
24340         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
24341                 if self.datalen == 0 { return Vec::new(); }
24342                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24343                 self.data = core::ptr::null_mut();
24344                 self.datalen = 0;
24345                 ret
24346         }
24347         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
24348                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24349         }
24350 }
24351 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
24352         fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
24353                 let datalen = v.len();
24354                 let data = Box::into_raw(v.into_boxed_slice());
24355                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24356         }
24357 }
24358 #[no_mangle]
24359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24360 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
24361 impl Drop for CVec_ForwardNodeZ {
24362         fn drop(&mut self) {
24363                 if self.datalen == 0 { return; }
24364                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24365         }
24366 }
24367 impl Clone for CVec_ForwardNodeZ {
24368         fn clone(&self) -> Self {
24369                 let mut res = Vec::new();
24370                 if self.datalen == 0 { return Self::from(res); }
24371                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
24372                 Self::from(res)
24373         }
24374 }
24375 #[repr(C)]
24376 /// The contents of CResult_BlindedPathDecodeErrorZ
24377 pub union CResult_BlindedPathDecodeErrorZPtr {
24378         /// A pointer to the contents in the success state.
24379         /// Reading from this pointer when `result_ok` is not set is undefined.
24380         pub result: *mut crate::lightning::blinded_path::BlindedPath,
24381         /// A pointer to the contents in the error state.
24382         /// Reading from this pointer when `result_ok` is set is undefined.
24383         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24384 }
24385 #[repr(C)]
24386 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
24387 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
24388 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24389 pub struct CResult_BlindedPathDecodeErrorZ {
24390         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
24391         /// `err` or `result` depending on the state of `result_ok`.
24392         pub contents: CResult_BlindedPathDecodeErrorZPtr,
24393         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
24394         pub result_ok: bool,
24395 }
24396 #[no_mangle]
24397 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
24398 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
24399         CResult_BlindedPathDecodeErrorZ {
24400                 contents: CResult_BlindedPathDecodeErrorZPtr {
24401                         result: Box::into_raw(Box::new(o)),
24402                 },
24403                 result_ok: true,
24404         }
24405 }
24406 #[no_mangle]
24407 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
24408 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
24409         CResult_BlindedPathDecodeErrorZ {
24410                 contents: CResult_BlindedPathDecodeErrorZPtr {
24411                         err: Box::into_raw(Box::new(e)),
24412                 },
24413                 result_ok: false,
24414         }
24415 }
24416 /// Checks if the given object is currently in the success state
24417 #[no_mangle]
24418 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
24419         o.result_ok
24420 }
24421 #[no_mangle]
24422 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
24423 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
24424 impl Drop for CResult_BlindedPathDecodeErrorZ {
24425         fn drop(&mut self) {
24426                 if self.result_ok {
24427                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24428                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24429                         }
24430                 } else {
24431                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24432                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24433                         }
24434                 }
24435         }
24436 }
24437 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
24438         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
24439                 let contents = if o.result_ok {
24440                         let result = unsafe { o.contents.result };
24441                         unsafe { o.contents.result = core::ptr::null_mut() };
24442                         CResult_BlindedPathDecodeErrorZPtr { result }
24443                 } else {
24444                         let err = unsafe { o.contents.err };
24445                         unsafe { o.contents.err = core::ptr::null_mut(); }
24446                         CResult_BlindedPathDecodeErrorZPtr { err }
24447                 };
24448                 Self {
24449                         contents,
24450                         result_ok: o.result_ok,
24451                 }
24452         }
24453 }
24454 impl Clone for CResult_BlindedPathDecodeErrorZ {
24455         fn clone(&self) -> Self {
24456                 if self.result_ok {
24457                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
24458                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
24459                         } }
24460                 } else {
24461                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
24462                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24463                         } }
24464                 }
24465         }
24466 }
24467 #[no_mangle]
24468 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
24469 /// but with all dynamically-allocated buffers duplicated in new buffers.
24470 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
24471 #[repr(C)]
24472 /// The contents of CResult_BlindedHopDecodeErrorZ
24473 pub union CResult_BlindedHopDecodeErrorZPtr {
24474         /// A pointer to the contents in the success state.
24475         /// Reading from this pointer when `result_ok` is not set is undefined.
24476         pub result: *mut crate::lightning::blinded_path::BlindedHop,
24477         /// A pointer to the contents in the error state.
24478         /// Reading from this pointer when `result_ok` is set is undefined.
24479         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24480 }
24481 #[repr(C)]
24482 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
24483 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
24484 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24485 pub struct CResult_BlindedHopDecodeErrorZ {
24486         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
24487         /// `err` or `result` depending on the state of `result_ok`.
24488         pub contents: CResult_BlindedHopDecodeErrorZPtr,
24489         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
24490         pub result_ok: bool,
24491 }
24492 #[no_mangle]
24493 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
24494 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
24495         CResult_BlindedHopDecodeErrorZ {
24496                 contents: CResult_BlindedHopDecodeErrorZPtr {
24497                         result: Box::into_raw(Box::new(o)),
24498                 },
24499                 result_ok: true,
24500         }
24501 }
24502 #[no_mangle]
24503 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
24504 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
24505         CResult_BlindedHopDecodeErrorZ {
24506                 contents: CResult_BlindedHopDecodeErrorZPtr {
24507                         err: Box::into_raw(Box::new(e)),
24508                 },
24509                 result_ok: false,
24510         }
24511 }
24512 /// Checks if the given object is currently in the success state
24513 #[no_mangle]
24514 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
24515         o.result_ok
24516 }
24517 #[no_mangle]
24518 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
24519 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
24520 impl Drop for CResult_BlindedHopDecodeErrorZ {
24521         fn drop(&mut self) {
24522                 if self.result_ok {
24523                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24524                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24525                         }
24526                 } else {
24527                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24528                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24529                         }
24530                 }
24531         }
24532 }
24533 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
24534         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
24535                 let contents = if o.result_ok {
24536                         let result = unsafe { o.contents.result };
24537                         unsafe { o.contents.result = core::ptr::null_mut() };
24538                         CResult_BlindedHopDecodeErrorZPtr { result }
24539                 } else {
24540                         let err = unsafe { o.contents.err };
24541                         unsafe { o.contents.err = core::ptr::null_mut(); }
24542                         CResult_BlindedHopDecodeErrorZPtr { err }
24543                 };
24544                 Self {
24545                         contents,
24546                         result_ok: o.result_ok,
24547                 }
24548         }
24549 }
24550 impl Clone for CResult_BlindedHopDecodeErrorZ {
24551         fn clone(&self) -> Self {
24552                 if self.result_ok {
24553                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
24554                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
24555                         } }
24556                 } else {
24557                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
24558                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24559                         } }
24560                 }
24561         }
24562 }
24563 #[no_mangle]
24564 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
24565 /// but with all dynamically-allocated buffers duplicated in new buffers.
24566 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
24567 #[repr(C)]
24568 /// The contents of CResult_InvoiceErrorDecodeErrorZ
24569 pub union CResult_InvoiceErrorDecodeErrorZPtr {
24570         /// A pointer to the contents in the success state.
24571         /// Reading from this pointer when `result_ok` is not set is undefined.
24572         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
24573         /// A pointer to the contents in the error state.
24574         /// Reading from this pointer when `result_ok` is set is undefined.
24575         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24576 }
24577 #[repr(C)]
24578 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
24579 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
24580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24581 pub struct CResult_InvoiceErrorDecodeErrorZ {
24582         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
24583         /// `err` or `result` depending on the state of `result_ok`.
24584         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
24585         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
24586         pub result_ok: bool,
24587 }
24588 #[no_mangle]
24589 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
24590 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
24591         CResult_InvoiceErrorDecodeErrorZ {
24592                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
24593                         result: Box::into_raw(Box::new(o)),
24594                 },
24595                 result_ok: true,
24596         }
24597 }
24598 #[no_mangle]
24599 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
24600 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
24601         CResult_InvoiceErrorDecodeErrorZ {
24602                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
24603                         err: Box::into_raw(Box::new(e)),
24604                 },
24605                 result_ok: false,
24606         }
24607 }
24608 /// Checks if the given object is currently in the success state
24609 #[no_mangle]
24610 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
24611         o.result_ok
24612 }
24613 #[no_mangle]
24614 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
24615 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
24616 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
24617         fn drop(&mut self) {
24618                 if self.result_ok {
24619                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24620                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24621                         }
24622                 } else {
24623                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24624                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24625                         }
24626                 }
24627         }
24628 }
24629 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
24630         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
24631                 let contents = if o.result_ok {
24632                         let result = unsafe { o.contents.result };
24633                         unsafe { o.contents.result = core::ptr::null_mut() };
24634                         CResult_InvoiceErrorDecodeErrorZPtr { result }
24635                 } else {
24636                         let err = unsafe { o.contents.err };
24637                         unsafe { o.contents.err = core::ptr::null_mut(); }
24638                         CResult_InvoiceErrorDecodeErrorZPtr { err }
24639                 };
24640                 Self {
24641                         contents,
24642                         result_ok: o.result_ok,
24643                 }
24644         }
24645 }
24646 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
24647         fn clone(&self) -> Self {
24648                 if self.result_ok {
24649                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
24650                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
24651                         } }
24652                 } else {
24653                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
24654                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24655                         } }
24656                 }
24657         }
24658 }
24659 #[no_mangle]
24660 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
24661 /// but with all dynamically-allocated buffers duplicated in new buffers.
24662 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
24663 #[repr(C)]
24664 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
24665 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24666         /// A pointer to the contents in the success state.
24667         /// Reading from this pointer when `result_ok` is not set is undefined.
24668         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
24669         /// A pointer to the contents in the error state.
24670         /// Reading from this pointer when `result_ok` is set is undefined.
24671         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24672 }
24673 #[repr(C)]
24674 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
24675 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24677 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
24678         /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
24679         /// `err` or `result` depending on the state of `result_ok`.
24680         pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
24681         /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
24682         pub result_ok: bool,
24683 }
24684 #[no_mangle]
24685 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
24686 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
24687         CResult_DelayedPaymentBasepointDecodeErrorZ {
24688                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24689                         result: Box::into_raw(Box::new(o)),
24690                 },
24691                 result_ok: true,
24692         }
24693 }
24694 #[no_mangle]
24695 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
24696 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
24697         CResult_DelayedPaymentBasepointDecodeErrorZ {
24698                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24699                         err: Box::into_raw(Box::new(e)),
24700                 },
24701                 result_ok: false,
24702         }
24703 }
24704 /// Checks if the given object is currently in the success state
24705 #[no_mangle]
24706 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
24707         o.result_ok
24708 }
24709 #[no_mangle]
24710 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
24711 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
24712 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
24713         fn drop(&mut self) {
24714                 if self.result_ok {
24715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24717                         }
24718                 } else {
24719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24721                         }
24722                 }
24723         }
24724 }
24725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
24726         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24727                 let contents = if o.result_ok {
24728                         let result = unsafe { o.contents.result };
24729                         unsafe { o.contents.result = core::ptr::null_mut() };
24730                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
24731                 } else {
24732                         let err = unsafe { o.contents.err };
24733                         unsafe { o.contents.err = core::ptr::null_mut(); }
24734                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
24735                 };
24736                 Self {
24737                         contents,
24738                         result_ok: o.result_ok,
24739                 }
24740         }
24741 }
24742 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
24743         fn clone(&self) -> Self {
24744                 if self.result_ok {
24745                         Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24746                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
24747                         } }
24748                 } else {
24749                         Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24750                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24751                         } }
24752                 }
24753         }
24754 }
24755 #[no_mangle]
24756 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
24757 /// but with all dynamically-allocated buffers duplicated in new buffers.
24758 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
24759 #[repr(C)]
24760 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
24761 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
24762         /// A pointer to the contents in the success state.
24763         /// Reading from this pointer when `result_ok` is not set is undefined.
24764         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
24765         /// A pointer to the contents in the error state.
24766         /// Reading from this pointer when `result_ok` is set is undefined.
24767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24768 }
24769 #[repr(C)]
24770 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
24771 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
24772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24773 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
24774         /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
24775         /// `err` or `result` depending on the state of `result_ok`.
24776         pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
24777         /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
24778         pub result_ok: bool,
24779 }
24780 #[no_mangle]
24781 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
24782 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
24783         CResult_DelayedPaymentKeyDecodeErrorZ {
24784                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24785                         result: Box::into_raw(Box::new(o)),
24786                 },
24787                 result_ok: true,
24788         }
24789 }
24790 #[no_mangle]
24791 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
24792 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
24793         CResult_DelayedPaymentKeyDecodeErrorZ {
24794                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24795                         err: Box::into_raw(Box::new(e)),
24796                 },
24797                 result_ok: false,
24798         }
24799 }
24800 /// Checks if the given object is currently in the success state
24801 #[no_mangle]
24802 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
24803         o.result_ok
24804 }
24805 #[no_mangle]
24806 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
24807 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
24808 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
24809         fn drop(&mut self) {
24810                 if self.result_ok {
24811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24813                         }
24814                 } else {
24815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24817                         }
24818                 }
24819         }
24820 }
24821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
24822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
24823                 let contents = if o.result_ok {
24824                         let result = unsafe { o.contents.result };
24825                         unsafe { o.contents.result = core::ptr::null_mut() };
24826                         CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
24827                 } else {
24828                         let err = unsafe { o.contents.err };
24829                         unsafe { o.contents.err = core::ptr::null_mut(); }
24830                         CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
24831                 };
24832                 Self {
24833                         contents,
24834                         result_ok: o.result_ok,
24835                 }
24836         }
24837 }
24838 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
24839         fn clone(&self) -> Self {
24840                 if self.result_ok {
24841                         Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24842                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
24843                         } }
24844                 } else {
24845                         Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24847                         } }
24848                 }
24849         }
24850 }
24851 #[no_mangle]
24852 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
24853 /// but with all dynamically-allocated buffers duplicated in new buffers.
24854 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
24855 #[repr(C)]
24856 /// The contents of CResult_HtlcBasepointDecodeErrorZ
24857 pub union CResult_HtlcBasepointDecodeErrorZPtr {
24858         /// A pointer to the contents in the success state.
24859         /// Reading from this pointer when `result_ok` is not set is undefined.
24860         pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
24861         /// A pointer to the contents in the error state.
24862         /// Reading from this pointer when `result_ok` is set is undefined.
24863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24864 }
24865 #[repr(C)]
24866 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
24867 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24869 pub struct CResult_HtlcBasepointDecodeErrorZ {
24870         /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
24871         /// `err` or `result` depending on the state of `result_ok`.
24872         pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
24873         /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
24874         pub result_ok: bool,
24875 }
24876 #[no_mangle]
24877 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
24878 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
24879         CResult_HtlcBasepointDecodeErrorZ {
24880                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
24881                         result: Box::into_raw(Box::new(o)),
24882                 },
24883                 result_ok: true,
24884         }
24885 }
24886 #[no_mangle]
24887 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
24888 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
24889         CResult_HtlcBasepointDecodeErrorZ {
24890                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
24891                         err: Box::into_raw(Box::new(e)),
24892                 },
24893                 result_ok: false,
24894         }
24895 }
24896 /// Checks if the given object is currently in the success state
24897 #[no_mangle]
24898 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
24899         o.result_ok
24900 }
24901 #[no_mangle]
24902 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
24903 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
24904 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
24905         fn drop(&mut self) {
24906                 if self.result_ok {
24907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24909                         }
24910                 } else {
24911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24913                         }
24914                 }
24915         }
24916 }
24917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
24918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24919                 let contents = if o.result_ok {
24920                         let result = unsafe { o.contents.result };
24921                         unsafe { o.contents.result = core::ptr::null_mut() };
24922                         CResult_HtlcBasepointDecodeErrorZPtr { result }
24923                 } else {
24924                         let err = unsafe { o.contents.err };
24925                         unsafe { o.contents.err = core::ptr::null_mut(); }
24926                         CResult_HtlcBasepointDecodeErrorZPtr { err }
24927                 };
24928                 Self {
24929                         contents,
24930                         result_ok: o.result_ok,
24931                 }
24932         }
24933 }
24934 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
24935         fn clone(&self) -> Self {
24936                 if self.result_ok {
24937                         Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
24938                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
24939                         } }
24940                 } else {
24941                         Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
24942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24943                         } }
24944                 }
24945         }
24946 }
24947 #[no_mangle]
24948 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
24949 /// but with all dynamically-allocated buffers duplicated in new buffers.
24950 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
24951 #[repr(C)]
24952 /// The contents of CResult_HtlcKeyDecodeErrorZ
24953 pub union CResult_HtlcKeyDecodeErrorZPtr {
24954         /// A pointer to the contents in the success state.
24955         /// Reading from this pointer when `result_ok` is not set is undefined.
24956         pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
24957         /// A pointer to the contents in the error state.
24958         /// Reading from this pointer when `result_ok` is set is undefined.
24959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24960 }
24961 #[repr(C)]
24962 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
24963 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
24964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24965 pub struct CResult_HtlcKeyDecodeErrorZ {
24966         /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
24967         /// `err` or `result` depending on the state of `result_ok`.
24968         pub contents: CResult_HtlcKeyDecodeErrorZPtr,
24969         /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
24970         pub result_ok: bool,
24971 }
24972 #[no_mangle]
24973 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
24974 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
24975         CResult_HtlcKeyDecodeErrorZ {
24976                 contents: CResult_HtlcKeyDecodeErrorZPtr {
24977                         result: Box::into_raw(Box::new(o)),
24978                 },
24979                 result_ok: true,
24980         }
24981 }
24982 #[no_mangle]
24983 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
24984 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
24985         CResult_HtlcKeyDecodeErrorZ {
24986                 contents: CResult_HtlcKeyDecodeErrorZPtr {
24987                         err: Box::into_raw(Box::new(e)),
24988                 },
24989                 result_ok: false,
24990         }
24991 }
24992 /// Checks if the given object is currently in the success state
24993 #[no_mangle]
24994 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
24995         o.result_ok
24996 }
24997 #[no_mangle]
24998 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
24999 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
25000 impl Drop for CResult_HtlcKeyDecodeErrorZ {
25001         fn drop(&mut self) {
25002                 if self.result_ok {
25003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25005                         }
25006                 } else {
25007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25009                         }
25010                 }
25011         }
25012 }
25013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
25014         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
25015                 let contents = if o.result_ok {
25016                         let result = unsafe { o.contents.result };
25017                         unsafe { o.contents.result = core::ptr::null_mut() };
25018                         CResult_HtlcKeyDecodeErrorZPtr { result }
25019                 } else {
25020                         let err = unsafe { o.contents.err };
25021                         unsafe { o.contents.err = core::ptr::null_mut(); }
25022                         CResult_HtlcKeyDecodeErrorZPtr { err }
25023                 };
25024                 Self {
25025                         contents,
25026                         result_ok: o.result_ok,
25027                 }
25028         }
25029 }
25030 impl Clone for CResult_HtlcKeyDecodeErrorZ {
25031         fn clone(&self) -> Self {
25032                 if self.result_ok {
25033                         Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
25034                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
25035                         } }
25036                 } else {
25037                         Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
25038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25039                         } }
25040                 }
25041         }
25042 }
25043 #[no_mangle]
25044 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
25045 /// but with all dynamically-allocated buffers duplicated in new buffers.
25046 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
25047 #[repr(C)]
25048 /// The contents of CResult_RevocationBasepointDecodeErrorZ
25049 pub union CResult_RevocationBasepointDecodeErrorZPtr {
25050         /// A pointer to the contents in the success state.
25051         /// Reading from this pointer when `result_ok` is not set is undefined.
25052         pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
25053         /// A pointer to the contents in the error state.
25054         /// Reading from this pointer when `result_ok` is set is undefined.
25055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25056 }
25057 #[repr(C)]
25058 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
25059 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
25060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25061 pub struct CResult_RevocationBasepointDecodeErrorZ {
25062         /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
25063         /// `err` or `result` depending on the state of `result_ok`.
25064         pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
25065         /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
25066         pub result_ok: bool,
25067 }
25068 #[no_mangle]
25069 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
25070 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
25071         CResult_RevocationBasepointDecodeErrorZ {
25072                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
25073                         result: Box::into_raw(Box::new(o)),
25074                 },
25075                 result_ok: true,
25076         }
25077 }
25078 #[no_mangle]
25079 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
25080 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
25081         CResult_RevocationBasepointDecodeErrorZ {
25082                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
25083                         err: Box::into_raw(Box::new(e)),
25084                 },
25085                 result_ok: false,
25086         }
25087 }
25088 /// Checks if the given object is currently in the success state
25089 #[no_mangle]
25090 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
25091         o.result_ok
25092 }
25093 #[no_mangle]
25094 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
25095 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
25096 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
25097         fn drop(&mut self) {
25098                 if self.result_ok {
25099                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25100                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25101                         }
25102                 } else {
25103                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25104                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25105                         }
25106                 }
25107         }
25108 }
25109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
25110         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
25111                 let contents = if o.result_ok {
25112                         let result = unsafe { o.contents.result };
25113                         unsafe { o.contents.result = core::ptr::null_mut() };
25114                         CResult_RevocationBasepointDecodeErrorZPtr { result }
25115                 } else {
25116                         let err = unsafe { o.contents.err };
25117                         unsafe { o.contents.err = core::ptr::null_mut(); }
25118                         CResult_RevocationBasepointDecodeErrorZPtr { err }
25119                 };
25120                 Self {
25121                         contents,
25122                         result_ok: o.result_ok,
25123                 }
25124         }
25125 }
25126 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
25127         fn clone(&self) -> Self {
25128                 if self.result_ok {
25129                         Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
25130                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
25131                         } }
25132                 } else {
25133                         Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
25134                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25135                         } }
25136                 }
25137         }
25138 }
25139 #[no_mangle]
25140 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
25141 /// but with all dynamically-allocated buffers duplicated in new buffers.
25142 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
25143 #[repr(C)]
25144 /// The contents of CResult_RevocationKeyDecodeErrorZ
25145 pub union CResult_RevocationKeyDecodeErrorZPtr {
25146         /// A pointer to the contents in the success state.
25147         /// Reading from this pointer when `result_ok` is not set is undefined.
25148         pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
25149         /// A pointer to the contents in the error state.
25150         /// Reading from this pointer when `result_ok` is set is undefined.
25151         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25152 }
25153 #[repr(C)]
25154 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
25155 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
25156 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25157 pub struct CResult_RevocationKeyDecodeErrorZ {
25158         /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
25159         /// `err` or `result` depending on the state of `result_ok`.
25160         pub contents: CResult_RevocationKeyDecodeErrorZPtr,
25161         /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
25162         pub result_ok: bool,
25163 }
25164 #[no_mangle]
25165 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
25166 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
25167         CResult_RevocationKeyDecodeErrorZ {
25168                 contents: CResult_RevocationKeyDecodeErrorZPtr {
25169                         result: Box::into_raw(Box::new(o)),
25170                 },
25171                 result_ok: true,
25172         }
25173 }
25174 #[no_mangle]
25175 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
25176 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
25177         CResult_RevocationKeyDecodeErrorZ {
25178                 contents: CResult_RevocationKeyDecodeErrorZPtr {
25179                         err: Box::into_raw(Box::new(e)),
25180                 },
25181                 result_ok: false,
25182         }
25183 }
25184 /// Checks if the given object is currently in the success state
25185 #[no_mangle]
25186 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
25187         o.result_ok
25188 }
25189 #[no_mangle]
25190 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
25191 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
25192 impl Drop for CResult_RevocationKeyDecodeErrorZ {
25193         fn drop(&mut self) {
25194                 if self.result_ok {
25195                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25196                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25197                         }
25198                 } else {
25199                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25200                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25201                         }
25202                 }
25203         }
25204 }
25205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
25206         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
25207                 let contents = if o.result_ok {
25208                         let result = unsafe { o.contents.result };
25209                         unsafe { o.contents.result = core::ptr::null_mut() };
25210                         CResult_RevocationKeyDecodeErrorZPtr { result }
25211                 } else {
25212                         let err = unsafe { o.contents.err };
25213                         unsafe { o.contents.err = core::ptr::null_mut(); }
25214                         CResult_RevocationKeyDecodeErrorZPtr { err }
25215                 };
25216                 Self {
25217                         contents,
25218                         result_ok: o.result_ok,
25219                 }
25220         }
25221 }
25222 impl Clone for CResult_RevocationKeyDecodeErrorZ {
25223         fn clone(&self) -> Self {
25224                 if self.result_ok {
25225                         Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
25226                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
25227                         } }
25228                 } else {
25229                         Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
25230                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25231                         } }
25232                 }
25233         }
25234 }
25235 #[no_mangle]
25236 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
25237 /// but with all dynamically-allocated buffers duplicated in new buffers.
25238 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
25239 #[repr(C)]
25240 /// An enum which can either contain a crate::lightning::chain::Filter or not
25241 pub enum COption_FilterZ {
25242         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
25243         Some(crate::lightning::chain::Filter),
25244         /// When we're in this state, this COption_FilterZ contains nothing
25245         None
25246 }
25247 impl COption_FilterZ {
25248         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
25249                 if let Self::None = self { false } else { true }
25250         }
25251         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
25252                 !self.is_some()
25253         }
25254         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
25255                 if let Self::Some(v) = self { v } else { unreachable!() }
25256         }
25257 }
25258 #[no_mangle]
25259 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
25260 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
25261         COption_FilterZ::Some(o)
25262 }
25263 #[no_mangle]
25264 /// Constructs a new COption_FilterZ containing nothing
25265 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
25266         COption_FilterZ::None
25267 }
25268 #[no_mangle]
25269 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
25270 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
25271 #[repr(C)]
25272 /// The contents of CResult_LockedChannelMonitorNoneZ
25273 pub union CResult_LockedChannelMonitorNoneZPtr {
25274         /// A pointer to the contents in the success state.
25275         /// Reading from this pointer when `result_ok` is not set is undefined.
25276         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
25277         /// Note that this value is always NULL, as there are no contents in the Err variant
25278         pub err: *mut core::ffi::c_void,
25279 }
25280 #[repr(C)]
25281 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
25282 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
25283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25284 pub struct CResult_LockedChannelMonitorNoneZ {
25285         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
25286         /// `err` or `result` depending on the state of `result_ok`.
25287         pub contents: CResult_LockedChannelMonitorNoneZPtr,
25288         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
25289         pub result_ok: bool,
25290 }
25291 #[no_mangle]
25292 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
25293 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
25294         CResult_LockedChannelMonitorNoneZ {
25295                 contents: CResult_LockedChannelMonitorNoneZPtr {
25296                         result: Box::into_raw(Box::new(o)),
25297                 },
25298                 result_ok: true,
25299         }
25300 }
25301 #[no_mangle]
25302 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
25303 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
25304         CResult_LockedChannelMonitorNoneZ {
25305                 contents: CResult_LockedChannelMonitorNoneZPtr {
25306                         err: core::ptr::null_mut(),
25307                 },
25308                 result_ok: false,
25309         }
25310 }
25311 /// Checks if the given object is currently in the success state
25312 #[no_mangle]
25313 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
25314         o.result_ok
25315 }
25316 #[no_mangle]
25317 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
25318 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
25319 impl Drop for CResult_LockedChannelMonitorNoneZ {
25320         fn drop(&mut self) {
25321                 if self.result_ok {
25322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25324                         }
25325                 } else {
25326                 }
25327         }
25328 }
25329 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
25330         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
25331                 let contents = if o.result_ok {
25332                         let result = unsafe { o.contents.result };
25333                         unsafe { o.contents.result = core::ptr::null_mut() };
25334                         CResult_LockedChannelMonitorNoneZPtr { result }
25335                 } else {
25336                         let _ = unsafe { Box::from_raw(o.contents.err) };
25337                         o.contents.err = core::ptr::null_mut();
25338                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
25339                 };
25340                 Self {
25341                         contents,
25342                         result_ok: o.result_ok,
25343                 }
25344         }
25345 }
25346 #[repr(C)]
25347 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
25348 /// This corresponds to std::vector in C++
25349 pub struct CVec_OutPointZ {
25350         /// The elements in the array.
25351         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25352         pub data: *mut crate::lightning::chain::transaction::OutPoint,
25353         /// The number of elements pointed to by `data`.
25354         pub datalen: usize
25355 }
25356 impl CVec_OutPointZ {
25357         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
25358                 if self.datalen == 0 { return Vec::new(); }
25359                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25360                 self.data = core::ptr::null_mut();
25361                 self.datalen = 0;
25362                 ret
25363         }
25364         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
25365                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25366         }
25367 }
25368 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
25369         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
25370                 let datalen = v.len();
25371                 let data = Box::into_raw(v.into_boxed_slice());
25372                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25373         }
25374 }
25375 #[no_mangle]
25376 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25377 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
25378 impl Drop for CVec_OutPointZ {
25379         fn drop(&mut self) {
25380                 if self.datalen == 0 { return; }
25381                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25382         }
25383 }
25384 impl Clone for CVec_OutPointZ {
25385         fn clone(&self) -> Self {
25386                 let mut res = Vec::new();
25387                 if self.datalen == 0 { return Self::from(res); }
25388                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
25389                 Self::from(res)
25390         }
25391 }
25392 #[repr(C)]
25393 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
25394 /// This corresponds to std::vector in C++
25395 pub struct CVec_MonitorUpdateIdZ {
25396         /// The elements in the array.
25397         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25398         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
25399         /// The number of elements pointed to by `data`.
25400         pub datalen: usize
25401 }
25402 impl CVec_MonitorUpdateIdZ {
25403         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
25404                 if self.datalen == 0 { return Vec::new(); }
25405                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25406                 self.data = core::ptr::null_mut();
25407                 self.datalen = 0;
25408                 ret
25409         }
25410         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
25411                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25412         }
25413 }
25414 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
25415         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
25416                 let datalen = v.len();
25417                 let data = Box::into_raw(v.into_boxed_slice());
25418                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25419         }
25420 }
25421 #[no_mangle]
25422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25423 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
25424 impl Drop for CVec_MonitorUpdateIdZ {
25425         fn drop(&mut self) {
25426                 if self.datalen == 0 { return; }
25427                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25428         }
25429 }
25430 impl Clone for CVec_MonitorUpdateIdZ {
25431         fn clone(&self) -> Self {
25432                 let mut res = Vec::new();
25433                 if self.datalen == 0 { return Self::from(res); }
25434                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
25435                 Self::from(res)
25436         }
25437 }
25438 #[repr(C)]
25439 /// A tuple of 2 elements. See the individual fields for the types contained.
25440 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25441         /// The element at position 0
25442         pub a: crate::lightning::chain::transaction::OutPoint,
25443         /// The element at position 1
25444         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
25445 }
25446 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25447         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
25448                 Self {
25449                         a: tup.0,
25450                         b: tup.1,
25451                 }
25452         }
25453 }
25454 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25455         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
25456                 (self.a, self.b)
25457         }
25458 }
25459 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25460         fn clone(&self) -> Self {
25461                 Self {
25462                         a: Clone::clone(&self.a),
25463                         b: Clone::clone(&self.b),
25464                 }
25465         }
25466 }
25467 #[no_mangle]
25468 /// Creates a new tuple which has the same data as `orig`
25469 /// but with all dynamically-allocated buffers duplicated in new buffers.
25470 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
25471 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
25472 #[no_mangle]
25473 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25474         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
25475 }
25476
25477 #[no_mangle]
25478 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
25479 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
25480 #[repr(C)]
25481 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
25482 /// This corresponds to std::vector in C++
25483 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25484         /// The elements in the array.
25485         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25486         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
25487         /// The number of elements pointed to by `data`.
25488         pub datalen: usize
25489 }
25490 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25491         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
25492                 if self.datalen == 0 { return Vec::new(); }
25493                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25494                 self.data = core::ptr::null_mut();
25495                 self.datalen = 0;
25496                 ret
25497         }
25498         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
25499                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25500         }
25501 }
25502 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25503         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
25504                 let datalen = v.len();
25505                 let data = Box::into_raw(v.into_boxed_slice());
25506                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25507         }
25508 }
25509 #[no_mangle]
25510 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25511 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
25512 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25513         fn drop(&mut self) {
25514                 if self.datalen == 0 { return; }
25515                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25516         }
25517 }
25518 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25519         fn clone(&self) -> Self {
25520                 let mut res = Vec::new();
25521                 if self.datalen == 0 { return Self::from(res); }
25522                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
25523                 Self::from(res)
25524         }
25525 }