Update auto-generated bindings to LDK 0.0.123
[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 /// A dynamically-allocated array of u8s of arbitrary size.
13 /// This corresponds to std::vector in C++
14 pub struct CVec_u8Z {
15         /// The elements in the array.
16         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17         pub data: *mut u8,
18         /// The number of elements pointed to by `data`.
19         pub datalen: usize
20 }
21 impl CVec_u8Z {
22         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
23                 if self.datalen == 0 { return Vec::new(); }
24                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25                 self.data = core::ptr::null_mut();
26                 self.datalen = 0;
27                 ret
28         }
29         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
30                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
31         }
32 }
33 impl From<Vec<u8>> for CVec_u8Z {
34         fn from(v: Vec<u8>) -> Self {
35                 let datalen = v.len();
36                 let data = Box::into_raw(v.into_boxed_slice());
37                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
38         }
39 }
40 #[no_mangle]
41 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
42 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
43 impl Drop for CVec_u8Z {
44         fn drop(&mut self) {
45                 if self.datalen == 0 { return; }
46                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
47         }
48 }
49 impl Clone for CVec_u8Z {
50         fn clone(&self) -> Self {
51                 let mut res = Vec::new();
52                 if self.datalen == 0 { return Self::from(res); }
53                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
54                 Self::from(res)
55         }
56 }
57 #[repr(C)]
58 /// The contents of CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ
59 pub union CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
60         /// A pointer to the contents in the success state.
61         /// Reading from this pointer when `result_ok` is not set is undefined.
62         pub result: *mut crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder,
63         /// A pointer to the contents in the error state.
64         /// Reading from this pointer when `result_ok` is set is undefined.
65         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
66 }
67 #[repr(C)]
68 /// A CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
69 /// containing a crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
70 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
71 pub struct CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
72         /// The contents of this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
73         /// `err` or `result` depending on the state of `result_ok`.
74         pub contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
75         /// Whether this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
76         pub result_ok: bool,
77 }
78 #[no_mangle]
79 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
80 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
81         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
82                 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
83                         result: Box::into_raw(Box::new(o)),
84                 },
85                 result_ok: true,
86         }
87 }
88 #[no_mangle]
89 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
90 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
91         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
92                 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
93                         err: Box::into_raw(Box::new(e)),
94                 },
95                 result_ok: false,
96         }
97 }
98 /// Checks if the given object is currently in the success state
99 #[no_mangle]
100 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
101         o.result_ok
102 }
103 #[no_mangle]
104 /// Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ.
105 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
106 impl Drop for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
107         fn drop(&mut self) {
108                 if self.result_ok {
109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
111                         }
112                 } else {
113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
115                         }
116                 }
117         }
118 }
119 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
121                 let contents = if o.result_ok {
122                         let result = unsafe { o.contents.result };
123                         unsafe { o.contents.result = core::ptr::null_mut() };
124                         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
125                 } else {
126                         let err = unsafe { o.contents.err };
127                         unsafe { o.contents.err = core::ptr::null_mut(); }
128                         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
129                 };
130                 Self {
131                         contents,
132                         result_ok: o.result_ok,
133                 }
134         }
135 }
136 #[repr(C)]
137 /// The contents of CResult_RefundBolt12SemanticErrorZ
138 pub union CResult_RefundBolt12SemanticErrorZPtr {
139         /// A pointer to the contents in the success state.
140         /// Reading from this pointer when `result_ok` is not set is undefined.
141         pub result: *mut crate::lightning::offers::refund::Refund,
142         /// A pointer to the contents in the error state.
143         /// Reading from this pointer when `result_ok` is set is undefined.
144         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
145 }
146 #[repr(C)]
147 /// A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation,
148 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
150 pub struct CResult_RefundBolt12SemanticErrorZ {
151         /// The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either
152         /// `err` or `result` depending on the state of `result_ok`.
153         pub contents: CResult_RefundBolt12SemanticErrorZPtr,
154         /// Whether this CResult_RefundBolt12SemanticErrorZ represents a success state.
155         pub result_ok: bool,
156 }
157 #[no_mangle]
158 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the success state.
159 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12SemanticErrorZ {
160         CResult_RefundBolt12SemanticErrorZ {
161                 contents: CResult_RefundBolt12SemanticErrorZPtr {
162                         result: Box::into_raw(Box::new(o)),
163                 },
164                 result_ok: true,
165         }
166 }
167 #[no_mangle]
168 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the error state.
169 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundBolt12SemanticErrorZ {
170         CResult_RefundBolt12SemanticErrorZ {
171                 contents: CResult_RefundBolt12SemanticErrorZPtr {
172                         err: Box::into_raw(Box::new(e)),
173                 },
174                 result_ok: false,
175         }
176 }
177 /// Checks if the given object is currently in the success state
178 #[no_mangle]
179 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_is_ok(o: &CResult_RefundBolt12SemanticErrorZ) -> bool {
180         o.result_ok
181 }
182 #[no_mangle]
183 /// Frees any resources used by the CResult_RefundBolt12SemanticErrorZ.
184 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_free(_res: CResult_RefundBolt12SemanticErrorZ) { }
185 impl Drop for CResult_RefundBolt12SemanticErrorZ {
186         fn drop(&mut self) {
187                 if self.result_ok {
188                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
189                                 let _ = unsafe { Box::from_raw(self.contents.result) };
190                         }
191                 } else {
192                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
193                                 let _ = unsafe { Box::from_raw(self.contents.err) };
194                         }
195                 }
196         }
197 }
198 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundBolt12SemanticErrorZ {
199         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
200                 let contents = if o.result_ok {
201                         let result = unsafe { o.contents.result };
202                         unsafe { o.contents.result = core::ptr::null_mut() };
203                         CResult_RefundBolt12SemanticErrorZPtr { result }
204                 } else {
205                         let err = unsafe { o.contents.err };
206                         unsafe { o.contents.err = core::ptr::null_mut(); }
207                         CResult_RefundBolt12SemanticErrorZPtr { err }
208                 };
209                 Self {
210                         contents,
211                         result_ok: o.result_ok,
212                 }
213         }
214 }
215 impl Clone for CResult_RefundBolt12SemanticErrorZ {
216         fn clone(&self) -> Self {
217                 if self.result_ok {
218                         Self { result_ok: true, contents: CResult_RefundBolt12SemanticErrorZPtr {
219                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
220                         } }
221                 } else {
222                         Self { result_ok: false, contents: CResult_RefundBolt12SemanticErrorZPtr {
223                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
224                         } }
225                 }
226         }
227 }
228 #[no_mangle]
229 /// Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig`
230 /// but with all dynamically-allocated buffers duplicated in new buffers.
231 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_clone(orig: &CResult_RefundBolt12SemanticErrorZ) -> CResult_RefundBolt12SemanticErrorZ { Clone::clone(&orig) }
232 #[repr(C)]
233 #[derive(Clone)]
234 /// An enum which can either contain a u64 or not
235 pub enum COption_u64Z {
236         /// When we're in this state, this COption_u64Z contains a u64
237         Some(u64),
238         /// When we're in this state, this COption_u64Z contains nothing
239         None
240 }
241 impl COption_u64Z {
242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
243                 if let Self::None = self { false } else { true }
244         }
245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
246                 !self.is_some()
247         }
248         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
249                 if let Self::Some(v) = self { v } else { unreachable!() }
250         }
251 }
252 #[no_mangle]
253 /// Constructs a new COption_u64Z containing a u64
254 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
255         COption_u64Z::Some(o)
256 }
257 #[no_mangle]
258 /// Constructs a new COption_u64Z containing nothing
259 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
260         COption_u64Z::None
261 }
262 #[no_mangle]
263 /// Frees any resources associated with the u64, if we are in the Some state
264 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
265 #[no_mangle]
266 /// Creates a new COption_u64Z which has the same data as `orig`
267 /// but with all dynamically-allocated buffers duplicated in new buffers.
268 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
269 #[repr(C)]
270 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
271 /// This corresponds to std::vector in C++
272 pub struct CVec_BlindedPathZ {
273         /// The elements in the array.
274         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
275         pub data: *mut crate::lightning::blinded_path::BlindedPath,
276         /// The number of elements pointed to by `data`.
277         pub datalen: usize
278 }
279 impl CVec_BlindedPathZ {
280         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
281                 if self.datalen == 0 { return Vec::new(); }
282                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
283                 self.data = core::ptr::null_mut();
284                 self.datalen = 0;
285                 ret
286         }
287         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
288                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
289         }
290 }
291 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
292         fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
293                 let datalen = v.len();
294                 let data = Box::into_raw(v.into_boxed_slice());
295                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
296         }
297 }
298 #[no_mangle]
299 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
300 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
301 impl Drop for CVec_BlindedPathZ {
302         fn drop(&mut self) {
303                 if self.datalen == 0 { return; }
304                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
305         }
306 }
307 impl Clone for CVec_BlindedPathZ {
308         fn clone(&self) -> Self {
309                 let mut res = Vec::new();
310                 if self.datalen == 0 { return Self::from(res); }
311                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
312                 Self::from(res)
313         }
314 }
315 #[repr(C)]
316 /// The contents of CResult_RefundBolt12ParseErrorZ
317 pub union CResult_RefundBolt12ParseErrorZPtr {
318         /// A pointer to the contents in the success state.
319         /// Reading from this pointer when `result_ok` is not set is undefined.
320         pub result: *mut crate::lightning::offers::refund::Refund,
321         /// A pointer to the contents in the error state.
322         /// Reading from this pointer when `result_ok` is set is undefined.
323         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
324 }
325 #[repr(C)]
326 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
327 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
329 pub struct CResult_RefundBolt12ParseErrorZ {
330         /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
331         /// `err` or `result` depending on the state of `result_ok`.
332         pub contents: CResult_RefundBolt12ParseErrorZPtr,
333         /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
334         pub result_ok: bool,
335 }
336 #[no_mangle]
337 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
338 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
339         CResult_RefundBolt12ParseErrorZ {
340                 contents: CResult_RefundBolt12ParseErrorZPtr {
341                         result: Box::into_raw(Box::new(o)),
342                 },
343                 result_ok: true,
344         }
345 }
346 #[no_mangle]
347 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
348 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
349         CResult_RefundBolt12ParseErrorZ {
350                 contents: CResult_RefundBolt12ParseErrorZPtr {
351                         err: Box::into_raw(Box::new(e)),
352                 },
353                 result_ok: false,
354         }
355 }
356 /// Checks if the given object is currently in the success state
357 #[no_mangle]
358 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
359         o.result_ok
360 }
361 #[no_mangle]
362 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
363 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
364 impl Drop for CResult_RefundBolt12ParseErrorZ {
365         fn drop(&mut self) {
366                 if self.result_ok {
367                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
368                                 let _ = unsafe { Box::from_raw(self.contents.result) };
369                         }
370                 } else {
371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
373                         }
374                 }
375         }
376 }
377 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
378         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
379                 let contents = if o.result_ok {
380                         let result = unsafe { o.contents.result };
381                         unsafe { o.contents.result = core::ptr::null_mut() };
382                         CResult_RefundBolt12ParseErrorZPtr { result }
383                 } else {
384                         let err = unsafe { o.contents.err };
385                         unsafe { o.contents.err = core::ptr::null_mut(); }
386                         CResult_RefundBolt12ParseErrorZPtr { err }
387                 };
388                 Self {
389                         contents,
390                         result_ok: o.result_ok,
391                 }
392         }
393 }
394 impl Clone for CResult_RefundBolt12ParseErrorZ {
395         fn clone(&self) -> Self {
396                 if self.result_ok {
397                         Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
398                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
399                         } }
400                 } else {
401                         Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
402                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
403                         } }
404                 }
405         }
406 }
407 #[no_mangle]
408 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
409 /// but with all dynamically-allocated buffers duplicated in new buffers.
410 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
411 #[repr(C)]
412 /// The contents of CResult_RetryDecodeErrorZ
413 pub union CResult_RetryDecodeErrorZPtr {
414         /// A pointer to the contents in the success state.
415         /// Reading from this pointer when `result_ok` is not set is undefined.
416         pub result: *mut crate::lightning::ln::outbound_payment::Retry,
417         /// A pointer to the contents in the error state.
418         /// Reading from this pointer when `result_ok` is set is undefined.
419         pub err: *mut crate::lightning::ln::msgs::DecodeError,
420 }
421 #[repr(C)]
422 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
423 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
425 pub struct CResult_RetryDecodeErrorZ {
426         /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
427         /// `err` or `result` depending on the state of `result_ok`.
428         pub contents: CResult_RetryDecodeErrorZPtr,
429         /// Whether this CResult_RetryDecodeErrorZ represents a success state.
430         pub result_ok: bool,
431 }
432 #[no_mangle]
433 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
434 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
435         CResult_RetryDecodeErrorZ {
436                 contents: CResult_RetryDecodeErrorZPtr {
437                         result: Box::into_raw(Box::new(o)),
438                 },
439                 result_ok: true,
440         }
441 }
442 #[no_mangle]
443 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
444 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
445         CResult_RetryDecodeErrorZ {
446                 contents: CResult_RetryDecodeErrorZPtr {
447                         err: Box::into_raw(Box::new(e)),
448                 },
449                 result_ok: false,
450         }
451 }
452 /// Checks if the given object is currently in the success state
453 #[no_mangle]
454 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
455         o.result_ok
456 }
457 #[no_mangle]
458 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
459 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
460 impl Drop for CResult_RetryDecodeErrorZ {
461         fn drop(&mut self) {
462                 if self.result_ok {
463                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
464                                 let _ = unsafe { Box::from_raw(self.contents.result) };
465                         }
466                 } else {
467                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
468                                 let _ = unsafe { Box::from_raw(self.contents.err) };
469                         }
470                 }
471         }
472 }
473 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
474         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
475                 let contents = if o.result_ok {
476                         let result = unsafe { o.contents.result };
477                         unsafe { o.contents.result = core::ptr::null_mut() };
478                         CResult_RetryDecodeErrorZPtr { result }
479                 } else {
480                         let err = unsafe { o.contents.err };
481                         unsafe { o.contents.err = core::ptr::null_mut(); }
482                         CResult_RetryDecodeErrorZPtr { err }
483                 };
484                 Self {
485                         contents,
486                         result_ok: o.result_ok,
487                 }
488         }
489 }
490 impl Clone for CResult_RetryDecodeErrorZ {
491         fn clone(&self) -> Self {
492                 if self.result_ok {
493                         Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
494                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
495                         } }
496                 } else {
497                         Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
498                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
499                         } }
500                 }
501         }
502 }
503 #[no_mangle]
504 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
505 /// but with all dynamically-allocated buffers duplicated in new buffers.
506 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
507 #[repr(C)]
508 /// The contents of CResult_NoneAPIErrorZ
509 pub union CResult_NoneAPIErrorZPtr {
510         /// Note that this value is always NULL, as there are no contents in the OK variant
511         pub result: *mut core::ffi::c_void,
512         /// A pointer to the contents in the error state.
513         /// Reading from this pointer when `result_ok` is set is undefined.
514         pub err: *mut crate::lightning::util::errors::APIError,
515 }
516 #[repr(C)]
517 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
518 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
520 pub struct CResult_NoneAPIErrorZ {
521         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
522         /// `err` or `result` depending on the state of `result_ok`.
523         pub contents: CResult_NoneAPIErrorZPtr,
524         /// Whether this CResult_NoneAPIErrorZ represents a success state.
525         pub result_ok: bool,
526 }
527 #[no_mangle]
528 /// Creates a new CResult_NoneAPIErrorZ in the success state.
529 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
530         CResult_NoneAPIErrorZ {
531                 contents: CResult_NoneAPIErrorZPtr {
532                         result: core::ptr::null_mut(),
533                 },
534                 result_ok: true,
535         }
536 }
537 #[no_mangle]
538 /// Creates a new CResult_NoneAPIErrorZ in the error state.
539 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
540         CResult_NoneAPIErrorZ {
541                 contents: CResult_NoneAPIErrorZPtr {
542                         err: Box::into_raw(Box::new(e)),
543                 },
544                 result_ok: false,
545         }
546 }
547 /// Checks if the given object is currently in the success state
548 #[no_mangle]
549 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
550         o.result_ok
551 }
552 #[no_mangle]
553 /// Frees any resources used by the CResult_NoneAPIErrorZ.
554 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
555 impl Drop for CResult_NoneAPIErrorZ {
556         fn drop(&mut self) {
557                 if self.result_ok {
558                 } else {
559                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
560                                 let _ = unsafe { Box::from_raw(self.contents.err) };
561                         }
562                 }
563         }
564 }
565 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
566         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
567                 let contents = if o.result_ok {
568                         let _ = unsafe { Box::from_raw(o.contents.result) };
569                         o.contents.result = core::ptr::null_mut();
570                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
571                 } else {
572                         let err = unsafe { o.contents.err };
573                         unsafe { o.contents.err = core::ptr::null_mut(); }
574                         CResult_NoneAPIErrorZPtr { err }
575                 };
576                 Self {
577                         contents,
578                         result_ok: o.result_ok,
579                 }
580         }
581 }
582 impl Clone for CResult_NoneAPIErrorZ {
583         fn clone(&self) -> Self {
584                 if self.result_ok {
585                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
586                                 result: core::ptr::null_mut()
587                         } }
588                 } else {
589                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
590                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
591                         } }
592                 }
593         }
594 }
595 #[no_mangle]
596 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
597 /// but with all dynamically-allocated buffers duplicated in new buffers.
598 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
599 #[repr(C)]
600 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
601 /// This corresponds to std::vector in C++
602 pub struct CVec_CResult_NoneAPIErrorZZ {
603         /// The elements in the array.
604         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
605         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
606         /// The number of elements pointed to by `data`.
607         pub datalen: usize
608 }
609 impl CVec_CResult_NoneAPIErrorZZ {
610         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
611                 if self.datalen == 0 { return Vec::new(); }
612                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
613                 self.data = core::ptr::null_mut();
614                 self.datalen = 0;
615                 ret
616         }
617         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
618                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
619         }
620 }
621 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
622         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
623                 let datalen = v.len();
624                 let data = Box::into_raw(v.into_boxed_slice());
625                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
626         }
627 }
628 #[no_mangle]
629 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
630 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
631 impl Drop for CVec_CResult_NoneAPIErrorZZ {
632         fn drop(&mut self) {
633                 if self.datalen == 0 { return; }
634                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
635         }
636 }
637 impl Clone for CVec_CResult_NoneAPIErrorZZ {
638         fn clone(&self) -> Self {
639                 let mut res = Vec::new();
640                 if self.datalen == 0 { return Self::from(res); }
641                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
642                 Self::from(res)
643         }
644 }
645 #[repr(C)]
646 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
647 /// This corresponds to std::vector in C++
648 pub struct CVec_APIErrorZ {
649         /// The elements in the array.
650         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
651         pub data: *mut crate::lightning::util::errors::APIError,
652         /// The number of elements pointed to by `data`.
653         pub datalen: usize
654 }
655 impl CVec_APIErrorZ {
656         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
657                 if self.datalen == 0 { return Vec::new(); }
658                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
659                 self.data = core::ptr::null_mut();
660                 self.datalen = 0;
661                 ret
662         }
663         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
664                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
665         }
666 }
667 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
668         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
669                 let datalen = v.len();
670                 let data = Box::into_raw(v.into_boxed_slice());
671                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
672         }
673 }
674 #[no_mangle]
675 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
676 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
677 impl Drop for CVec_APIErrorZ {
678         fn drop(&mut self) {
679                 if self.datalen == 0 { return; }
680                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
681         }
682 }
683 impl Clone for CVec_APIErrorZ {
684         fn clone(&self) -> Self {
685                 let mut res = Vec::new();
686                 if self.datalen == 0 { return Self::from(res); }
687                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
688                 Self::from(res)
689         }
690 }
691 #[repr(C)]
692 #[derive(Clone)]
693 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
694 pub enum COption_ThirtyTwoBytesZ {
695         /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
696         Some(crate::c_types::ThirtyTwoBytes),
697         /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
698         None
699 }
700 impl COption_ThirtyTwoBytesZ {
701         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
702                 if let Self::None = self { false } else { true }
703         }
704         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
705                 !self.is_some()
706         }
707         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
708                 if let Self::Some(v) = self { v } else { unreachable!() }
709         }
710 }
711 #[no_mangle]
712 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
713 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
714         COption_ThirtyTwoBytesZ::Some(o)
715 }
716 #[no_mangle]
717 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
718 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
719         COption_ThirtyTwoBytesZ::None
720 }
721 #[no_mangle]
722 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
723 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
724 #[no_mangle]
725 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
726 /// but with all dynamically-allocated buffers duplicated in new buffers.
727 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
728 #[repr(C)]
729 #[derive(Clone)]
730 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
731 pub enum COption_CVec_u8ZZ {
732         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
733         Some(crate::c_types::derived::CVec_u8Z),
734         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
735         None
736 }
737 impl COption_CVec_u8ZZ {
738         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
739                 if let Self::None = self { false } else { true }
740         }
741         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
742                 !self.is_some()
743         }
744         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
745                 if let Self::Some(v) = self { v } else { unreachable!() }
746         }
747 }
748 #[no_mangle]
749 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
750 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
751         COption_CVec_u8ZZ::Some(o)
752 }
753 #[no_mangle]
754 /// Constructs a new COption_CVec_u8ZZ containing nothing
755 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
756         COption_CVec_u8ZZ::None
757 }
758 #[no_mangle]
759 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
760 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
761 #[no_mangle]
762 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
763 /// but with all dynamically-allocated buffers duplicated in new buffers.
764 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
765 #[repr(C)]
766 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
767 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
768         /// A pointer to the contents in the success state.
769         /// Reading from this pointer when `result_ok` is not set is undefined.
770         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
771         /// A pointer to the contents in the error state.
772         /// Reading from this pointer when `result_ok` is set is undefined.
773         pub err: *mut crate::lightning::ln::msgs::DecodeError,
774 }
775 #[repr(C)]
776 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
777 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
779 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
780         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
781         /// `err` or `result` depending on the state of `result_ok`.
782         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
783         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
784         pub result_ok: bool,
785 }
786 #[no_mangle]
787 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
788 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
789         CResult_RecipientOnionFieldsDecodeErrorZ {
790                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
791                         result: Box::into_raw(Box::new(o)),
792                 },
793                 result_ok: true,
794         }
795 }
796 #[no_mangle]
797 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
798 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
799         CResult_RecipientOnionFieldsDecodeErrorZ {
800                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
801                         err: Box::into_raw(Box::new(e)),
802                 },
803                 result_ok: false,
804         }
805 }
806 /// Checks if the given object is currently in the success state
807 #[no_mangle]
808 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
809         o.result_ok
810 }
811 #[no_mangle]
812 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
813 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
814 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
815         fn drop(&mut self) {
816                 if self.result_ok {
817                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
818                                 let _ = unsafe { Box::from_raw(self.contents.result) };
819                         }
820                 } else {
821                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
822                                 let _ = unsafe { Box::from_raw(self.contents.err) };
823                         }
824                 }
825         }
826 }
827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
828         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
829                 let contents = if o.result_ok {
830                         let result = unsafe { o.contents.result };
831                         unsafe { o.contents.result = core::ptr::null_mut() };
832                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
833                 } else {
834                         let err = unsafe { o.contents.err };
835                         unsafe { o.contents.err = core::ptr::null_mut(); }
836                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
837                 };
838                 Self {
839                         contents,
840                         result_ok: o.result_ok,
841                 }
842         }
843 }
844 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
845         fn clone(&self) -> Self {
846                 if self.result_ok {
847                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
848                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
849                         } }
850                 } else {
851                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
852                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
853                         } }
854                 }
855         }
856 }
857 #[no_mangle]
858 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
859 /// but with all dynamically-allocated buffers duplicated in new buffers.
860 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
861 #[repr(C)]
862 /// A tuple of 2 elements. See the individual fields for the types contained.
863 pub struct C2Tuple_u64CVec_u8ZZ {
864         /// The element at position 0
865         pub a: u64,
866         /// The element at position 1
867         pub b: crate::c_types::derived::CVec_u8Z,
868 }
869 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
870         fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
871                 Self {
872                         a: tup.0,
873                         b: tup.1,
874                 }
875         }
876 }
877 impl C2Tuple_u64CVec_u8ZZ {
878         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
879                 (self.a, self.b)
880         }
881 }
882 impl Clone for C2Tuple_u64CVec_u8ZZ {
883         fn clone(&self) -> Self {
884                 Self {
885                         a: Clone::clone(&self.a),
886                         b: Clone::clone(&self.b),
887                 }
888         }
889 }
890 #[no_mangle]
891 /// Creates a new tuple which has the same data as `orig`
892 /// but with all dynamically-allocated buffers duplicated in new buffers.
893 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
894 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
895 #[no_mangle]
896 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
897         C2Tuple_u64CVec_u8ZZ { a, b, }
898 }
899
900 #[no_mangle]
901 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
902 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
903 #[repr(C)]
904 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
905 /// This corresponds to std::vector in C++
906 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
907         /// The elements in the array.
908         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
909         pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
910         /// The number of elements pointed to by `data`.
911         pub datalen: usize
912 }
913 impl CVec_C2Tuple_u64CVec_u8ZZZ {
914         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
915                 if self.datalen == 0 { return Vec::new(); }
916                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
917                 self.data = core::ptr::null_mut();
918                 self.datalen = 0;
919                 ret
920         }
921         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
922                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
923         }
924 }
925 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
926         fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
927                 let datalen = v.len();
928                 let data = Box::into_raw(v.into_boxed_slice());
929                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
930         }
931 }
932 #[no_mangle]
933 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
934 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
935 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
936         fn drop(&mut self) {
937                 if self.datalen == 0 { return; }
938                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
939         }
940 }
941 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
942         fn clone(&self) -> Self {
943                 let mut res = Vec::new();
944                 if self.datalen == 0 { return Self::from(res); }
945                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
946                 Self::from(res)
947         }
948 }
949 #[repr(C)]
950 /// The contents of CResult_RecipientOnionFieldsNoneZ
951 pub union CResult_RecipientOnionFieldsNoneZPtr {
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::lightning::ln::outbound_payment::RecipientOnionFields,
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_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
960 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
962 pub struct CResult_RecipientOnionFieldsNoneZ {
963         /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
964         /// `err` or `result` depending on the state of `result_ok`.
965         pub contents: CResult_RecipientOnionFieldsNoneZPtr,
966         /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
967         pub result_ok: bool,
968 }
969 #[no_mangle]
970 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
971 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
972         CResult_RecipientOnionFieldsNoneZ {
973                 contents: CResult_RecipientOnionFieldsNoneZPtr {
974                         result: Box::into_raw(Box::new(o)),
975                 },
976                 result_ok: true,
977         }
978 }
979 #[no_mangle]
980 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
981 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
982         CResult_RecipientOnionFieldsNoneZ {
983                 contents: CResult_RecipientOnionFieldsNoneZPtr {
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_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
992         o.result_ok
993 }
994 #[no_mangle]
995 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
996 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
997 impl Drop for CResult_RecipientOnionFieldsNoneZ {
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::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
1008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> 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_RecipientOnionFieldsNoneZPtr { result }
1013                 } else {
1014                         let _ = unsafe { Box::from_raw(o.contents.err) };
1015                         o.contents.err = core::ptr::null_mut();
1016                         CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
1017                 };
1018                 Self {
1019                         contents,
1020                         result_ok: o.result_ok,
1021                 }
1022         }
1023 }
1024 impl Clone for CResult_RecipientOnionFieldsNoneZ {
1025         fn clone(&self) -> Self {
1026                 if self.result_ok {
1027                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
1028                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
1029                         } }
1030                 } else {
1031                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
1032                                 err: core::ptr::null_mut()
1033                         } }
1034                 }
1035         }
1036 }
1037 #[no_mangle]
1038 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
1039 /// but with all dynamically-allocated buffers duplicated in new buffers.
1040 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
1041 #[repr(C)]
1042 /// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ
1043 pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
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::UnsignedBolt12Invoice,
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::offers::parse::Bolt12SemanticError,
1050 }
1051 #[repr(C)]
1052 /// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1053 /// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1055 pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1056         /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either
1057         /// `err` or `result` depending on the state of `result_ok`.
1058         pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr,
1059         /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state.
1060         pub result_ok: bool,
1061 }
1062 #[no_mangle]
1063 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state.
1064 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1065         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1066                 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1067                         result: Box::into_raw(Box::new(o)),
1068                 },
1069                 result_ok: true,
1070         }
1071 }
1072 #[no_mangle]
1073 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state.
1074 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1075         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1076                 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
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_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool {
1085         o.result_ok
1086 }
1087 #[no_mangle]
1088 /// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ.
1089 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { }
1090 impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
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::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> 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_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result }
1109                 } else {
1110                         let err = unsafe { o.contents.err };
1111                         unsafe { o.contents.err = core::ptr::null_mut(); }
1112                         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err }
1113                 };
1114                 Self {
1115                         contents,
1116                         result_ok: o.result_ok,
1117                 }
1118         }
1119 }
1120 #[repr(C)]
1121 /// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ
1122 pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1123         /// A pointer to the contents in the success state.
1124         /// Reading from this pointer when `result_ok` is not set is undefined.
1125         pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice,
1126         /// A pointer to the contents in the error state.
1127         /// Reading from this pointer when `result_ok` is set is undefined.
1128         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1129 }
1130 #[repr(C)]
1131 /// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1132 /// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1133 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1134 pub struct CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1135         /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either
1136         /// `err` or `result` depending on the state of `result_ok`.
1137         pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr,
1138         /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state.
1139         pub result_ok: bool,
1140 }
1141 #[no_mangle]
1142 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state.
1143 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1144         CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1145                 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1146                         result: Box::into_raw(Box::new(o)),
1147                 },
1148                 result_ok: true,
1149         }
1150 }
1151 #[no_mangle]
1152 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state.
1153 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1154         CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1155                 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1156                         err: Box::into_raw(Box::new(e)),
1157                 },
1158                 result_ok: false,
1159         }
1160 }
1161 /// Checks if the given object is currently in the success state
1162 #[no_mangle]
1163 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool {
1164         o.result_ok
1165 }
1166 #[no_mangle]
1167 /// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ.
1168 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { }
1169 impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1170         fn drop(&mut self) {
1171                 if self.result_ok {
1172                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1173                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1174                         }
1175                 } else {
1176                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1177                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1178                         }
1179                 }
1180         }
1181 }
1182 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1183         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1184                 let contents = if o.result_ok {
1185                         let result = unsafe { o.contents.result };
1186                         unsafe { o.contents.result = core::ptr::null_mut() };
1187                         CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result }
1188                 } else {
1189                         let err = unsafe { o.contents.err };
1190                         unsafe { o.contents.err = core::ptr::null_mut(); }
1191                         CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err }
1192                 };
1193                 Self {
1194                         contents,
1195                         result_ok: o.result_ok,
1196                 }
1197         }
1198 }
1199 impl Clone for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1200         fn clone(&self) -> Self {
1201                 if self.result_ok {
1202                         Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1203                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::Bolt12Invoice>::clone(unsafe { &*self.contents.result })))
1204                         } }
1205                 } else {
1206                         Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1207                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1208                         } }
1209                 }
1210         }
1211 }
1212 #[no_mangle]
1213 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1214 /// but with all dynamically-allocated buffers duplicated in new buffers.
1215 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1216 #[repr(C)]
1217 /// The contents of CResult_SchnorrSignatureNoneZ
1218 pub union CResult_SchnorrSignatureNoneZPtr {
1219         /// A pointer to the contents in the success state.
1220         /// Reading from this pointer when `result_ok` is not set is undefined.
1221         pub result: *mut crate::c_types::SchnorrSignature,
1222         /// Note that this value is always NULL, as there are no contents in the Err variant
1223         pub err: *mut core::ffi::c_void,
1224 }
1225 #[repr(C)]
1226 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
1227 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
1228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1229 pub struct CResult_SchnorrSignatureNoneZ {
1230         /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
1231         /// `err` or `result` depending on the state of `result_ok`.
1232         pub contents: CResult_SchnorrSignatureNoneZPtr,
1233         /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
1234         pub result_ok: bool,
1235 }
1236 #[no_mangle]
1237 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
1238 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
1239         CResult_SchnorrSignatureNoneZ {
1240                 contents: CResult_SchnorrSignatureNoneZPtr {
1241                         result: Box::into_raw(Box::new(o)),
1242                 },
1243                 result_ok: true,
1244         }
1245 }
1246 #[no_mangle]
1247 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
1248 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
1249         CResult_SchnorrSignatureNoneZ {
1250                 contents: CResult_SchnorrSignatureNoneZPtr {
1251                         err: core::ptr::null_mut(),
1252                 },
1253                 result_ok: false,
1254         }
1255 }
1256 /// Checks if the given object is currently in the success state
1257 #[no_mangle]
1258 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
1259         o.result_ok
1260 }
1261 #[no_mangle]
1262 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
1263 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
1264 impl Drop for CResult_SchnorrSignatureNoneZ {
1265         fn drop(&mut self) {
1266                 if self.result_ok {
1267                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1268                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1269                         }
1270                 } else {
1271                 }
1272         }
1273 }
1274 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
1275         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
1276                 let contents = if o.result_ok {
1277                         let result = unsafe { o.contents.result };
1278                         unsafe { o.contents.result = core::ptr::null_mut() };
1279                         CResult_SchnorrSignatureNoneZPtr { result }
1280                 } else {
1281                         let _ = unsafe { Box::from_raw(o.contents.err) };
1282                         o.contents.err = core::ptr::null_mut();
1283                         CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
1284                 };
1285                 Self {
1286                         contents,
1287                         result_ok: o.result_ok,
1288                 }
1289         }
1290 }
1291 impl Clone for CResult_SchnorrSignatureNoneZ {
1292         fn clone(&self) -> Self {
1293                 if self.result_ok {
1294                         Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
1295                                 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
1296                         } }
1297                 } else {
1298                         Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
1299                                 err: core::ptr::null_mut()
1300                         } }
1301                 }
1302         }
1303 }
1304 #[no_mangle]
1305 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
1306 /// but with all dynamically-allocated buffers duplicated in new buffers.
1307 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
1308 #[repr(C)]
1309 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1310 /// This corresponds to std::vector in C++
1311 pub struct CVec_ThirtyTwoBytesZ {
1312         /// The elements in the array.
1313         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1314         pub data: *mut crate::c_types::ThirtyTwoBytes,
1315         /// The number of elements pointed to by `data`.
1316         pub datalen: usize
1317 }
1318 impl CVec_ThirtyTwoBytesZ {
1319         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1320                 if self.datalen == 0 { return Vec::new(); }
1321                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1322                 self.data = core::ptr::null_mut();
1323                 self.datalen = 0;
1324                 ret
1325         }
1326         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1327                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1328         }
1329 }
1330 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
1331         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1332                 let datalen = v.len();
1333                 let data = Box::into_raw(v.into_boxed_slice());
1334                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1335         }
1336 }
1337 #[no_mangle]
1338 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1339 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
1340 impl Drop for CVec_ThirtyTwoBytesZ {
1341         fn drop(&mut self) {
1342                 if self.datalen == 0 { return; }
1343                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1344         }
1345 }
1346 impl Clone for CVec_ThirtyTwoBytesZ {
1347         fn clone(&self) -> Self {
1348                 let mut res = Vec::new();
1349                 if self.datalen == 0 { return Self::from(res); }
1350                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1351                 Self::from(res)
1352         }
1353 }
1354 #[repr(C)]
1355 #[derive(Clone)]
1356 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
1357 pub enum COption_CVec_ThirtyTwoBytesZZ {
1358         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1359         Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
1360         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
1361         None
1362 }
1363 impl COption_CVec_ThirtyTwoBytesZZ {
1364         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1365                 if let Self::None = self { false } else { true }
1366         }
1367         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1368                 !self.is_some()
1369         }
1370         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
1371                 if let Self::Some(v) = self { v } else { unreachable!() }
1372         }
1373 }
1374 #[no_mangle]
1375 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1376 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
1377         COption_CVec_ThirtyTwoBytesZZ::Some(o)
1378 }
1379 #[no_mangle]
1380 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
1381 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
1382         COption_CVec_ThirtyTwoBytesZZ::None
1383 }
1384 #[no_mangle]
1385 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
1386 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
1387 #[no_mangle]
1388 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
1389 /// but with all dynamically-allocated buffers duplicated in new buffers.
1390 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
1391 #[repr(C)]
1392 #[derive(Clone)]
1393 /// An enum which can either contain a crate::lightning::offers::offer::Amount or not
1394 pub enum COption_AmountZ {
1395         /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount
1396         Some(crate::lightning::offers::offer::Amount),
1397         /// When we're in this state, this COption_AmountZ contains nothing
1398         None
1399 }
1400 impl COption_AmountZ {
1401         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1402                 if let Self::None = self { false } else { true }
1403         }
1404         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1405                 !self.is_some()
1406         }
1407         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Amount {
1408                 if let Self::Some(v) = self { v } else { unreachable!() }
1409         }
1410 }
1411 #[no_mangle]
1412 /// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
1413 pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ {
1414         COption_AmountZ::Some(o)
1415 }
1416 #[no_mangle]
1417 /// Constructs a new COption_AmountZ containing nothing
1418 pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ {
1419         COption_AmountZ::None
1420 }
1421 #[no_mangle]
1422 /// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state
1423 pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { }
1424 #[no_mangle]
1425 /// Creates a new COption_AmountZ which has the same data as `orig`
1426 /// but with all dynamically-allocated buffers duplicated in new buffers.
1427 pub extern "C" fn COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) }
1428 #[repr(C)]
1429 #[derive(Clone)]
1430 /// An enum which can either contain a crate::lightning::offers::offer::Quantity or not
1431 pub enum COption_QuantityZ {
1432         /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity
1433         Some(crate::lightning::offers::offer::Quantity),
1434         /// When we're in this state, this COption_QuantityZ contains nothing
1435         None
1436 }
1437 impl COption_QuantityZ {
1438         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1439                 if let Self::None = self { false } else { true }
1440         }
1441         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1442                 !self.is_some()
1443         }
1444         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Quantity {
1445                 if let Self::Some(v) = self { v } else { unreachable!() }
1446         }
1447 }
1448 #[no_mangle]
1449 /// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity
1450 pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ {
1451         COption_QuantityZ::Some(o)
1452 }
1453 #[no_mangle]
1454 /// Constructs a new COption_QuantityZ containing nothing
1455 pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ {
1456         COption_QuantityZ::None
1457 }
1458 #[no_mangle]
1459 /// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state
1460 pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { }
1461 #[no_mangle]
1462 /// Creates a new COption_QuantityZ which has the same data as `orig`
1463 /// but with all dynamically-allocated buffers duplicated in new buffers.
1464 pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) }
1465 #[repr(C)]
1466 /// The contents of CResult_ThirtyTwoBytesNoneZ
1467 pub union CResult_ThirtyTwoBytesNoneZPtr {
1468         /// A pointer to the contents in the success state.
1469         /// Reading from this pointer when `result_ok` is not set is undefined.
1470         pub result: *mut crate::c_types::ThirtyTwoBytes,
1471         /// Note that this value is always NULL, as there are no contents in the Err variant
1472         pub err: *mut core::ffi::c_void,
1473 }
1474 #[repr(C)]
1475 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
1476 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1478 pub struct CResult_ThirtyTwoBytesNoneZ {
1479         /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
1480         /// `err` or `result` depending on the state of `result_ok`.
1481         pub contents: CResult_ThirtyTwoBytesNoneZPtr,
1482         /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
1483         pub result_ok: bool,
1484 }
1485 #[no_mangle]
1486 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
1487 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
1488         CResult_ThirtyTwoBytesNoneZ {
1489                 contents: CResult_ThirtyTwoBytesNoneZPtr {
1490                         result: Box::into_raw(Box::new(o)),
1491                 },
1492                 result_ok: true,
1493         }
1494 }
1495 #[no_mangle]
1496 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
1497 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
1498         CResult_ThirtyTwoBytesNoneZ {
1499                 contents: CResult_ThirtyTwoBytesNoneZPtr {
1500                         err: core::ptr::null_mut(),
1501                 },
1502                 result_ok: false,
1503         }
1504 }
1505 /// Checks if the given object is currently in the success state
1506 #[no_mangle]
1507 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
1508         o.result_ok
1509 }
1510 #[no_mangle]
1511 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
1512 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
1513 impl Drop for CResult_ThirtyTwoBytesNoneZ {
1514         fn drop(&mut self) {
1515                 if self.result_ok {
1516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1518                         }
1519                 } else {
1520                 }
1521         }
1522 }
1523 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1524         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1525                 let contents = if o.result_ok {
1526                         let result = unsafe { o.contents.result };
1527                         unsafe { o.contents.result = core::ptr::null_mut() };
1528                         CResult_ThirtyTwoBytesNoneZPtr { result }
1529                 } else {
1530                         let _ = unsafe { Box::from_raw(o.contents.err) };
1531                         o.contents.err = core::ptr::null_mut();
1532                         CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1533                 };
1534                 Self {
1535                         contents,
1536                         result_ok: o.result_ok,
1537                 }
1538         }
1539 }
1540 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1541         fn clone(&self) -> Self {
1542                 if self.result_ok {
1543                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1544                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1545                         } }
1546                 } else {
1547                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1548                                 err: core::ptr::null_mut()
1549                         } }
1550                 }
1551         }
1552 }
1553 #[no_mangle]
1554 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1555 /// but with all dynamically-allocated buffers duplicated in new buffers.
1556 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1557 #[repr(C)]
1558 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1559 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1560         /// A pointer to the contents in the success state.
1561         /// Reading from this pointer when `result_ok` is not set is undefined.
1562         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1563         /// A pointer to the contents in the error state.
1564         /// Reading from this pointer when `result_ok` is set is undefined.
1565         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1566 }
1567 #[repr(C)]
1568 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1569 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1571 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1572         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1573         /// `err` or `result` depending on the state of `result_ok`.
1574         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1575         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1576         pub result_ok: bool,
1577 }
1578 #[no_mangle]
1579 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1580 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1581         CResult_BlindedPayInfoDecodeErrorZ {
1582                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1583                         result: Box::into_raw(Box::new(o)),
1584                 },
1585                 result_ok: true,
1586         }
1587 }
1588 #[no_mangle]
1589 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1590 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1591         CResult_BlindedPayInfoDecodeErrorZ {
1592                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1593                         err: Box::into_raw(Box::new(e)),
1594                 },
1595                 result_ok: false,
1596         }
1597 }
1598 /// Checks if the given object is currently in the success state
1599 #[no_mangle]
1600 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1601         o.result_ok
1602 }
1603 #[no_mangle]
1604 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1605 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1606 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1607         fn drop(&mut self) {
1608                 if self.result_ok {
1609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1611                         }
1612                 } else {
1613                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1614                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1615                         }
1616                 }
1617         }
1618 }
1619 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1620         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1621                 let contents = if o.result_ok {
1622                         let result = unsafe { o.contents.result };
1623                         unsafe { o.contents.result = core::ptr::null_mut() };
1624                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
1625                 } else {
1626                         let err = unsafe { o.contents.err };
1627                         unsafe { o.contents.err = core::ptr::null_mut(); }
1628                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
1629                 };
1630                 Self {
1631                         contents,
1632                         result_ok: o.result_ok,
1633                 }
1634         }
1635 }
1636 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1637         fn clone(&self) -> Self {
1638                 if self.result_ok {
1639                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1640                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1641                         } }
1642                 } else {
1643                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1644                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1645                         } }
1646                 }
1647         }
1648 }
1649 #[no_mangle]
1650 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1651 /// but with all dynamically-allocated buffers duplicated in new buffers.
1652 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1653 #[repr(C)]
1654 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1655 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1656         /// A pointer to the contents in the success state.
1657         /// Reading from this pointer when `result_ok` is not set is undefined.
1658         pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1659         /// A pointer to the contents in the error state.
1660         /// Reading from this pointer when `result_ok` is set is undefined.
1661         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1662 }
1663 #[repr(C)]
1664 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1665 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1667 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1668         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1669         /// `err` or `result` depending on the state of `result_ok`.
1670         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1671         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1672         pub result_ok: bool,
1673 }
1674 #[no_mangle]
1675 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1676 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1677         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1678                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1679                         result: Box::into_raw(Box::new(o)),
1680                 },
1681                 result_ok: true,
1682         }
1683 }
1684 #[no_mangle]
1685 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1686 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1687         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1688                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1689                         err: Box::into_raw(Box::new(e)),
1690                 },
1691                 result_ok: false,
1692         }
1693 }
1694 /// Checks if the given object is currently in the success state
1695 #[no_mangle]
1696 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1697         o.result_ok
1698 }
1699 #[no_mangle]
1700 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1701 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1702 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1703         fn drop(&mut self) {
1704                 if self.result_ok {
1705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1707                         }
1708                 } else {
1709                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1710                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1711                         }
1712                 }
1713         }
1714 }
1715 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1717                 let contents = if o.result_ok {
1718                         let result = unsafe { o.contents.result };
1719                         unsafe { o.contents.result = core::ptr::null_mut() };
1720                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1721                 } else {
1722                         let err = unsafe { o.contents.err };
1723                         unsafe { o.contents.err = core::ptr::null_mut(); }
1724                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1725                 };
1726                 Self {
1727                         contents,
1728                         result_ok: o.result_ok,
1729                 }
1730         }
1731 }
1732 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1733         fn clone(&self) -> Self {
1734                 if self.result_ok {
1735                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1736                                 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1737                         } }
1738                 } else {
1739                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1740                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1741                         } }
1742                 }
1743         }
1744 }
1745 #[no_mangle]
1746 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1747 /// but with all dynamically-allocated buffers duplicated in new buffers.
1748 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1749 #[repr(C)]
1750 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1751 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1752         /// A pointer to the contents in the success state.
1753         /// Reading from this pointer when `result_ok` is not set is undefined.
1754         pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1755         /// A pointer to the contents in the error state.
1756         /// Reading from this pointer when `result_ok` is set is undefined.
1757         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1758 }
1759 #[repr(C)]
1760 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1761 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1763 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1764         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1765         /// `err` or `result` depending on the state of `result_ok`.
1766         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1767         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1768         pub result_ok: bool,
1769 }
1770 #[no_mangle]
1771 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1772 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1773         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1774                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1775                         result: Box::into_raw(Box::new(o)),
1776                 },
1777                 result_ok: true,
1778         }
1779 }
1780 #[no_mangle]
1781 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1782 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1783         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1784                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1785                         err: Box::into_raw(Box::new(e)),
1786                 },
1787                 result_ok: false,
1788         }
1789 }
1790 /// Checks if the given object is currently in the success state
1791 #[no_mangle]
1792 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1793         o.result_ok
1794 }
1795 #[no_mangle]
1796 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1797 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1798 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1799         fn drop(&mut self) {
1800                 if self.result_ok {
1801                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1802                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1803                         }
1804                 } else {
1805                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1806                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1807                         }
1808                 }
1809         }
1810 }
1811 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1812         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1813                 let contents = if o.result_ok {
1814                         let result = unsafe { o.contents.result };
1815                         unsafe { o.contents.result = core::ptr::null_mut() };
1816                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1817                 } else {
1818                         let err = unsafe { o.contents.err };
1819                         unsafe { o.contents.err = core::ptr::null_mut(); }
1820                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1821                 };
1822                 Self {
1823                         contents,
1824                         result_ok: o.result_ok,
1825                 }
1826         }
1827 }
1828 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1829         fn clone(&self) -> Self {
1830                 if self.result_ok {
1831                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1832                                 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1833                         } }
1834                 } else {
1835                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1836                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1837                         } }
1838                 }
1839         }
1840 }
1841 #[no_mangle]
1842 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1843 /// but with all dynamically-allocated buffers duplicated in new buffers.
1844 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1845 #[repr(C)]
1846 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1847 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1848         /// A pointer to the contents in the success state.
1849         /// Reading from this pointer when `result_ok` is not set is undefined.
1850         pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1851         /// A pointer to the contents in the error state.
1852         /// Reading from this pointer when `result_ok` is set is undefined.
1853         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1854 }
1855 #[repr(C)]
1856 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1857 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1859 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1860         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1861         /// `err` or `result` depending on the state of `result_ok`.
1862         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1863         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1864         pub result_ok: bool,
1865 }
1866 #[no_mangle]
1867 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1868 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1869         CResult_SpendableOutputDescriptorDecodeErrorZ {
1870                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1871                         result: Box::into_raw(Box::new(o)),
1872                 },
1873                 result_ok: true,
1874         }
1875 }
1876 #[no_mangle]
1877 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1878 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1879         CResult_SpendableOutputDescriptorDecodeErrorZ {
1880                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1881                         err: Box::into_raw(Box::new(e)),
1882                 },
1883                 result_ok: false,
1884         }
1885 }
1886 /// Checks if the given object is currently in the success state
1887 #[no_mangle]
1888 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1889         o.result_ok
1890 }
1891 #[no_mangle]
1892 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1893 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1894 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1895         fn drop(&mut self) {
1896                 if self.result_ok {
1897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1899                         }
1900                 } else {
1901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1903                         }
1904                 }
1905         }
1906 }
1907 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1909                 let contents = if o.result_ok {
1910                         let result = unsafe { o.contents.result };
1911                         unsafe { o.contents.result = core::ptr::null_mut() };
1912                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1913                 } else {
1914                         let err = unsafe { o.contents.err };
1915                         unsafe { o.contents.err = core::ptr::null_mut(); }
1916                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1917                 };
1918                 Self {
1919                         contents,
1920                         result_ok: o.result_ok,
1921                 }
1922         }
1923 }
1924 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1925         fn clone(&self) -> Self {
1926                 if self.result_ok {
1927                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1928                                 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1929                         } }
1930                 } else {
1931                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1933                         } }
1934                 }
1935         }
1936 }
1937 #[no_mangle]
1938 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1939 /// but with all dynamically-allocated buffers duplicated in new buffers.
1940 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1941 #[repr(C)]
1942 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1943 /// This corresponds to std::vector in C++
1944 pub struct CVec_SpendableOutputDescriptorZ {
1945         /// The elements in the array.
1946         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1947         pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1948         /// The number of elements pointed to by `data`.
1949         pub datalen: usize
1950 }
1951 impl CVec_SpendableOutputDescriptorZ {
1952         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1953                 if self.datalen == 0 { return Vec::new(); }
1954                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1955                 self.data = core::ptr::null_mut();
1956                 self.datalen = 0;
1957                 ret
1958         }
1959         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1960                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1961         }
1962 }
1963 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1964         fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1965                 let datalen = v.len();
1966                 let data = Box::into_raw(v.into_boxed_slice());
1967                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1968         }
1969 }
1970 #[no_mangle]
1971 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1972 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1973 impl Drop for CVec_SpendableOutputDescriptorZ {
1974         fn drop(&mut self) {
1975                 if self.datalen == 0 { return; }
1976                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1977         }
1978 }
1979 impl Clone for CVec_SpendableOutputDescriptorZ {
1980         fn clone(&self) -> Self {
1981                 let mut res = Vec::new();
1982                 if self.datalen == 0 { return Self::from(res); }
1983                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1984                 Self::from(res)
1985         }
1986 }
1987 #[repr(C)]
1988 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1989 /// This corresponds to std::vector in C++
1990 pub struct CVec_TxOutZ {
1991         /// The elements in the array.
1992         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1993         pub data: *mut crate::c_types::TxOut,
1994         /// The number of elements pointed to by `data`.
1995         pub datalen: usize
1996 }
1997 impl CVec_TxOutZ {
1998         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1999                 if self.datalen == 0 { return Vec::new(); }
2000                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2001                 self.data = core::ptr::null_mut();
2002                 self.datalen = 0;
2003                 ret
2004         }
2005         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
2006                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2007         }
2008 }
2009 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
2010         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
2011                 let datalen = v.len();
2012                 let data = Box::into_raw(v.into_boxed_slice());
2013                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014         }
2015 }
2016 #[no_mangle]
2017 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2018 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
2019 impl Drop for CVec_TxOutZ {
2020         fn drop(&mut self) {
2021                 if self.datalen == 0 { return; }
2022                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2023         }
2024 }
2025 impl Clone for CVec_TxOutZ {
2026         fn clone(&self) -> Self {
2027                 let mut res = Vec::new();
2028                 if self.datalen == 0 { return Self::from(res); }
2029                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2030                 Self::from(res)
2031         }
2032 }
2033 #[repr(C)]
2034 #[derive(Clone)]
2035 /// An enum which can either contain a u32 or not
2036 pub enum COption_u32Z {
2037         /// When we're in this state, this COption_u32Z contains a u32
2038         Some(u32),
2039         /// When we're in this state, this COption_u32Z contains nothing
2040         None
2041 }
2042 impl COption_u32Z {
2043         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2044                 if let Self::None = self { false } else { true }
2045         }
2046         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2047                 !self.is_some()
2048         }
2049         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
2050                 if let Self::Some(v) = self { v } else { unreachable!() }
2051         }
2052 }
2053 #[no_mangle]
2054 /// Constructs a new COption_u32Z containing a u32
2055 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
2056         COption_u32Z::Some(o)
2057 }
2058 #[no_mangle]
2059 /// Constructs a new COption_u32Z containing nothing
2060 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
2061         COption_u32Z::None
2062 }
2063 #[no_mangle]
2064 /// Frees any resources associated with the u32, if we are in the Some state
2065 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
2066 #[no_mangle]
2067 /// Creates a new COption_u32Z which has the same data as `orig`
2068 /// but with all dynamically-allocated buffers duplicated in new buffers.
2069 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
2070 #[repr(C)]
2071 /// A tuple of 2 elements. See the individual fields for the types contained.
2072 pub struct C2Tuple_CVec_u8Zu64Z {
2073         /// The element at position 0
2074         pub a: crate::c_types::derived::CVec_u8Z,
2075         /// The element at position 1
2076         pub b: u64,
2077 }
2078 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
2079         fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
2080                 Self {
2081                         a: tup.0,
2082                         b: tup.1,
2083                 }
2084         }
2085 }
2086 impl C2Tuple_CVec_u8Zu64Z {
2087         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
2088                 (self.a, self.b)
2089         }
2090 }
2091 impl Clone for C2Tuple_CVec_u8Zu64Z {
2092         fn clone(&self) -> Self {
2093                 Self {
2094                         a: Clone::clone(&self.a),
2095                         b: Clone::clone(&self.b),
2096                 }
2097         }
2098 }
2099 #[no_mangle]
2100 /// Creates a new tuple which has the same data as `orig`
2101 /// but with all dynamically-allocated buffers duplicated in new buffers.
2102 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
2103 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
2104 #[no_mangle]
2105 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
2106         C2Tuple_CVec_u8Zu64Z { a, b, }
2107 }
2108
2109 #[no_mangle]
2110 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
2111 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
2112 #[repr(C)]
2113 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
2114 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2115         /// A pointer to the contents in the success state.
2116         /// Reading from this pointer when `result_ok` is not set is undefined.
2117         pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z,
2118         /// Note that this value is always NULL, as there are no contents in the Err variant
2119         pub err: *mut core::ffi::c_void,
2120 }
2121 #[repr(C)]
2122 /// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
2123 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
2124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2125 pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2126         /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
2127         /// `err` or `result` depending on the state of `result_ok`.
2128         pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
2129         /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
2130         pub result_ok: bool,
2131 }
2132 #[no_mangle]
2133 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
2134 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2135         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2136                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2137                         result: Box::into_raw(Box::new(o)),
2138                 },
2139                 result_ok: true,
2140         }
2141 }
2142 #[no_mangle]
2143 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
2144 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2145         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2146                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2147                         err: core::ptr::null_mut(),
2148                 },
2149                 result_ok: false,
2150         }
2151 }
2152 /// Checks if the given object is currently in the success state
2153 #[no_mangle]
2154 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
2155         o.result_ok
2156 }
2157 #[no_mangle]
2158 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
2159 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
2160 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2161         fn drop(&mut self) {
2162                 if self.result_ok {
2163                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2164                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2165                         }
2166                 } else {
2167                 }
2168         }
2169 }
2170 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2171         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> Self {
2172                 let contents = if o.result_ok {
2173                         let result = unsafe { o.contents.result };
2174                         unsafe { o.contents.result = core::ptr::null_mut() };
2175                         CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result }
2176                 } else {
2177                         let _ = unsafe { Box::from_raw(o.contents.err) };
2178                         o.contents.err = core::ptr::null_mut();
2179                         CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() }
2180                 };
2181                 Self {
2182                         contents,
2183                         result_ok: o.result_ok,
2184                 }
2185         }
2186 }
2187 impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2188         fn clone(&self) -> Self {
2189                 if self.result_ok {
2190                         Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2191                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
2192                         } }
2193                 } else {
2194                         Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2195                                 err: core::ptr::null_mut()
2196                         } }
2197                 }
2198         }
2199 }
2200 #[no_mangle]
2201 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
2202 /// but with all dynamically-allocated buffers duplicated in new buffers.
2203 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) }
2204 #[repr(C)]
2205 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
2206 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
2207         /// A pointer to the contents in the success state.
2208         /// Reading from this pointer when `result_ok` is not set is undefined.
2209         pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
2210         /// A pointer to the contents in the error state.
2211         /// Reading from this pointer when `result_ok` is set is undefined.
2212         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2213 }
2214 #[repr(C)]
2215 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
2216 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2218 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
2219         /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
2220         /// `err` or `result` depending on the state of `result_ok`.
2221         pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
2222         /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
2223         pub result_ok: bool,
2224 }
2225 #[no_mangle]
2226 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
2227 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2228         CResult_ChannelDerivationParametersDecodeErrorZ {
2229                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2230                         result: Box::into_raw(Box::new(o)),
2231                 },
2232                 result_ok: true,
2233         }
2234 }
2235 #[no_mangle]
2236 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
2237 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2238         CResult_ChannelDerivationParametersDecodeErrorZ {
2239                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2240                         err: Box::into_raw(Box::new(e)),
2241                 },
2242                 result_ok: false,
2243         }
2244 }
2245 /// Checks if the given object is currently in the success state
2246 #[no_mangle]
2247 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
2248         o.result_ok
2249 }
2250 #[no_mangle]
2251 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
2252 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
2253 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
2254         fn drop(&mut self) {
2255                 if self.result_ok {
2256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2258                         }
2259                 } else {
2260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2262                         }
2263                 }
2264         }
2265 }
2266 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
2267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2268                 let contents = if o.result_ok {
2269                         let result = unsafe { o.contents.result };
2270                         unsafe { o.contents.result = core::ptr::null_mut() };
2271                         CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
2272                 } else {
2273                         let err = unsafe { o.contents.err };
2274                         unsafe { o.contents.err = core::ptr::null_mut(); }
2275                         CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
2276                 };
2277                 Self {
2278                         contents,
2279                         result_ok: o.result_ok,
2280                 }
2281         }
2282 }
2283 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
2284         fn clone(&self) -> Self {
2285                 if self.result_ok {
2286                         Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2287                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
2288                         } }
2289                 } else {
2290                         Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2291                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2292                         } }
2293                 }
2294         }
2295 }
2296 #[no_mangle]
2297 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
2298 /// but with all dynamically-allocated buffers duplicated in new buffers.
2299 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
2300 #[repr(C)]
2301 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
2302 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
2303         /// A pointer to the contents in the success state.
2304         /// Reading from this pointer when `result_ok` is not set is undefined.
2305         pub result: *mut crate::lightning::sign::HTLCDescriptor,
2306         /// A pointer to the contents in the error state.
2307         /// Reading from this pointer when `result_ok` is set is undefined.
2308         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2309 }
2310 #[repr(C)]
2311 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
2312 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2314 pub struct CResult_HTLCDescriptorDecodeErrorZ {
2315         /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
2316         /// `err` or `result` depending on the state of `result_ok`.
2317         pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
2318         /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
2319         pub result_ok: bool,
2320 }
2321 #[no_mangle]
2322 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
2323 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
2324         CResult_HTLCDescriptorDecodeErrorZ {
2325                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2326                         result: Box::into_raw(Box::new(o)),
2327                 },
2328                 result_ok: true,
2329         }
2330 }
2331 #[no_mangle]
2332 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
2333 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
2334         CResult_HTLCDescriptorDecodeErrorZ {
2335                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2336                         err: Box::into_raw(Box::new(e)),
2337                 },
2338                 result_ok: false,
2339         }
2340 }
2341 /// Checks if the given object is currently in the success state
2342 #[no_mangle]
2343 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
2344         o.result_ok
2345 }
2346 #[no_mangle]
2347 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
2348 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
2349 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
2350         fn drop(&mut self) {
2351                 if self.result_ok {
2352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2354                         }
2355                 } else {
2356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2358                         }
2359                 }
2360         }
2361 }
2362 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
2363         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2364                 let contents = if o.result_ok {
2365                         let result = unsafe { o.contents.result };
2366                         unsafe { o.contents.result = core::ptr::null_mut() };
2367                         CResult_HTLCDescriptorDecodeErrorZPtr { result }
2368                 } else {
2369                         let err = unsafe { o.contents.err };
2370                         unsafe { o.contents.err = core::ptr::null_mut(); }
2371                         CResult_HTLCDescriptorDecodeErrorZPtr { err }
2372                 };
2373                 Self {
2374                         contents,
2375                         result_ok: o.result_ok,
2376                 }
2377         }
2378 }
2379 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
2380         fn clone(&self) -> Self {
2381                 if self.result_ok {
2382                         Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2383                                 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
2384                         } }
2385                 } else {
2386                         Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2387                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2388                         } }
2389                 }
2390         }
2391 }
2392 #[no_mangle]
2393 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
2394 /// but with all dynamically-allocated buffers duplicated in new buffers.
2395 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
2396 #[repr(C)]
2397 /// The contents of CResult_NoneNoneZ
2398 pub union CResult_NoneNoneZPtr {
2399         /// Note that this value is always NULL, as there are no contents in the OK variant
2400         pub result: *mut core::ffi::c_void,
2401         /// Note that this value is always NULL, as there are no contents in the Err variant
2402         pub err: *mut core::ffi::c_void,
2403 }
2404 #[repr(C)]
2405 /// A CResult_NoneNoneZ represents the result of a fallible operation,
2406 /// containing a () on success and a () on failure.
2407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2408 pub struct CResult_NoneNoneZ {
2409         /// The contents of this CResult_NoneNoneZ, accessible via either
2410         /// `err` or `result` depending on the state of `result_ok`.
2411         pub contents: CResult_NoneNoneZPtr,
2412         /// Whether this CResult_NoneNoneZ represents a success state.
2413         pub result_ok: bool,
2414 }
2415 #[no_mangle]
2416 /// Creates a new CResult_NoneNoneZ in the success state.
2417 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
2418         CResult_NoneNoneZ {
2419                 contents: CResult_NoneNoneZPtr {
2420                         result: core::ptr::null_mut(),
2421                 },
2422                 result_ok: true,
2423         }
2424 }
2425 #[no_mangle]
2426 /// Creates a new CResult_NoneNoneZ in the error state.
2427 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
2428         CResult_NoneNoneZ {
2429                 contents: CResult_NoneNoneZPtr {
2430                         err: core::ptr::null_mut(),
2431                 },
2432                 result_ok: false,
2433         }
2434 }
2435 /// Checks if the given object is currently in the success state
2436 #[no_mangle]
2437 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
2438         o.result_ok
2439 }
2440 #[no_mangle]
2441 /// Frees any resources used by the CResult_NoneNoneZ.
2442 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
2443 impl Drop for CResult_NoneNoneZ {
2444         fn drop(&mut self) {
2445                 if self.result_ok {
2446                 } else {
2447                 }
2448         }
2449 }
2450 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
2451         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
2452                 let contents = if o.result_ok {
2453                         let _ = unsafe { Box::from_raw(o.contents.result) };
2454                         o.contents.result = core::ptr::null_mut();
2455                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
2456                 } else {
2457                         let _ = unsafe { Box::from_raw(o.contents.err) };
2458                         o.contents.err = core::ptr::null_mut();
2459                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
2460                 };
2461                 Self {
2462                         contents,
2463                         result_ok: o.result_ok,
2464                 }
2465         }
2466 }
2467 impl Clone for CResult_NoneNoneZ {
2468         fn clone(&self) -> Self {
2469                 if self.result_ok {
2470                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
2471                                 result: core::ptr::null_mut()
2472                         } }
2473                 } else {
2474                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
2475                                 err: core::ptr::null_mut()
2476                         } }
2477                 }
2478         }
2479 }
2480 #[no_mangle]
2481 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
2482 /// but with all dynamically-allocated buffers duplicated in new buffers.
2483 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
2484 #[repr(C)]
2485 /// The contents of CResult_PublicKeyNoneZ
2486 pub union CResult_PublicKeyNoneZPtr {
2487         /// A pointer to the contents in the success state.
2488         /// Reading from this pointer when `result_ok` is not set is undefined.
2489         pub result: *mut crate::c_types::PublicKey,
2490         /// Note that this value is always NULL, as there are no contents in the Err variant
2491         pub err: *mut core::ffi::c_void,
2492 }
2493 #[repr(C)]
2494 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2495 /// containing a crate::c_types::PublicKey on success and a () on failure.
2496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2497 pub struct CResult_PublicKeyNoneZ {
2498         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2499         /// `err` or `result` depending on the state of `result_ok`.
2500         pub contents: CResult_PublicKeyNoneZPtr,
2501         /// Whether this CResult_PublicKeyNoneZ represents a success state.
2502         pub result_ok: bool,
2503 }
2504 #[no_mangle]
2505 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2506 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2507         CResult_PublicKeyNoneZ {
2508                 contents: CResult_PublicKeyNoneZPtr {
2509                         result: Box::into_raw(Box::new(o)),
2510                 },
2511                 result_ok: true,
2512         }
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2516 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2517         CResult_PublicKeyNoneZ {
2518                 contents: CResult_PublicKeyNoneZPtr {
2519                         err: core::ptr::null_mut(),
2520                 },
2521                 result_ok: false,
2522         }
2523 }
2524 /// Checks if the given object is currently in the success state
2525 #[no_mangle]
2526 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2527         o.result_ok
2528 }
2529 #[no_mangle]
2530 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2531 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2532 impl Drop for CResult_PublicKeyNoneZ {
2533         fn drop(&mut self) {
2534                 if self.result_ok {
2535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2537                         }
2538                 } else {
2539                 }
2540         }
2541 }
2542 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2543         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2544                 let contents = if o.result_ok {
2545                         let result = unsafe { o.contents.result };
2546                         unsafe { o.contents.result = core::ptr::null_mut() };
2547                         CResult_PublicKeyNoneZPtr { result }
2548                 } else {
2549                         let _ = unsafe { Box::from_raw(o.contents.err) };
2550                         o.contents.err = core::ptr::null_mut();
2551                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2552                 };
2553                 Self {
2554                         contents,
2555                         result_ok: o.result_ok,
2556                 }
2557         }
2558 }
2559 impl Clone for CResult_PublicKeyNoneZ {
2560         fn clone(&self) -> Self {
2561                 if self.result_ok {
2562                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2563                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2564                         } }
2565                 } else {
2566                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2567                                 err: core::ptr::null_mut()
2568                         } }
2569                 }
2570         }
2571 }
2572 #[no_mangle]
2573 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2574 /// but with all dynamically-allocated buffers duplicated in new buffers.
2575 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2576 #[repr(C)]
2577 #[derive(Clone)]
2578 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2579 pub enum COption_BigEndianScalarZ {
2580         /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2581         Some(crate::c_types::BigEndianScalar),
2582         /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2583         None
2584 }
2585 impl COption_BigEndianScalarZ {
2586         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2587                 if let Self::None = self { false } else { true }
2588         }
2589         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2590                 !self.is_some()
2591         }
2592         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2593                 if let Self::Some(v) = self { v } else { unreachable!() }
2594         }
2595 }
2596 #[no_mangle]
2597 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2598 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2599         COption_BigEndianScalarZ::Some(o)
2600 }
2601 #[no_mangle]
2602 /// Constructs a new COption_BigEndianScalarZ containing nothing
2603 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2604         COption_BigEndianScalarZ::None
2605 }
2606 #[no_mangle]
2607 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2608 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2609 #[no_mangle]
2610 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2611 /// but with all dynamically-allocated buffers duplicated in new buffers.
2612 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2613 #[repr(C)]
2614 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2615 /// This corresponds to std::vector in C++
2616 pub struct CVec_U5Z {
2617         /// The elements in the array.
2618         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2619         pub data: *mut crate::c_types::U5,
2620         /// The number of elements pointed to by `data`.
2621         pub datalen: usize
2622 }
2623 impl CVec_U5Z {
2624         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2625                 if self.datalen == 0 { return Vec::new(); }
2626                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2627                 self.data = core::ptr::null_mut();
2628                 self.datalen = 0;
2629                 ret
2630         }
2631         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2632                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2633         }
2634 }
2635 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2636         fn from(v: Vec<crate::c_types::U5>) -> Self {
2637                 let datalen = v.len();
2638                 let data = Box::into_raw(v.into_boxed_slice());
2639                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2640         }
2641 }
2642 #[no_mangle]
2643 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2644 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2645 impl Drop for CVec_U5Z {
2646         fn drop(&mut self) {
2647                 if self.datalen == 0 { return; }
2648                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2649         }
2650 }
2651 impl Clone for CVec_U5Z {
2652         fn clone(&self) -> Self {
2653                 let mut res = Vec::new();
2654                 if self.datalen == 0 { return Self::from(res); }
2655                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2656                 Self::from(res)
2657         }
2658 }
2659 #[repr(C)]
2660 /// The contents of CResult_RecoverableSignatureNoneZ
2661 pub union CResult_RecoverableSignatureNoneZPtr {
2662         /// A pointer to the contents in the success state.
2663         /// Reading from this pointer when `result_ok` is not set is undefined.
2664         pub result: *mut crate::c_types::RecoverableSignature,
2665         /// Note that this value is always NULL, as there are no contents in the Err variant
2666         pub err: *mut core::ffi::c_void,
2667 }
2668 #[repr(C)]
2669 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2670 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2672 pub struct CResult_RecoverableSignatureNoneZ {
2673         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2674         /// `err` or `result` depending on the state of `result_ok`.
2675         pub contents: CResult_RecoverableSignatureNoneZPtr,
2676         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2677         pub result_ok: bool,
2678 }
2679 #[no_mangle]
2680 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2681 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2682         CResult_RecoverableSignatureNoneZ {
2683                 contents: CResult_RecoverableSignatureNoneZPtr {
2684                         result: Box::into_raw(Box::new(o)),
2685                 },
2686                 result_ok: true,
2687         }
2688 }
2689 #[no_mangle]
2690 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2691 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2692         CResult_RecoverableSignatureNoneZ {
2693                 contents: CResult_RecoverableSignatureNoneZPtr {
2694                         err: core::ptr::null_mut(),
2695                 },
2696                 result_ok: false,
2697         }
2698 }
2699 /// Checks if the given object is currently in the success state
2700 #[no_mangle]
2701 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2702         o.result_ok
2703 }
2704 #[no_mangle]
2705 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2706 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2707 impl Drop for CResult_RecoverableSignatureNoneZ {
2708         fn drop(&mut self) {
2709                 if self.result_ok {
2710                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2711                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2712                         }
2713                 } else {
2714                 }
2715         }
2716 }
2717 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2718         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2719                 let contents = if o.result_ok {
2720                         let result = unsafe { o.contents.result };
2721                         unsafe { o.contents.result = core::ptr::null_mut() };
2722                         CResult_RecoverableSignatureNoneZPtr { result }
2723                 } else {
2724                         let _ = unsafe { Box::from_raw(o.contents.err) };
2725                         o.contents.err = core::ptr::null_mut();
2726                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2727                 };
2728                 Self {
2729                         contents,
2730                         result_ok: o.result_ok,
2731                 }
2732         }
2733 }
2734 impl Clone for CResult_RecoverableSignatureNoneZ {
2735         fn clone(&self) -> Self {
2736                 if self.result_ok {
2737                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2738                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2739                         } }
2740                 } else {
2741                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2742                                 err: core::ptr::null_mut()
2743                         } }
2744                 }
2745         }
2746 }
2747 #[no_mangle]
2748 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2749 /// but with all dynamically-allocated buffers duplicated in new buffers.
2750 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2751 #[repr(C)]
2752 /// The contents of CResult_ECDSASignatureNoneZ
2753 pub union CResult_ECDSASignatureNoneZPtr {
2754         /// A pointer to the contents in the success state.
2755         /// Reading from this pointer when `result_ok` is not set is undefined.
2756         pub result: *mut crate::c_types::ECDSASignature,
2757         /// Note that this value is always NULL, as there are no contents in the Err variant
2758         pub err: *mut core::ffi::c_void,
2759 }
2760 #[repr(C)]
2761 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2762 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2764 pub struct CResult_ECDSASignatureNoneZ {
2765         /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2766         /// `err` or `result` depending on the state of `result_ok`.
2767         pub contents: CResult_ECDSASignatureNoneZPtr,
2768         /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2769         pub result_ok: bool,
2770 }
2771 #[no_mangle]
2772 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2773 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2774         CResult_ECDSASignatureNoneZ {
2775                 contents: CResult_ECDSASignatureNoneZPtr {
2776                         result: Box::into_raw(Box::new(o)),
2777                 },
2778                 result_ok: true,
2779         }
2780 }
2781 #[no_mangle]
2782 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2783 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2784         CResult_ECDSASignatureNoneZ {
2785                 contents: CResult_ECDSASignatureNoneZPtr {
2786                         err: core::ptr::null_mut(),
2787                 },
2788                 result_ok: false,
2789         }
2790 }
2791 /// Checks if the given object is currently in the success state
2792 #[no_mangle]
2793 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2794         o.result_ok
2795 }
2796 #[no_mangle]
2797 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2798 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2799 impl Drop for CResult_ECDSASignatureNoneZ {
2800         fn drop(&mut self) {
2801                 if self.result_ok {
2802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2804                         }
2805                 } else {
2806                 }
2807         }
2808 }
2809 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2810         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2811                 let contents = if o.result_ok {
2812                         let result = unsafe { o.contents.result };
2813                         unsafe { o.contents.result = core::ptr::null_mut() };
2814                         CResult_ECDSASignatureNoneZPtr { result }
2815                 } else {
2816                         let _ = unsafe { Box::from_raw(o.contents.err) };
2817                         o.contents.err = core::ptr::null_mut();
2818                         CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2819                 };
2820                 Self {
2821                         contents,
2822                         result_ok: o.result_ok,
2823                 }
2824         }
2825 }
2826 impl Clone for CResult_ECDSASignatureNoneZ {
2827         fn clone(&self) -> Self {
2828                 if self.result_ok {
2829                         Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2830                                 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2831                         } }
2832                 } else {
2833                         Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2834                                 err: core::ptr::null_mut()
2835                         } }
2836                 }
2837         }
2838 }
2839 #[no_mangle]
2840 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2841 /// but with all dynamically-allocated buffers duplicated in new buffers.
2842 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2843 #[repr(C)]
2844 /// The contents of CResult_TransactionNoneZ
2845 pub union CResult_TransactionNoneZPtr {
2846         /// A pointer to the contents in the success state.
2847         /// Reading from this pointer when `result_ok` is not set is undefined.
2848         pub result: *mut crate::c_types::Transaction,
2849         /// Note that this value is always NULL, as there are no contents in the Err variant
2850         pub err: *mut core::ffi::c_void,
2851 }
2852 #[repr(C)]
2853 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2854 /// containing a crate::c_types::Transaction on success and a () on failure.
2855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2856 pub struct CResult_TransactionNoneZ {
2857         /// The contents of this CResult_TransactionNoneZ, accessible via either
2858         /// `err` or `result` depending on the state of `result_ok`.
2859         pub contents: CResult_TransactionNoneZPtr,
2860         /// Whether this CResult_TransactionNoneZ represents a success state.
2861         pub result_ok: bool,
2862 }
2863 #[no_mangle]
2864 /// Creates a new CResult_TransactionNoneZ in the success state.
2865 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2866         CResult_TransactionNoneZ {
2867                 contents: CResult_TransactionNoneZPtr {
2868                         result: Box::into_raw(Box::new(o)),
2869                 },
2870                 result_ok: true,
2871         }
2872 }
2873 #[no_mangle]
2874 /// Creates a new CResult_TransactionNoneZ in the error state.
2875 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2876         CResult_TransactionNoneZ {
2877                 contents: CResult_TransactionNoneZPtr {
2878                         err: core::ptr::null_mut(),
2879                 },
2880                 result_ok: false,
2881         }
2882 }
2883 /// Checks if the given object is currently in the success state
2884 #[no_mangle]
2885 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2886         o.result_ok
2887 }
2888 #[no_mangle]
2889 /// Frees any resources used by the CResult_TransactionNoneZ.
2890 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2891 impl Drop for CResult_TransactionNoneZ {
2892         fn drop(&mut self) {
2893                 if self.result_ok {
2894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2896                         }
2897                 } else {
2898                 }
2899         }
2900 }
2901 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2902         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
2903                 let contents = if o.result_ok {
2904                         let result = unsafe { o.contents.result };
2905                         unsafe { o.contents.result = core::ptr::null_mut() };
2906                         CResult_TransactionNoneZPtr { result }
2907                 } else {
2908                         let _ = unsafe { Box::from_raw(o.contents.err) };
2909                         o.contents.err = core::ptr::null_mut();
2910                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2911                 };
2912                 Self {
2913                         contents,
2914                         result_ok: o.result_ok,
2915                 }
2916         }
2917 }
2918 impl Clone for CResult_TransactionNoneZ {
2919         fn clone(&self) -> Self {
2920                 if self.result_ok {
2921                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2922                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2923                         } }
2924                 } else {
2925                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2926                                 err: core::ptr::null_mut()
2927                         } }
2928                 }
2929         }
2930 }
2931 #[no_mangle]
2932 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2933 /// but with all dynamically-allocated buffers duplicated in new buffers.
2934 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2935 #[repr(C)]
2936 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2937 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2938         /// A pointer to the contents in the success state.
2939         /// Reading from this pointer when `result_ok` is not set is undefined.
2940         pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2941         /// A pointer to the contents in the error state.
2942         /// Reading from this pointer when `result_ok` is set is undefined.
2943         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2944 }
2945 #[repr(C)]
2946 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2947 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2948 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2949 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2950         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2951         /// `err` or `result` depending on the state of `result_ok`.
2952         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2953         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2954         pub result_ok: bool,
2955 }
2956 #[no_mangle]
2957 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2958 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2959         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2960                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2961                         result: Box::into_raw(Box::new(o)),
2962                 },
2963                 result_ok: true,
2964         }
2965 }
2966 #[no_mangle]
2967 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2968 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2969         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2970                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2971                         err: Box::into_raw(Box::new(e)),
2972                 },
2973                 result_ok: false,
2974         }
2975 }
2976 /// Checks if the given object is currently in the success state
2977 #[no_mangle]
2978 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2979         o.result_ok
2980 }
2981 #[no_mangle]
2982 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2983 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2984 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2985         fn drop(&mut self) {
2986                 if self.result_ok {
2987                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2988                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2989                         }
2990                 } else {
2991                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2992                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2993                         }
2994                 }
2995         }
2996 }
2997 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2998         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2999                 let contents = if o.result_ok {
3000                         let result = unsafe { o.contents.result };
3001                         unsafe { o.contents.result = core::ptr::null_mut() };
3002                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
3003                 } else {
3004                         let err = unsafe { o.contents.err };
3005                         unsafe { o.contents.err = core::ptr::null_mut(); }
3006                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
3007                 };
3008                 Self {
3009                         contents,
3010                         result_ok: o.result_ok,
3011                 }
3012         }
3013 }
3014 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3015         fn clone(&self) -> Self {
3016                 if self.result_ok {
3017                         Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3018                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
3019                         } }
3020                 } else {
3021                         Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3022                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3023                         } }
3024                 }
3025         }
3026 }
3027 #[no_mangle]
3028 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
3029 /// but with all dynamically-allocated buffers duplicated in new buffers.
3030 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
3031 #[repr(C)]
3032 /// The contents of CResult_CVec_u8ZNoneZ
3033 pub union CResult_CVec_u8ZNoneZPtr {
3034         /// A pointer to the contents in the success state.
3035         /// Reading from this pointer when `result_ok` is not set is undefined.
3036         pub result: *mut crate::c_types::derived::CVec_u8Z,
3037         /// Note that this value is always NULL, as there are no contents in the Err variant
3038         pub err: *mut core::ffi::c_void,
3039 }
3040 #[repr(C)]
3041 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
3042 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
3043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3044 pub struct CResult_CVec_u8ZNoneZ {
3045         /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
3046         /// `err` or `result` depending on the state of `result_ok`.
3047         pub contents: CResult_CVec_u8ZNoneZPtr,
3048         /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
3049         pub result_ok: bool,
3050 }
3051 #[no_mangle]
3052 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
3053 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
3054         CResult_CVec_u8ZNoneZ {
3055                 contents: CResult_CVec_u8ZNoneZPtr {
3056                         result: Box::into_raw(Box::new(o)),
3057                 },
3058                 result_ok: true,
3059         }
3060 }
3061 #[no_mangle]
3062 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
3063 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
3064         CResult_CVec_u8ZNoneZ {
3065                 contents: CResult_CVec_u8ZNoneZPtr {
3066                         err: core::ptr::null_mut(),
3067                 },
3068                 result_ok: false,
3069         }
3070 }
3071 /// Checks if the given object is currently in the success state
3072 #[no_mangle]
3073 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
3074         o.result_ok
3075 }
3076 #[no_mangle]
3077 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
3078 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
3079 impl Drop for CResult_CVec_u8ZNoneZ {
3080         fn drop(&mut self) {
3081                 if self.result_ok {
3082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3084                         }
3085                 } else {
3086                 }
3087         }
3088 }
3089 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
3090         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
3091                 let contents = if o.result_ok {
3092                         let result = unsafe { o.contents.result };
3093                         unsafe { o.contents.result = core::ptr::null_mut() };
3094                         CResult_CVec_u8ZNoneZPtr { result }
3095                 } else {
3096                         let _ = unsafe { Box::from_raw(o.contents.err) };
3097                         o.contents.err = core::ptr::null_mut();
3098                         CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
3099                 };
3100                 Self {
3101                         contents,
3102                         result_ok: o.result_ok,
3103                 }
3104         }
3105 }
3106 impl Clone for CResult_CVec_u8ZNoneZ {
3107         fn clone(&self) -> Self {
3108                 if self.result_ok {
3109                         Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
3110                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3111                         } }
3112                 } else {
3113                         Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
3114                                 err: core::ptr::null_mut()
3115                         } }
3116                 }
3117         }
3118 }
3119 #[no_mangle]
3120 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
3121 /// but with all dynamically-allocated buffers duplicated in new buffers.
3122 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
3123 #[repr(C)]
3124 /// The contents of CResult_ShutdownScriptNoneZ
3125 pub union CResult_ShutdownScriptNoneZPtr {
3126         /// A pointer to the contents in the success state.
3127         /// Reading from this pointer when `result_ok` is not set is undefined.
3128         pub result: *mut crate::lightning::ln::script::ShutdownScript,
3129         /// Note that this value is always NULL, as there are no contents in the Err variant
3130         pub err: *mut core::ffi::c_void,
3131 }
3132 #[repr(C)]
3133 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
3134 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
3135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3136 pub struct CResult_ShutdownScriptNoneZ {
3137         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
3138         /// `err` or `result` depending on the state of `result_ok`.
3139         pub contents: CResult_ShutdownScriptNoneZPtr,
3140         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
3141         pub result_ok: bool,
3142 }
3143 #[no_mangle]
3144 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
3145 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
3146         CResult_ShutdownScriptNoneZ {
3147                 contents: CResult_ShutdownScriptNoneZPtr {
3148                         result: Box::into_raw(Box::new(o)),
3149                 },
3150                 result_ok: true,
3151         }
3152 }
3153 #[no_mangle]
3154 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
3155 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
3156         CResult_ShutdownScriptNoneZ {
3157                 contents: CResult_ShutdownScriptNoneZPtr {
3158                         err: core::ptr::null_mut(),
3159                 },
3160                 result_ok: false,
3161         }
3162 }
3163 /// Checks if the given object is currently in the success state
3164 #[no_mangle]
3165 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
3166         o.result_ok
3167 }
3168 #[no_mangle]
3169 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
3170 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
3171 impl Drop for CResult_ShutdownScriptNoneZ {
3172         fn drop(&mut self) {
3173                 if self.result_ok {
3174                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3175                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3176                         }
3177                 } else {
3178                 }
3179         }
3180 }
3181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
3182         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
3183                 let contents = if o.result_ok {
3184                         let result = unsafe { o.contents.result };
3185                         unsafe { o.contents.result = core::ptr::null_mut() };
3186                         CResult_ShutdownScriptNoneZPtr { result }
3187                 } else {
3188                         let _ = unsafe { Box::from_raw(o.contents.err) };
3189                         o.contents.err = core::ptr::null_mut();
3190                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
3191                 };
3192                 Self {
3193                         contents,
3194                         result_ok: o.result_ok,
3195                 }
3196         }
3197 }
3198 impl Clone for CResult_ShutdownScriptNoneZ {
3199         fn clone(&self) -> Self {
3200                 if self.result_ok {
3201                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
3202                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
3203                         } }
3204                 } else {
3205                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
3206                                 err: core::ptr::null_mut()
3207                         } }
3208                 }
3209         }
3210 }
3211 #[no_mangle]
3212 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
3213 /// but with all dynamically-allocated buffers duplicated in new buffers.
3214 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
3215 #[repr(C)]
3216 #[derive(Clone)]
3217 /// An enum which can either contain a u16 or not
3218 pub enum COption_u16Z {
3219         /// When we're in this state, this COption_u16Z contains a u16
3220         Some(u16),
3221         /// When we're in this state, this COption_u16Z contains nothing
3222         None
3223 }
3224 impl COption_u16Z {
3225         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3226                 if let Self::None = self { false } else { true }
3227         }
3228         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3229                 !self.is_some()
3230         }
3231         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3232                 if let Self::Some(v) = self { v } else { unreachable!() }
3233         }
3234 }
3235 #[no_mangle]
3236 /// Constructs a new COption_u16Z containing a u16
3237 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3238         COption_u16Z::Some(o)
3239 }
3240 #[no_mangle]
3241 /// Constructs a new COption_u16Z containing nothing
3242 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3243         COption_u16Z::None
3244 }
3245 #[no_mangle]
3246 /// Frees any resources associated with the u16, if we are in the Some state
3247 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3248 #[no_mangle]
3249 /// Creates a new COption_u16Z which has the same data as `orig`
3250 /// but with all dynamically-allocated buffers duplicated in new buffers.
3251 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
3252 #[repr(C)]
3253 #[derive(Clone)]
3254 /// An enum which can either contain a bool or not
3255 pub enum COption_boolZ {
3256         /// When we're in this state, this COption_boolZ contains a bool
3257         Some(bool),
3258         /// When we're in this state, this COption_boolZ contains nothing
3259         None
3260 }
3261 impl COption_boolZ {
3262         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3263                 if let Self::None = self { false } else { true }
3264         }
3265         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3266                 !self.is_some()
3267         }
3268         #[allow(unused)] pub(crate) fn take(mut self) -> bool {
3269                 if let Self::Some(v) = self { v } else { unreachable!() }
3270         }
3271 }
3272 #[no_mangle]
3273 /// Constructs a new COption_boolZ containing a bool
3274 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
3275         COption_boolZ::Some(o)
3276 }
3277 #[no_mangle]
3278 /// Constructs a new COption_boolZ containing nothing
3279 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
3280         COption_boolZ::None
3281 }
3282 #[no_mangle]
3283 /// Frees any resources associated with the bool, if we are in the Some state
3284 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
3285 #[no_mangle]
3286 /// Creates a new COption_boolZ which has the same data as `orig`
3287 /// but with all dynamically-allocated buffers duplicated in new buffers.
3288 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
3289 #[repr(C)]
3290 /// The contents of CResult_WitnessNoneZ
3291 pub union CResult_WitnessNoneZPtr {
3292         /// A pointer to the contents in the success state.
3293         /// Reading from this pointer when `result_ok` is not set is undefined.
3294         pub result: *mut crate::c_types::Witness,
3295         /// Note that this value is always NULL, as there are no contents in the Err variant
3296         pub err: *mut core::ffi::c_void,
3297 }
3298 #[repr(C)]
3299 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
3300 /// containing a crate::c_types::Witness on success and a () on failure.
3301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3302 pub struct CResult_WitnessNoneZ {
3303         /// The contents of this CResult_WitnessNoneZ, accessible via either
3304         /// `err` or `result` depending on the state of `result_ok`.
3305         pub contents: CResult_WitnessNoneZPtr,
3306         /// Whether this CResult_WitnessNoneZ represents a success state.
3307         pub result_ok: bool,
3308 }
3309 #[no_mangle]
3310 /// Creates a new CResult_WitnessNoneZ in the success state.
3311 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
3312         CResult_WitnessNoneZ {
3313                 contents: CResult_WitnessNoneZPtr {
3314                         result: Box::into_raw(Box::new(o)),
3315                 },
3316                 result_ok: true,
3317         }
3318 }
3319 #[no_mangle]
3320 /// Creates a new CResult_WitnessNoneZ in the error state.
3321 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
3322         CResult_WitnessNoneZ {
3323                 contents: CResult_WitnessNoneZPtr {
3324                         err: core::ptr::null_mut(),
3325                 },
3326                 result_ok: false,
3327         }
3328 }
3329 /// Checks if the given object is currently in the success state
3330 #[no_mangle]
3331 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
3332         o.result_ok
3333 }
3334 #[no_mangle]
3335 /// Frees any resources used by the CResult_WitnessNoneZ.
3336 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
3337 impl Drop for CResult_WitnessNoneZ {
3338         fn drop(&mut self) {
3339                 if self.result_ok {
3340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3342                         }
3343                 } else {
3344                 }
3345         }
3346 }
3347 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
3348         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
3349                 let contents = if o.result_ok {
3350                         let result = unsafe { o.contents.result };
3351                         unsafe { o.contents.result = core::ptr::null_mut() };
3352                         CResult_WitnessNoneZPtr { result }
3353                 } else {
3354                         let _ = unsafe { Box::from_raw(o.contents.err) };
3355                         o.contents.err = core::ptr::null_mut();
3356                         CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
3357                 };
3358                 Self {
3359                         contents,
3360                         result_ok: o.result_ok,
3361                 }
3362         }
3363 }
3364 impl Clone for CResult_WitnessNoneZ {
3365         fn clone(&self) -> Self {
3366                 if self.result_ok {
3367                         Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
3368                                 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
3369                         } }
3370                 } else {
3371                         Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
3372                                 err: core::ptr::null_mut()
3373                         } }
3374                 }
3375         }
3376 }
3377 #[no_mangle]
3378 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
3379 /// but with all dynamically-allocated buffers duplicated in new buffers.
3380 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
3381 #[repr(C)]
3382 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
3383 /// This corresponds to std::vector in C++
3384 pub struct CVec_ECDSASignatureZ {
3385         /// The elements in the array.
3386         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3387         pub data: *mut crate::c_types::ECDSASignature,
3388         /// The number of elements pointed to by `data`.
3389         pub datalen: usize
3390 }
3391 impl CVec_ECDSASignatureZ {
3392         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
3393                 if self.datalen == 0 { return Vec::new(); }
3394                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3395                 self.data = core::ptr::null_mut();
3396                 self.datalen = 0;
3397                 ret
3398         }
3399         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
3400                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3401         }
3402 }
3403 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
3404         fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
3405                 let datalen = v.len();
3406                 let data = Box::into_raw(v.into_boxed_slice());
3407                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3408         }
3409 }
3410 #[no_mangle]
3411 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3412 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
3413 impl Drop for CVec_ECDSASignatureZ {
3414         fn drop(&mut self) {
3415                 if self.datalen == 0 { return; }
3416                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3417         }
3418 }
3419 impl Clone for CVec_ECDSASignatureZ {
3420         fn clone(&self) -> Self {
3421                 let mut res = Vec::new();
3422                 if self.datalen == 0 { return Self::from(res); }
3423                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3424                 Self::from(res)
3425         }
3426 }
3427 #[repr(C)]
3428 /// A tuple of 2 elements. See the individual fields for the types contained.
3429 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3430         /// The element at position 0
3431         pub a: crate::c_types::ECDSASignature,
3432         /// The element at position 1
3433         pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
3434 }
3435 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3436         fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
3437                 Self {
3438                         a: tup.0,
3439                         b: tup.1,
3440                 }
3441         }
3442 }
3443 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3444         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
3445                 (self.a, self.b)
3446         }
3447 }
3448 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3449         fn clone(&self) -> Self {
3450                 Self {
3451                         a: Clone::clone(&self.a),
3452                         b: Clone::clone(&self.b),
3453                 }
3454         }
3455 }
3456 #[no_mangle]
3457 /// Creates a new tuple which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
3460 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
3461 #[no_mangle]
3462 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3463         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
3464 }
3465
3466 #[no_mangle]
3467 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
3468 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
3469 #[repr(C)]
3470 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
3471 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3472         /// A pointer to the contents in the success state.
3473         /// Reading from this pointer when `result_ok` is not set is undefined.
3474         pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
3475         /// Note that this value is always NULL, as there are no contents in the Err variant
3476         pub err: *mut core::ffi::c_void,
3477 }
3478 #[repr(C)]
3479 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
3480 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
3481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3482 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3483         /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
3484         /// `err` or `result` depending on the state of `result_ok`.
3485         pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
3486         /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
3487         pub result_ok: bool,
3488 }
3489 #[no_mangle]
3490 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
3491 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3492         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3493                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3494                         result: Box::into_raw(Box::new(o)),
3495                 },
3496                 result_ok: true,
3497         }
3498 }
3499 #[no_mangle]
3500 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
3501 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3502         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3503                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3504                         err: core::ptr::null_mut(),
3505                 },
3506                 result_ok: false,
3507         }
3508 }
3509 /// Checks if the given object is currently in the success state
3510 #[no_mangle]
3511 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
3512         o.result_ok
3513 }
3514 #[no_mangle]
3515 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3516 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3517 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3518         fn drop(&mut self) {
3519                 if self.result_ok {
3520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3522                         }
3523                 } else {
3524                 }
3525         }
3526 }
3527 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3528         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3529                 let contents = if o.result_ok {
3530                         let result = unsafe { o.contents.result };
3531                         unsafe { o.contents.result = core::ptr::null_mut() };
3532                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3533                 } else {
3534                         let _ = unsafe { Box::from_raw(o.contents.err) };
3535                         o.contents.err = core::ptr::null_mut();
3536                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3537                 };
3538                 Self {
3539                         contents,
3540                         result_ok: o.result_ok,
3541                 }
3542         }
3543 }
3544 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3545         fn clone(&self) -> Self {
3546                 if self.result_ok {
3547                         Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3548                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3549                         } }
3550                 } else {
3551                         Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3552                                 err: core::ptr::null_mut()
3553                         } }
3554                 }
3555         }
3556 }
3557 #[no_mangle]
3558 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3559 /// but with all dynamically-allocated buffers duplicated in new buffers.
3560 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3561 #[repr(C)]
3562 /// The contents of CResult_InMemorySignerDecodeErrorZ
3563 pub union CResult_InMemorySignerDecodeErrorZPtr {
3564         /// A pointer to the contents in the success state.
3565         /// Reading from this pointer when `result_ok` is not set is undefined.
3566         pub result: *mut crate::lightning::sign::InMemorySigner,
3567         /// A pointer to the contents in the error state.
3568         /// Reading from this pointer when `result_ok` is set is undefined.
3569         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3570 }
3571 #[repr(C)]
3572 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3573 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3575 pub struct CResult_InMemorySignerDecodeErrorZ {
3576         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3577         /// `err` or `result` depending on the state of `result_ok`.
3578         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3579         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3580         pub result_ok: bool,
3581 }
3582 #[no_mangle]
3583 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3584 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3585         CResult_InMemorySignerDecodeErrorZ {
3586                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3587                         result: Box::into_raw(Box::new(o)),
3588                 },
3589                 result_ok: true,
3590         }
3591 }
3592 #[no_mangle]
3593 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3594 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3595         CResult_InMemorySignerDecodeErrorZ {
3596                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3597                         err: Box::into_raw(Box::new(e)),
3598                 },
3599                 result_ok: false,
3600         }
3601 }
3602 /// Checks if the given object is currently in the success state
3603 #[no_mangle]
3604 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3605         o.result_ok
3606 }
3607 #[no_mangle]
3608 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3610 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3611         fn drop(&mut self) {
3612                 if self.result_ok {
3613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3615                         }
3616                 } else {
3617                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3618                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3619                         }
3620                 }
3621         }
3622 }
3623 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3624         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3625                 let contents = if o.result_ok {
3626                         let result = unsafe { o.contents.result };
3627                         unsafe { o.contents.result = core::ptr::null_mut() };
3628                         CResult_InMemorySignerDecodeErrorZPtr { result }
3629                 } else {
3630                         let err = unsafe { o.contents.err };
3631                         unsafe { o.contents.err = core::ptr::null_mut(); }
3632                         CResult_InMemorySignerDecodeErrorZPtr { err }
3633                 };
3634                 Self {
3635                         contents,
3636                         result_ok: o.result_ok,
3637                 }
3638         }
3639 }
3640 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3641         fn clone(&self) -> Self {
3642                 if self.result_ok {
3643                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3644                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3645                         } }
3646                 } else {
3647                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3648                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3649                         } }
3650                 }
3651         }
3652 }
3653 #[no_mangle]
3654 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3655 /// but with all dynamically-allocated buffers duplicated in new buffers.
3656 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3657 #[repr(C)]
3658 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3659 pub enum COption_WriteableScoreZ {
3660         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3661         Some(crate::lightning::routing::scoring::WriteableScore),
3662         /// When we're in this state, this COption_WriteableScoreZ contains nothing
3663         None
3664 }
3665 impl COption_WriteableScoreZ {
3666         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3667                 if let Self::None = self { false } else { true }
3668         }
3669         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3670                 !self.is_some()
3671         }
3672         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3673                 if let Self::Some(v) = self { v } else { unreachable!() }
3674         }
3675 }
3676 #[no_mangle]
3677 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3678 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3679         COption_WriteableScoreZ::Some(o)
3680 }
3681 #[no_mangle]
3682 /// Constructs a new COption_WriteableScoreZ containing nothing
3683 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3684         COption_WriteableScoreZ::None
3685 }
3686 #[no_mangle]
3687 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3688 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3689 #[repr(C)]
3690 /// The contents of CResult_NoneIOErrorZ
3691 pub union CResult_NoneIOErrorZPtr {
3692         /// Note that this value is always NULL, as there are no contents in the OK variant
3693         pub result: *mut core::ffi::c_void,
3694         /// A pointer to the contents in the error state.
3695         /// Reading from this pointer when `result_ok` is set is undefined.
3696         pub err: *mut crate::c_types::IOError,
3697 }
3698 #[repr(C)]
3699 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3700 /// containing a () on success and a crate::c_types::IOError on failure.
3701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3702 pub struct CResult_NoneIOErrorZ {
3703         /// The contents of this CResult_NoneIOErrorZ, accessible via either
3704         /// `err` or `result` depending on the state of `result_ok`.
3705         pub contents: CResult_NoneIOErrorZPtr,
3706         /// Whether this CResult_NoneIOErrorZ represents a success state.
3707         pub result_ok: bool,
3708 }
3709 #[no_mangle]
3710 /// Creates a new CResult_NoneIOErrorZ in the success state.
3711 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3712         CResult_NoneIOErrorZ {
3713                 contents: CResult_NoneIOErrorZPtr {
3714                         result: core::ptr::null_mut(),
3715                 },
3716                 result_ok: true,
3717         }
3718 }
3719 #[no_mangle]
3720 /// Creates a new CResult_NoneIOErrorZ in the error state.
3721 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3722         CResult_NoneIOErrorZ {
3723                 contents: CResult_NoneIOErrorZPtr {
3724                         err: Box::into_raw(Box::new(e)),
3725                 },
3726                 result_ok: false,
3727         }
3728 }
3729 /// Checks if the given object is currently in the success state
3730 #[no_mangle]
3731 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3732         o.result_ok
3733 }
3734 #[no_mangle]
3735 /// Frees any resources used by the CResult_NoneIOErrorZ.
3736 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3737 impl Drop for CResult_NoneIOErrorZ {
3738         fn drop(&mut self) {
3739                 if self.result_ok {
3740                 } else {
3741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3743                         }
3744                 }
3745         }
3746 }
3747 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3748         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3749                 let contents = if o.result_ok {
3750                         let _ = unsafe { Box::from_raw(o.contents.result) };
3751                         o.contents.result = core::ptr::null_mut();
3752                         CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3753                 } else {
3754                         let err = unsafe { o.contents.err };
3755                         unsafe { o.contents.err = core::ptr::null_mut(); }
3756                         CResult_NoneIOErrorZPtr { err }
3757                 };
3758                 Self {
3759                         contents,
3760                         result_ok: o.result_ok,
3761                 }
3762         }
3763 }
3764 impl Clone for CResult_NoneIOErrorZ {
3765         fn clone(&self) -> Self {
3766                 if self.result_ok {
3767                         Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3768                                 result: core::ptr::null_mut()
3769                         } }
3770                 } else {
3771                         Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3772                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3773                         } }
3774                 }
3775         }
3776 }
3777 #[no_mangle]
3778 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3779 /// but with all dynamically-allocated buffers duplicated in new buffers.
3780 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3781 #[repr(C)]
3782 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3783 /// This corresponds to std::vector in C++
3784 pub struct CVec_ChannelDetailsZ {
3785         /// The elements in the array.
3786         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3787         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3788         /// The number of elements pointed to by `data`.
3789         pub datalen: usize
3790 }
3791 impl CVec_ChannelDetailsZ {
3792         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3793                 if self.datalen == 0 { return Vec::new(); }
3794                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3795                 self.data = core::ptr::null_mut();
3796                 self.datalen = 0;
3797                 ret
3798         }
3799         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3800                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3801         }
3802 }
3803 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3804         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3805                 let datalen = v.len();
3806                 let data = Box::into_raw(v.into_boxed_slice());
3807                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3808         }
3809 }
3810 #[no_mangle]
3811 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3812 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3813 impl Drop for CVec_ChannelDetailsZ {
3814         fn drop(&mut self) {
3815                 if self.datalen == 0 { return; }
3816                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3817         }
3818 }
3819 impl Clone for CVec_ChannelDetailsZ {
3820         fn clone(&self) -> Self {
3821                 let mut res = Vec::new();
3822                 if self.datalen == 0 { return Self::from(res); }
3823                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3824                 Self::from(res)
3825         }
3826 }
3827 #[repr(C)]
3828 /// The contents of CResult_RouteLightningErrorZ
3829 pub union CResult_RouteLightningErrorZPtr {
3830         /// A pointer to the contents in the success state.
3831         /// Reading from this pointer when `result_ok` is not set is undefined.
3832         pub result: *mut crate::lightning::routing::router::Route,
3833         /// A pointer to the contents in the error state.
3834         /// Reading from this pointer when `result_ok` is set is undefined.
3835         pub err: *mut crate::lightning::ln::msgs::LightningError,
3836 }
3837 #[repr(C)]
3838 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3839 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3841 pub struct CResult_RouteLightningErrorZ {
3842         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3843         /// `err` or `result` depending on the state of `result_ok`.
3844         pub contents: CResult_RouteLightningErrorZPtr,
3845         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3846         pub result_ok: bool,
3847 }
3848 #[no_mangle]
3849 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3850 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3851         CResult_RouteLightningErrorZ {
3852                 contents: CResult_RouteLightningErrorZPtr {
3853                         result: Box::into_raw(Box::new(o)),
3854                 },
3855                 result_ok: true,
3856         }
3857 }
3858 #[no_mangle]
3859 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3860 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3861         CResult_RouteLightningErrorZ {
3862                 contents: CResult_RouteLightningErrorZPtr {
3863                         err: Box::into_raw(Box::new(e)),
3864                 },
3865                 result_ok: false,
3866         }
3867 }
3868 /// Checks if the given object is currently in the success state
3869 #[no_mangle]
3870 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3871         o.result_ok
3872 }
3873 #[no_mangle]
3874 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3875 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3876 impl Drop for CResult_RouteLightningErrorZ {
3877         fn drop(&mut self) {
3878                 if self.result_ok {
3879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3881                         }
3882                 } else {
3883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3885                         }
3886                 }
3887         }
3888 }
3889 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3890         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3891                 let contents = if o.result_ok {
3892                         let result = unsafe { o.contents.result };
3893                         unsafe { o.contents.result = core::ptr::null_mut() };
3894                         CResult_RouteLightningErrorZPtr { result }
3895                 } else {
3896                         let err = unsafe { o.contents.err };
3897                         unsafe { o.contents.err = core::ptr::null_mut(); }
3898                         CResult_RouteLightningErrorZPtr { err }
3899                 };
3900                 Self {
3901                         contents,
3902                         result_ok: o.result_ok,
3903                 }
3904         }
3905 }
3906 impl Clone for CResult_RouteLightningErrorZ {
3907         fn clone(&self) -> Self {
3908                 if self.result_ok {
3909                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3910                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3911                         } }
3912                 } else {
3913                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3914                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3915                         } }
3916                 }
3917         }
3918 }
3919 #[no_mangle]
3920 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3921 /// but with all dynamically-allocated buffers duplicated in new buffers.
3922 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3923 #[repr(C)]
3924 /// A tuple of 2 elements. See the individual fields for the types contained.
3925 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3926         /// The element at position 0
3927         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3928         /// The element at position 1
3929         pub b: crate::lightning::blinded_path::BlindedPath,
3930 }
3931 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3932         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3933                 Self {
3934                         a: tup.0,
3935                         b: tup.1,
3936                 }
3937         }
3938 }
3939 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3941                 (self.a, self.b)
3942         }
3943 }
3944 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3945         fn clone(&self) -> Self {
3946                 Self {
3947                         a: Clone::clone(&self.a),
3948                         b: Clone::clone(&self.b),
3949                 }
3950         }
3951 }
3952 #[no_mangle]
3953 /// Creates a new tuple which has the same data as `orig`
3954 /// but with all dynamically-allocated buffers duplicated in new buffers.
3955 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3956 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3957 #[no_mangle]
3958 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3959         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3960 }
3961
3962 #[no_mangle]
3963 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3964 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3965 #[repr(C)]
3966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3967 /// This corresponds to std::vector in C++
3968 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3969         /// The elements in the array.
3970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3971         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3972         /// The number of elements pointed to by `data`.
3973         pub datalen: usize
3974 }
3975 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3977                 if self.datalen == 0 { return Vec::new(); }
3978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3979                 self.data = core::ptr::null_mut();
3980                 self.datalen = 0;
3981                 ret
3982         }
3983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3985         }
3986 }
3987 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3988         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3989                 let datalen = v.len();
3990                 let data = Box::into_raw(v.into_boxed_slice());
3991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3992         }
3993 }
3994 #[no_mangle]
3995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3996 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3997 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3998         fn drop(&mut self) {
3999                 if self.datalen == 0 { return; }
4000                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4001         }
4002 }
4003 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4004         fn clone(&self) -> Self {
4005                 let mut res = Vec::new();
4006                 if self.datalen == 0 { return Self::from(res); }
4007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4008                 Self::from(res)
4009         }
4010 }
4011 #[repr(C)]
4012 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
4013 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4014         /// A pointer to the contents in the success state.
4015         /// Reading from this pointer when `result_ok` is not set is undefined.
4016         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
4017         /// Note that this value is always NULL, as there are no contents in the Err variant
4018         pub err: *mut core::ffi::c_void,
4019 }
4020 #[repr(C)]
4021 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
4022 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
4023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4024 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4025         /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
4026         /// `err` or `result` depending on the state of `result_ok`.
4027         pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
4028         /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
4029         pub result_ok: bool,
4030 }
4031 #[no_mangle]
4032 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
4033 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4034         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4035                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4036                         result: Box::into_raw(Box::new(o)),
4037                 },
4038                 result_ok: true,
4039         }
4040 }
4041 #[no_mangle]
4042 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
4043 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4044         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4045                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4046                         err: core::ptr::null_mut(),
4047                 },
4048                 result_ok: false,
4049         }
4050 }
4051 /// Checks if the given object is currently in the success state
4052 #[no_mangle]
4053 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
4054         o.result_ok
4055 }
4056 #[no_mangle]
4057 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
4058 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
4059 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4060         fn drop(&mut self) {
4061                 if self.result_ok {
4062                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4063                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4064                         }
4065                 } else {
4066                 }
4067         }
4068 }
4069 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4070         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
4071                 let contents = if o.result_ok {
4072                         let result = unsafe { o.contents.result };
4073                         unsafe { o.contents.result = core::ptr::null_mut() };
4074                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
4075                 } else {
4076                         let _ = unsafe { Box::from_raw(o.contents.err) };
4077                         o.contents.err = core::ptr::null_mut();
4078                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
4079                 };
4080                 Self {
4081                         contents,
4082                         result_ok: o.result_ok,
4083                 }
4084         }
4085 }
4086 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4087         fn clone(&self) -> Self {
4088                 if self.result_ok {
4089                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4090                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
4091                         } }
4092                 } else {
4093                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4094                                 err: core::ptr::null_mut()
4095                         } }
4096                 }
4097         }
4098 }
4099 #[no_mangle]
4100 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
4101 /// but with all dynamically-allocated buffers duplicated in new buffers.
4102 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
4103 #[repr(C)]
4104 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4105 /// This corresponds to std::vector in C++
4106 pub struct CVec_PublicKeyZ {
4107         /// The elements in the array.
4108         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4109         pub data: *mut crate::c_types::PublicKey,
4110         /// The number of elements pointed to by `data`.
4111         pub datalen: usize
4112 }
4113 impl CVec_PublicKeyZ {
4114         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4115                 if self.datalen == 0 { return Vec::new(); }
4116                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4117                 self.data = core::ptr::null_mut();
4118                 self.datalen = 0;
4119                 ret
4120         }
4121         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4122                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4123         }
4124 }
4125 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4126         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4127                 let datalen = v.len();
4128                 let data = Box::into_raw(v.into_boxed_slice());
4129                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4130         }
4131 }
4132 #[no_mangle]
4133 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4134 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4135 impl Drop for CVec_PublicKeyZ {
4136         fn drop(&mut self) {
4137                 if self.datalen == 0 { return; }
4138                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4139         }
4140 }
4141 impl Clone for CVec_PublicKeyZ {
4142         fn clone(&self) -> Self {
4143                 let mut res = Vec::new();
4144                 if self.datalen == 0 { return Self::from(res); }
4145                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4146                 Self::from(res)
4147         }
4148 }
4149 #[repr(C)]
4150 /// The contents of CResult_OnionMessagePathNoneZ
4151 pub union CResult_OnionMessagePathNoneZPtr {
4152         /// A pointer to the contents in the success state.
4153         /// Reading from this pointer when `result_ok` is not set is undefined.
4154         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
4155         /// Note that this value is always NULL, as there are no contents in the Err variant
4156         pub err: *mut core::ffi::c_void,
4157 }
4158 #[repr(C)]
4159 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
4160 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
4161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4162 pub struct CResult_OnionMessagePathNoneZ {
4163         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
4164         /// `err` or `result` depending on the state of `result_ok`.
4165         pub contents: CResult_OnionMessagePathNoneZPtr,
4166         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
4167         pub result_ok: bool,
4168 }
4169 #[no_mangle]
4170 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
4171 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
4172         CResult_OnionMessagePathNoneZ {
4173                 contents: CResult_OnionMessagePathNoneZPtr {
4174                         result: Box::into_raw(Box::new(o)),
4175                 },
4176                 result_ok: true,
4177         }
4178 }
4179 #[no_mangle]
4180 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
4181 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
4182         CResult_OnionMessagePathNoneZ {
4183                 contents: CResult_OnionMessagePathNoneZPtr {
4184                         err: core::ptr::null_mut(),
4185                 },
4186                 result_ok: false,
4187         }
4188 }
4189 /// Checks if the given object is currently in the success state
4190 #[no_mangle]
4191 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
4192         o.result_ok
4193 }
4194 #[no_mangle]
4195 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
4196 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
4197 impl Drop for CResult_OnionMessagePathNoneZ {
4198         fn drop(&mut self) {
4199                 if self.result_ok {
4200                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4201                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4202                         }
4203                 } else {
4204                 }
4205         }
4206 }
4207 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
4208         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
4209                 let contents = if o.result_ok {
4210                         let result = unsafe { o.contents.result };
4211                         unsafe { o.contents.result = core::ptr::null_mut() };
4212                         CResult_OnionMessagePathNoneZPtr { result }
4213                 } else {
4214                         let _ = unsafe { Box::from_raw(o.contents.err) };
4215                         o.contents.err = core::ptr::null_mut();
4216                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
4217                 };
4218                 Self {
4219                         contents,
4220                         result_ok: o.result_ok,
4221                 }
4222         }
4223 }
4224 impl Clone for CResult_OnionMessagePathNoneZ {
4225         fn clone(&self) -> Self {
4226                 if self.result_ok {
4227                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
4228                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
4229                         } }
4230                 } else {
4231                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
4232                                 err: core::ptr::null_mut()
4233                         } }
4234                 }
4235         }
4236 }
4237 #[no_mangle]
4238 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
4239 /// but with all dynamically-allocated buffers duplicated in new buffers.
4240 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
4241 #[repr(C)]
4242 /// The contents of CResult_CVec_BlindedPathZNoneZ
4243 pub union CResult_CVec_BlindedPathZNoneZPtr {
4244         /// A pointer to the contents in the success state.
4245         /// Reading from this pointer when `result_ok` is not set is undefined.
4246         pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
4247         /// Note that this value is always NULL, as there are no contents in the Err variant
4248         pub err: *mut core::ffi::c_void,
4249 }
4250 #[repr(C)]
4251 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
4252 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
4253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4254 pub struct CResult_CVec_BlindedPathZNoneZ {
4255         /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
4256         /// `err` or `result` depending on the state of `result_ok`.
4257         pub contents: CResult_CVec_BlindedPathZNoneZPtr,
4258         /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
4259         pub result_ok: bool,
4260 }
4261 #[no_mangle]
4262 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
4263 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
4264         CResult_CVec_BlindedPathZNoneZ {
4265                 contents: CResult_CVec_BlindedPathZNoneZPtr {
4266                         result: Box::into_raw(Box::new(o)),
4267                 },
4268                 result_ok: true,
4269         }
4270 }
4271 #[no_mangle]
4272 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
4273 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
4274         CResult_CVec_BlindedPathZNoneZ {
4275                 contents: CResult_CVec_BlindedPathZNoneZPtr {
4276                         err: core::ptr::null_mut(),
4277                 },
4278                 result_ok: false,
4279         }
4280 }
4281 /// Checks if the given object is currently in the success state
4282 #[no_mangle]
4283 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
4284         o.result_ok
4285 }
4286 #[no_mangle]
4287 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
4288 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
4289 impl Drop for CResult_CVec_BlindedPathZNoneZ {
4290         fn drop(&mut self) {
4291                 if self.result_ok {
4292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4294                         }
4295                 } else {
4296                 }
4297         }
4298 }
4299 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
4300         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
4301                 let contents = if o.result_ok {
4302                         let result = unsafe { o.contents.result };
4303                         unsafe { o.contents.result = core::ptr::null_mut() };
4304                         CResult_CVec_BlindedPathZNoneZPtr { result }
4305                 } else {
4306                         let _ = unsafe { Box::from_raw(o.contents.err) };
4307                         o.contents.err = core::ptr::null_mut();
4308                         CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
4309                 };
4310                 Self {
4311                         contents,
4312                         result_ok: o.result_ok,
4313                 }
4314         }
4315 }
4316 impl Clone for CResult_CVec_BlindedPathZNoneZ {
4317         fn clone(&self) -> Self {
4318                 if self.result_ok {
4319                         Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
4320                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
4321                         } }
4322                 } else {
4323                         Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
4324                                 err: core::ptr::null_mut()
4325                         } }
4326                 }
4327         }
4328 }
4329 #[no_mangle]
4330 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
4331 /// but with all dynamically-allocated buffers duplicated in new buffers.
4332 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
4333 #[repr(C)]
4334 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
4335 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
4336         /// A pointer to the contents in the success state.
4337         /// Reading from this pointer when `result_ok` is not set is undefined.
4338         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
4339         /// A pointer to the contents in the error state.
4340         /// Reading from this pointer when `result_ok` is set is undefined.
4341         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4342 }
4343 #[repr(C)]
4344 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
4345 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
4346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4347 pub struct CResult_InFlightHtlcsDecodeErrorZ {
4348         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
4349         /// `err` or `result` depending on the state of `result_ok`.
4350         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
4351         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
4352         pub result_ok: bool,
4353 }
4354 #[no_mangle]
4355 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
4356 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
4357         CResult_InFlightHtlcsDecodeErrorZ {
4358                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4359                         result: Box::into_raw(Box::new(o)),
4360                 },
4361                 result_ok: true,
4362         }
4363 }
4364 #[no_mangle]
4365 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
4366 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
4367         CResult_InFlightHtlcsDecodeErrorZ {
4368                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4369                         err: Box::into_raw(Box::new(e)),
4370                 },
4371                 result_ok: false,
4372         }
4373 }
4374 /// Checks if the given object is currently in the success state
4375 #[no_mangle]
4376 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
4377         o.result_ok
4378 }
4379 #[no_mangle]
4380 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
4381 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
4382 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
4383         fn drop(&mut self) {
4384                 if self.result_ok {
4385                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4386                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4387                         }
4388                 } else {
4389                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4390                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4391                         }
4392                 }
4393         }
4394 }
4395 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
4396         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
4397                 let contents = if o.result_ok {
4398                         let result = unsafe { o.contents.result };
4399                         unsafe { o.contents.result = core::ptr::null_mut() };
4400                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
4401                 } else {
4402                         let err = unsafe { o.contents.err };
4403                         unsafe { o.contents.err = core::ptr::null_mut(); }
4404                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
4405                 };
4406                 Self {
4407                         contents,
4408                         result_ok: o.result_ok,
4409                 }
4410         }
4411 }
4412 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
4413         fn clone(&self) -> Self {
4414                 if self.result_ok {
4415                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4416                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
4417                         } }
4418                 } else {
4419                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4420                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4421                         } }
4422                 }
4423         }
4424 }
4425 #[no_mangle]
4426 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4427 /// but with all dynamically-allocated buffers duplicated in new buffers.
4428 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4429 #[repr(C)]
4430 /// The contents of CResult_RouteHopDecodeErrorZ
4431 pub union CResult_RouteHopDecodeErrorZPtr {
4432         /// A pointer to the contents in the success state.
4433         /// Reading from this pointer when `result_ok` is not set is undefined.
4434         pub result: *mut crate::lightning::routing::router::RouteHop,
4435         /// A pointer to the contents in the error state.
4436         /// Reading from this pointer when `result_ok` is set is undefined.
4437         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4438 }
4439 #[repr(C)]
4440 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4441 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4443 pub struct CResult_RouteHopDecodeErrorZ {
4444         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4445         /// `err` or `result` depending on the state of `result_ok`.
4446         pub contents: CResult_RouteHopDecodeErrorZPtr,
4447         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4448         pub result_ok: bool,
4449 }
4450 #[no_mangle]
4451 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4452 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4453         CResult_RouteHopDecodeErrorZ {
4454                 contents: CResult_RouteHopDecodeErrorZPtr {
4455                         result: Box::into_raw(Box::new(o)),
4456                 },
4457                 result_ok: true,
4458         }
4459 }
4460 #[no_mangle]
4461 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4462 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4463         CResult_RouteHopDecodeErrorZ {
4464                 contents: CResult_RouteHopDecodeErrorZPtr {
4465                         err: Box::into_raw(Box::new(e)),
4466                 },
4467                 result_ok: false,
4468         }
4469 }
4470 /// Checks if the given object is currently in the success state
4471 #[no_mangle]
4472 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4473         o.result_ok
4474 }
4475 #[no_mangle]
4476 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4477 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4478 impl Drop for CResult_RouteHopDecodeErrorZ {
4479         fn drop(&mut self) {
4480                 if self.result_ok {
4481                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4482                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4483                         }
4484                 } else {
4485                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4486                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4487                         }
4488                 }
4489         }
4490 }
4491 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4492         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4493                 let contents = if o.result_ok {
4494                         let result = unsafe { o.contents.result };
4495                         unsafe { o.contents.result = core::ptr::null_mut() };
4496                         CResult_RouteHopDecodeErrorZPtr { result }
4497                 } else {
4498                         let err = unsafe { o.contents.err };
4499                         unsafe { o.contents.err = core::ptr::null_mut(); }
4500                         CResult_RouteHopDecodeErrorZPtr { err }
4501                 };
4502                 Self {
4503                         contents,
4504                         result_ok: o.result_ok,
4505                 }
4506         }
4507 }
4508 impl Clone for CResult_RouteHopDecodeErrorZ {
4509         fn clone(&self) -> Self {
4510                 if self.result_ok {
4511                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4512                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4513                         } }
4514                 } else {
4515                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4516                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4517                         } }
4518                 }
4519         }
4520 }
4521 #[no_mangle]
4522 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4523 /// but with all dynamically-allocated buffers duplicated in new buffers.
4524 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4525 #[repr(C)]
4526 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4527 /// This corresponds to std::vector in C++
4528 pub struct CVec_BlindedHopZ {
4529         /// The elements in the array.
4530         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4531         pub data: *mut crate::lightning::blinded_path::BlindedHop,
4532         /// The number of elements pointed to by `data`.
4533         pub datalen: usize
4534 }
4535 impl CVec_BlindedHopZ {
4536         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4537                 if self.datalen == 0 { return Vec::new(); }
4538                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4539                 self.data = core::ptr::null_mut();
4540                 self.datalen = 0;
4541                 ret
4542         }
4543         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4544                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4545         }
4546 }
4547 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4548         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4549                 let datalen = v.len();
4550                 let data = Box::into_raw(v.into_boxed_slice());
4551                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4552         }
4553 }
4554 #[no_mangle]
4555 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4556 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4557 impl Drop for CVec_BlindedHopZ {
4558         fn drop(&mut self) {
4559                 if self.datalen == 0 { return; }
4560                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4561         }
4562 }
4563 impl Clone for CVec_BlindedHopZ {
4564         fn clone(&self) -> Self {
4565                 let mut res = Vec::new();
4566                 if self.datalen == 0 { return Self::from(res); }
4567                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4568                 Self::from(res)
4569         }
4570 }
4571 #[repr(C)]
4572 /// The contents of CResult_BlindedTailDecodeErrorZ
4573 pub union CResult_BlindedTailDecodeErrorZPtr {
4574         /// A pointer to the contents in the success state.
4575         /// Reading from this pointer when `result_ok` is not set is undefined.
4576         pub result: *mut crate::lightning::routing::router::BlindedTail,
4577         /// A pointer to the contents in the error state.
4578         /// Reading from this pointer when `result_ok` is set is undefined.
4579         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4580 }
4581 #[repr(C)]
4582 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4583 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4585 pub struct CResult_BlindedTailDecodeErrorZ {
4586         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4587         /// `err` or `result` depending on the state of `result_ok`.
4588         pub contents: CResult_BlindedTailDecodeErrorZPtr,
4589         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4590         pub result_ok: bool,
4591 }
4592 #[no_mangle]
4593 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4594 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4595         CResult_BlindedTailDecodeErrorZ {
4596                 contents: CResult_BlindedTailDecodeErrorZPtr {
4597                         result: Box::into_raw(Box::new(o)),
4598                 },
4599                 result_ok: true,
4600         }
4601 }
4602 #[no_mangle]
4603 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4604 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4605         CResult_BlindedTailDecodeErrorZ {
4606                 contents: CResult_BlindedTailDecodeErrorZPtr {
4607                         err: Box::into_raw(Box::new(e)),
4608                 },
4609                 result_ok: false,
4610         }
4611 }
4612 /// Checks if the given object is currently in the success state
4613 #[no_mangle]
4614 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4615         o.result_ok
4616 }
4617 #[no_mangle]
4618 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4619 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4620 impl Drop for CResult_BlindedTailDecodeErrorZ {
4621         fn drop(&mut self) {
4622                 if self.result_ok {
4623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4625                         }
4626                 } else {
4627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4629                         }
4630                 }
4631         }
4632 }
4633 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4634         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4635                 let contents = if o.result_ok {
4636                         let result = unsafe { o.contents.result };
4637                         unsafe { o.contents.result = core::ptr::null_mut() };
4638                         CResult_BlindedTailDecodeErrorZPtr { result }
4639                 } else {
4640                         let err = unsafe { o.contents.err };
4641                         unsafe { o.contents.err = core::ptr::null_mut(); }
4642                         CResult_BlindedTailDecodeErrorZPtr { err }
4643                 };
4644                 Self {
4645                         contents,
4646                         result_ok: o.result_ok,
4647                 }
4648         }
4649 }
4650 impl Clone for CResult_BlindedTailDecodeErrorZ {
4651         fn clone(&self) -> Self {
4652                 if self.result_ok {
4653                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4654                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4655                         } }
4656                 } else {
4657                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4658                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4659                         } }
4660                 }
4661         }
4662 }
4663 #[no_mangle]
4664 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4665 /// but with all dynamically-allocated buffers duplicated in new buffers.
4666 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4667 #[repr(C)]
4668 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4669 /// This corresponds to std::vector in C++
4670 pub struct CVec_RouteHopZ {
4671         /// The elements in the array.
4672         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4673         pub data: *mut crate::lightning::routing::router::RouteHop,
4674         /// The number of elements pointed to by `data`.
4675         pub datalen: usize
4676 }
4677 impl CVec_RouteHopZ {
4678         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4679                 if self.datalen == 0 { return Vec::new(); }
4680                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4681                 self.data = core::ptr::null_mut();
4682                 self.datalen = 0;
4683                 ret
4684         }
4685         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4686                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4687         }
4688 }
4689 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4690         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4691                 let datalen = v.len();
4692                 let data = Box::into_raw(v.into_boxed_slice());
4693                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4694         }
4695 }
4696 #[no_mangle]
4697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4698 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4699 impl Drop for CVec_RouteHopZ {
4700         fn drop(&mut self) {
4701                 if self.datalen == 0 { return; }
4702                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4703         }
4704 }
4705 impl Clone for CVec_RouteHopZ {
4706         fn clone(&self) -> Self {
4707                 let mut res = Vec::new();
4708                 if self.datalen == 0 { return Self::from(res); }
4709                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4710                 Self::from(res)
4711         }
4712 }
4713 #[repr(C)]
4714 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4715 /// This corresponds to std::vector in C++
4716 pub struct CVec_PathZ {
4717         /// The elements in the array.
4718         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4719         pub data: *mut crate::lightning::routing::router::Path,
4720         /// The number of elements pointed to by `data`.
4721         pub datalen: usize
4722 }
4723 impl CVec_PathZ {
4724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4725                 if self.datalen == 0 { return Vec::new(); }
4726                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4727                 self.data = core::ptr::null_mut();
4728                 self.datalen = 0;
4729                 ret
4730         }
4731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4732                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4733         }
4734 }
4735 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4736         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4737                 let datalen = v.len();
4738                 let data = Box::into_raw(v.into_boxed_slice());
4739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4740         }
4741 }
4742 #[no_mangle]
4743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4744 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4745 impl Drop for CVec_PathZ {
4746         fn drop(&mut self) {
4747                 if self.datalen == 0 { return; }
4748                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4749         }
4750 }
4751 impl Clone for CVec_PathZ {
4752         fn clone(&self) -> Self {
4753                 let mut res = Vec::new();
4754                 if self.datalen == 0 { return Self::from(res); }
4755                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4756                 Self::from(res)
4757         }
4758 }
4759 #[repr(C)]
4760 /// The contents of CResult_RouteDecodeErrorZ
4761 pub union CResult_RouteDecodeErrorZPtr {
4762         /// A pointer to the contents in the success state.
4763         /// Reading from this pointer when `result_ok` is not set is undefined.
4764         pub result: *mut crate::lightning::routing::router::Route,
4765         /// A pointer to the contents in the error state.
4766         /// Reading from this pointer when `result_ok` is set is undefined.
4767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4768 }
4769 #[repr(C)]
4770 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4771 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4773 pub struct CResult_RouteDecodeErrorZ {
4774         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4775         /// `err` or `result` depending on the state of `result_ok`.
4776         pub contents: CResult_RouteDecodeErrorZPtr,
4777         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4778         pub result_ok: bool,
4779 }
4780 #[no_mangle]
4781 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4782 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4783         CResult_RouteDecodeErrorZ {
4784                 contents: CResult_RouteDecodeErrorZPtr {
4785                         result: Box::into_raw(Box::new(o)),
4786                 },
4787                 result_ok: true,
4788         }
4789 }
4790 #[no_mangle]
4791 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4792 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4793         CResult_RouteDecodeErrorZ {
4794                 contents: CResult_RouteDecodeErrorZPtr {
4795                         err: Box::into_raw(Box::new(e)),
4796                 },
4797                 result_ok: false,
4798         }
4799 }
4800 /// Checks if the given object is currently in the success state
4801 #[no_mangle]
4802 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4803         o.result_ok
4804 }
4805 #[no_mangle]
4806 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4807 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4808 impl Drop for CResult_RouteDecodeErrorZ {
4809         fn drop(&mut self) {
4810                 if self.result_ok {
4811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4813                         }
4814                 } else {
4815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4817                         }
4818                 }
4819         }
4820 }
4821 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4823                 let contents = if o.result_ok {
4824                         let result = unsafe { o.contents.result };
4825                         unsafe { o.contents.result = core::ptr::null_mut() };
4826                         CResult_RouteDecodeErrorZPtr { result }
4827                 } else {
4828                         let err = unsafe { o.contents.err };
4829                         unsafe { o.contents.err = core::ptr::null_mut(); }
4830                         CResult_RouteDecodeErrorZPtr { err }
4831                 };
4832                 Self {
4833                         contents,
4834                         result_ok: o.result_ok,
4835                 }
4836         }
4837 }
4838 impl Clone for CResult_RouteDecodeErrorZ {
4839         fn clone(&self) -> Self {
4840                 if self.result_ok {
4841                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4842                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4843                         } }
4844                 } else {
4845                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4847                         } }
4848                 }
4849         }
4850 }
4851 #[no_mangle]
4852 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4853 /// but with all dynamically-allocated buffers duplicated in new buffers.
4854 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4855 #[repr(C)]
4856 /// The contents of CResult_RouteParametersDecodeErrorZ
4857 pub union CResult_RouteParametersDecodeErrorZPtr {
4858         /// A pointer to the contents in the success state.
4859         /// Reading from this pointer when `result_ok` is not set is undefined.
4860         pub result: *mut crate::lightning::routing::router::RouteParameters,
4861         /// A pointer to the contents in the error state.
4862         /// Reading from this pointer when `result_ok` is set is undefined.
4863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4864 }
4865 #[repr(C)]
4866 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4867 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4869 pub struct CResult_RouteParametersDecodeErrorZ {
4870         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4871         /// `err` or `result` depending on the state of `result_ok`.
4872         pub contents: CResult_RouteParametersDecodeErrorZPtr,
4873         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4874         pub result_ok: bool,
4875 }
4876 #[no_mangle]
4877 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4878 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4879         CResult_RouteParametersDecodeErrorZ {
4880                 contents: CResult_RouteParametersDecodeErrorZPtr {
4881                         result: Box::into_raw(Box::new(o)),
4882                 },
4883                 result_ok: true,
4884         }
4885 }
4886 #[no_mangle]
4887 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4888 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4889         CResult_RouteParametersDecodeErrorZ {
4890                 contents: CResult_RouteParametersDecodeErrorZPtr {
4891                         err: Box::into_raw(Box::new(e)),
4892                 },
4893                 result_ok: false,
4894         }
4895 }
4896 /// Checks if the given object is currently in the success state
4897 #[no_mangle]
4898 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4899         o.result_ok
4900 }
4901 #[no_mangle]
4902 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4903 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4904 impl Drop for CResult_RouteParametersDecodeErrorZ {
4905         fn drop(&mut self) {
4906                 if self.result_ok {
4907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4909                         }
4910                 } else {
4911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4913                         }
4914                 }
4915         }
4916 }
4917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4919                 let contents = if o.result_ok {
4920                         let result = unsafe { o.contents.result };
4921                         unsafe { o.contents.result = core::ptr::null_mut() };
4922                         CResult_RouteParametersDecodeErrorZPtr { result }
4923                 } else {
4924                         let err = unsafe { o.contents.err };
4925                         unsafe { o.contents.err = core::ptr::null_mut(); }
4926                         CResult_RouteParametersDecodeErrorZPtr { err }
4927                 };
4928                 Self {
4929                         contents,
4930                         result_ok: o.result_ok,
4931                 }
4932         }
4933 }
4934 impl Clone for CResult_RouteParametersDecodeErrorZ {
4935         fn clone(&self) -> Self {
4936                 if self.result_ok {
4937                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4938                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4939                         } }
4940                 } else {
4941                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4943                         } }
4944                 }
4945         }
4946 }
4947 #[no_mangle]
4948 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4949 /// but with all dynamically-allocated buffers duplicated in new buffers.
4950 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4951 #[repr(C)]
4952 /// A dynamically-allocated array of u64s of arbitrary size.
4953 /// This corresponds to std::vector in C++
4954 pub struct CVec_u64Z {
4955         /// The elements in the array.
4956         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4957         pub data: *mut u64,
4958         /// The number of elements pointed to by `data`.
4959         pub datalen: usize
4960 }
4961 impl CVec_u64Z {
4962         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4963                 if self.datalen == 0 { return Vec::new(); }
4964                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4965                 self.data = core::ptr::null_mut();
4966                 self.datalen = 0;
4967                 ret
4968         }
4969         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4970                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4971         }
4972 }
4973 impl From<Vec<u64>> for CVec_u64Z {
4974         fn from(v: Vec<u64>) -> Self {
4975                 let datalen = v.len();
4976                 let data = Box::into_raw(v.into_boxed_slice());
4977                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4978         }
4979 }
4980 #[no_mangle]
4981 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4982 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4983 impl Drop for CVec_u64Z {
4984         fn drop(&mut self) {
4985                 if self.datalen == 0 { return; }
4986                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4987         }
4988 }
4989 impl Clone for CVec_u64Z {
4990         fn clone(&self) -> Self {
4991                 let mut res = Vec::new();
4992                 if self.datalen == 0 { return Self::from(res); }
4993                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4994                 Self::from(res)
4995         }
4996 }
4997 #[repr(C)]
4998 /// The contents of CResult_PaymentParametersDecodeErrorZ
4999 pub union CResult_PaymentParametersDecodeErrorZPtr {
5000         /// A pointer to the contents in the success state.
5001         /// Reading from this pointer when `result_ok` is not set is undefined.
5002         pub result: *mut crate::lightning::routing::router::PaymentParameters,
5003         /// A pointer to the contents in the error state.
5004         /// Reading from this pointer when `result_ok` is set is undefined.
5005         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5006 }
5007 #[repr(C)]
5008 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
5009 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
5010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5011 pub struct CResult_PaymentParametersDecodeErrorZ {
5012         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
5013         /// `err` or `result` depending on the state of `result_ok`.
5014         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
5015         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
5016         pub result_ok: bool,
5017 }
5018 #[no_mangle]
5019 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
5020 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
5021         CResult_PaymentParametersDecodeErrorZ {
5022                 contents: CResult_PaymentParametersDecodeErrorZPtr {
5023                         result: Box::into_raw(Box::new(o)),
5024                 },
5025                 result_ok: true,
5026         }
5027 }
5028 #[no_mangle]
5029 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
5030 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
5031         CResult_PaymentParametersDecodeErrorZ {
5032                 contents: CResult_PaymentParametersDecodeErrorZPtr {
5033                         err: Box::into_raw(Box::new(e)),
5034                 },
5035                 result_ok: false,
5036         }
5037 }
5038 /// Checks if the given object is currently in the success state
5039 #[no_mangle]
5040 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
5041         o.result_ok
5042 }
5043 #[no_mangle]
5044 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
5045 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
5046 impl Drop for CResult_PaymentParametersDecodeErrorZ {
5047         fn drop(&mut self) {
5048                 if self.result_ok {
5049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5051                         }
5052                 } else {
5053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5055                         }
5056                 }
5057         }
5058 }
5059 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
5060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
5061                 let contents = if o.result_ok {
5062                         let result = unsafe { o.contents.result };
5063                         unsafe { o.contents.result = core::ptr::null_mut() };
5064                         CResult_PaymentParametersDecodeErrorZPtr { result }
5065                 } else {
5066                         let err = unsafe { o.contents.err };
5067                         unsafe { o.contents.err = core::ptr::null_mut(); }
5068                         CResult_PaymentParametersDecodeErrorZPtr { err }
5069                 };
5070                 Self {
5071                         contents,
5072                         result_ok: o.result_ok,
5073                 }
5074         }
5075 }
5076 impl Clone for CResult_PaymentParametersDecodeErrorZ {
5077         fn clone(&self) -> Self {
5078                 if self.result_ok {
5079                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
5080                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
5081                         } }
5082                 } else {
5083                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
5084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5085                         } }
5086                 }
5087         }
5088 }
5089 #[no_mangle]
5090 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
5091 /// but with all dynamically-allocated buffers duplicated in new buffers.
5092 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
5093 #[repr(C)]
5094 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
5095 /// This corresponds to std::vector in C++
5096 pub struct CVec_RouteHintZ {
5097         /// The elements in the array.
5098         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5099         pub data: *mut crate::lightning::routing::router::RouteHint,
5100         /// The number of elements pointed to by `data`.
5101         pub datalen: usize
5102 }
5103 impl CVec_RouteHintZ {
5104         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
5105                 if self.datalen == 0 { return Vec::new(); }
5106                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5107                 self.data = core::ptr::null_mut();
5108                 self.datalen = 0;
5109                 ret
5110         }
5111         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
5112                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5113         }
5114 }
5115 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
5116         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
5117                 let datalen = v.len();
5118                 let data = Box::into_raw(v.into_boxed_slice());
5119                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5120         }
5121 }
5122 #[no_mangle]
5123 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5124 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5125 impl Drop for CVec_RouteHintZ {
5126         fn drop(&mut self) {
5127                 if self.datalen == 0 { return; }
5128                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5129         }
5130 }
5131 impl Clone for CVec_RouteHintZ {
5132         fn clone(&self) -> Self {
5133                 let mut res = Vec::new();
5134                 if self.datalen == 0 { return Self::from(res); }
5135                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5136                 Self::from(res)
5137         }
5138 }
5139 #[repr(C)]
5140 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
5141 /// This corresponds to std::vector in C++
5142 pub struct CVec_RouteHintHopZ {
5143         /// The elements in the array.
5144         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5145         pub data: *mut crate::lightning::routing::router::RouteHintHop,
5146         /// The number of elements pointed to by `data`.
5147         pub datalen: usize
5148 }
5149 impl CVec_RouteHintHopZ {
5150         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
5151                 if self.datalen == 0 { return Vec::new(); }
5152                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5153                 self.data = core::ptr::null_mut();
5154                 self.datalen = 0;
5155                 ret
5156         }
5157         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
5158                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5159         }
5160 }
5161 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
5162         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
5163                 let datalen = v.len();
5164                 let data = Box::into_raw(v.into_boxed_slice());
5165                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5166         }
5167 }
5168 #[no_mangle]
5169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5170 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
5171 impl Drop for CVec_RouteHintHopZ {
5172         fn drop(&mut self) {
5173                 if self.datalen == 0 { return; }
5174                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5175         }
5176 }
5177 impl Clone for CVec_RouteHintHopZ {
5178         fn clone(&self) -> Self {
5179                 let mut res = Vec::new();
5180                 if self.datalen == 0 { return Self::from(res); }
5181                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5182                 Self::from(res)
5183         }
5184 }
5185 #[repr(C)]
5186 /// The contents of CResult_RouteHintDecodeErrorZ
5187 pub union CResult_RouteHintDecodeErrorZPtr {
5188         /// A pointer to the contents in the success state.
5189         /// Reading from this pointer when `result_ok` is not set is undefined.
5190         pub result: *mut crate::lightning::routing::router::RouteHint,
5191         /// A pointer to the contents in the error state.
5192         /// Reading from this pointer when `result_ok` is set is undefined.
5193         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5194 }
5195 #[repr(C)]
5196 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
5197 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5199 pub struct CResult_RouteHintDecodeErrorZ {
5200         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
5201         /// `err` or `result` depending on the state of `result_ok`.
5202         pub contents: CResult_RouteHintDecodeErrorZPtr,
5203         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
5204         pub result_ok: bool,
5205 }
5206 #[no_mangle]
5207 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
5208 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
5209         CResult_RouteHintDecodeErrorZ {
5210                 contents: CResult_RouteHintDecodeErrorZPtr {
5211                         result: Box::into_raw(Box::new(o)),
5212                 },
5213                 result_ok: true,
5214         }
5215 }
5216 #[no_mangle]
5217 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
5218 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
5219         CResult_RouteHintDecodeErrorZ {
5220                 contents: CResult_RouteHintDecodeErrorZPtr {
5221                         err: Box::into_raw(Box::new(e)),
5222                 },
5223                 result_ok: false,
5224         }
5225 }
5226 /// Checks if the given object is currently in the success state
5227 #[no_mangle]
5228 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
5229         o.result_ok
5230 }
5231 #[no_mangle]
5232 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
5233 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
5234 impl Drop for CResult_RouteHintDecodeErrorZ {
5235         fn drop(&mut self) {
5236                 if self.result_ok {
5237                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5238                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5239                         }
5240                 } else {
5241                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5242                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5243                         }
5244                 }
5245         }
5246 }
5247 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
5248         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5249                 let contents = if o.result_ok {
5250                         let result = unsafe { o.contents.result };
5251                         unsafe { o.contents.result = core::ptr::null_mut() };
5252                         CResult_RouteHintDecodeErrorZPtr { result }
5253                 } else {
5254                         let err = unsafe { o.contents.err };
5255                         unsafe { o.contents.err = core::ptr::null_mut(); }
5256                         CResult_RouteHintDecodeErrorZPtr { err }
5257                 };
5258                 Self {
5259                         contents,
5260                         result_ok: o.result_ok,
5261                 }
5262         }
5263 }
5264 impl Clone for CResult_RouteHintDecodeErrorZ {
5265         fn clone(&self) -> Self {
5266                 if self.result_ok {
5267                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
5268                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
5269                         } }
5270                 } else {
5271                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
5272                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5273                         } }
5274                 }
5275         }
5276 }
5277 #[no_mangle]
5278 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
5279 /// but with all dynamically-allocated buffers duplicated in new buffers.
5280 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
5281 #[repr(C)]
5282 /// The contents of CResult_RouteHintHopDecodeErrorZ
5283 pub union CResult_RouteHintHopDecodeErrorZPtr {
5284         /// A pointer to the contents in the success state.
5285         /// Reading from this pointer when `result_ok` is not set is undefined.
5286         pub result: *mut crate::lightning::routing::router::RouteHintHop,
5287         /// A pointer to the contents in the error state.
5288         /// Reading from this pointer when `result_ok` is set is undefined.
5289         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5290 }
5291 #[repr(C)]
5292 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
5293 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
5294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5295 pub struct CResult_RouteHintHopDecodeErrorZ {
5296         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
5297         /// `err` or `result` depending on the state of `result_ok`.
5298         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
5299         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
5300         pub result_ok: bool,
5301 }
5302 #[no_mangle]
5303 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
5304 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
5305         CResult_RouteHintHopDecodeErrorZ {
5306                 contents: CResult_RouteHintHopDecodeErrorZPtr {
5307                         result: Box::into_raw(Box::new(o)),
5308                 },
5309                 result_ok: true,
5310         }
5311 }
5312 #[no_mangle]
5313 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
5314 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
5315         CResult_RouteHintHopDecodeErrorZ {
5316                 contents: CResult_RouteHintHopDecodeErrorZPtr {
5317                         err: Box::into_raw(Box::new(e)),
5318                 },
5319                 result_ok: false,
5320         }
5321 }
5322 /// Checks if the given object is currently in the success state
5323 #[no_mangle]
5324 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
5325         o.result_ok
5326 }
5327 #[no_mangle]
5328 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
5329 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
5330 impl Drop for CResult_RouteHintHopDecodeErrorZ {
5331         fn drop(&mut self) {
5332                 if self.result_ok {
5333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5335                         }
5336                 } else {
5337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5339                         }
5340                 }
5341         }
5342 }
5343 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
5344         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
5345                 let contents = if o.result_ok {
5346                         let result = unsafe { o.contents.result };
5347                         unsafe { o.contents.result = core::ptr::null_mut() };
5348                         CResult_RouteHintHopDecodeErrorZPtr { result }
5349                 } else {
5350                         let err = unsafe { o.contents.err };
5351                         unsafe { o.contents.err = core::ptr::null_mut(); }
5352                         CResult_RouteHintHopDecodeErrorZPtr { err }
5353                 };
5354                 Self {
5355                         contents,
5356                         result_ok: o.result_ok,
5357                 }
5358         }
5359 }
5360 impl Clone for CResult_RouteHintHopDecodeErrorZ {
5361         fn clone(&self) -> Self {
5362                 if self.result_ok {
5363                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
5364                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
5365                         } }
5366                 } else {
5367                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
5368                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5369                         } }
5370                 }
5371         }
5372 }
5373 #[no_mangle]
5374 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
5375 /// but with all dynamically-allocated buffers duplicated in new buffers.
5376 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
5377 #[repr(C)]
5378 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5379 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
5380         /// A pointer to the contents in the success state.
5381         /// Reading from this pointer when `result_ok` is not set is undefined.
5382         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
5383         /// A pointer to the contents in the error state.
5384         /// Reading from this pointer when `result_ok` is set is undefined.
5385         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5386 }
5387 #[repr(C)]
5388 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5389 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5391 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
5392         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5393         /// `err` or `result` depending on the state of `result_ok`.
5394         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
5395         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5396         pub result_ok: bool,
5397 }
5398 #[no_mangle]
5399 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
5400 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5401         CResult_FixedPenaltyScorerDecodeErrorZ {
5402                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5403                         result: Box::into_raw(Box::new(o)),
5404                 },
5405                 result_ok: true,
5406         }
5407 }
5408 #[no_mangle]
5409 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
5410 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5411         CResult_FixedPenaltyScorerDecodeErrorZ {
5412                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5413                         err: Box::into_raw(Box::new(e)),
5414                 },
5415                 result_ok: false,
5416         }
5417 }
5418 /// Checks if the given object is currently in the success state
5419 #[no_mangle]
5420 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
5421         o.result_ok
5422 }
5423 #[no_mangle]
5424 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5425 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5426 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5427         fn drop(&mut self) {
5428                 if self.result_ok {
5429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5431                         }
5432                 } else {
5433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5435                         }
5436                 }
5437         }
5438 }
5439 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5440         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5441                 let contents = if o.result_ok {
5442                         let result = unsafe { o.contents.result };
5443                         unsafe { o.contents.result = core::ptr::null_mut() };
5444                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5445                 } else {
5446                         let err = unsafe { o.contents.err };
5447                         unsafe { o.contents.err = core::ptr::null_mut(); }
5448                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5449                 };
5450                 Self {
5451                         contents,
5452                         result_ok: o.result_ok,
5453                 }
5454         }
5455 }
5456 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5457         fn clone(&self) -> Self {
5458                 if self.result_ok {
5459                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5460                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5461                         } }
5462                 } else {
5463                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5464                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5465                         } }
5466                 }
5467         }
5468 }
5469 #[no_mangle]
5470 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5471 /// but with all dynamically-allocated buffers duplicated in new buffers.
5472 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5473 #[repr(C)]
5474 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5475 /// This corresponds to std::vector in C++
5476 pub struct CVec_NodeIdZ {
5477         /// The elements in the array.
5478         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5479         pub data: *mut crate::lightning::routing::gossip::NodeId,
5480         /// The number of elements pointed to by `data`.
5481         pub datalen: usize
5482 }
5483 impl CVec_NodeIdZ {
5484         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5485                 if self.datalen == 0 { return Vec::new(); }
5486                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5487                 self.data = core::ptr::null_mut();
5488                 self.datalen = 0;
5489                 ret
5490         }
5491         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5492                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5493         }
5494 }
5495 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5496         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5497                 let datalen = v.len();
5498                 let data = Box::into_raw(v.into_boxed_slice());
5499                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5500         }
5501 }
5502 #[no_mangle]
5503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5504 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5505 impl Drop for CVec_NodeIdZ {
5506         fn drop(&mut self) {
5507                 if self.datalen == 0 { return; }
5508                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5509         }
5510 }
5511 impl Clone for CVec_NodeIdZ {
5512         fn clone(&self) -> Self {
5513                 let mut res = Vec::new();
5514                 if self.datalen == 0 { return Self::from(res); }
5515                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5516                 Self::from(res)
5517         }
5518 }
5519 #[repr(C)]
5520 /// A tuple of 2 elements. See the individual fields for the types contained.
5521 pub struct C2Tuple_u64u64Z {
5522         /// The element at position 0
5523         pub a: u64,
5524         /// The element at position 1
5525         pub b: u64,
5526 }
5527 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5528         fn from (tup: (u64, u64)) -> Self {
5529                 Self {
5530                         a: tup.0,
5531                         b: tup.1,
5532                 }
5533         }
5534 }
5535 impl C2Tuple_u64u64Z {
5536         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5537                 (self.a, self.b)
5538         }
5539 }
5540 impl Clone for C2Tuple_u64u64Z {
5541         fn clone(&self) -> Self {
5542                 Self {
5543                         a: Clone::clone(&self.a),
5544                         b: Clone::clone(&self.b),
5545                 }
5546         }
5547 }
5548 #[no_mangle]
5549 /// Creates a new tuple which has the same data as `orig`
5550 /// but with all dynamically-allocated buffers duplicated in new buffers.
5551 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5552 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5553 #[no_mangle]
5554 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5555         C2Tuple_u64u64Z { a, b, }
5556 }
5557
5558 #[no_mangle]
5559 /// Frees any resources used by the C2Tuple_u64u64Z.
5560 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5561 #[repr(C)]
5562 #[derive(Clone)]
5563 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5564 pub enum COption_C2Tuple_u64u64ZZ {
5565         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5566         Some(crate::c_types::derived::C2Tuple_u64u64Z),
5567         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5568         None
5569 }
5570 impl COption_C2Tuple_u64u64ZZ {
5571         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5572                 if let Self::None = self { false } else { true }
5573         }
5574         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5575                 !self.is_some()
5576         }
5577         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5578                 if let Self::Some(v) = self { v } else { unreachable!() }
5579         }
5580 }
5581 #[no_mangle]
5582 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5583 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5584         COption_C2Tuple_u64u64ZZ::Some(o)
5585 }
5586 #[no_mangle]
5587 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5588 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5589         COption_C2Tuple_u64u64ZZ::None
5590 }
5591 #[no_mangle]
5592 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5593 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5594 #[no_mangle]
5595 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5596 /// but with all dynamically-allocated buffers duplicated in new buffers.
5597 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5598 #[repr(C)]
5599 /// A tuple of 2 elements. See the individual fields for the types contained.
5600 pub struct C2Tuple_Z {
5601         /// The element at position 0
5602         pub a: crate::c_types::ThirtyTwoU16s,
5603         /// The element at position 1
5604         pub b: crate::c_types::ThirtyTwoU16s,
5605 }
5606 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5607         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5608                 Self {
5609                         a: tup.0,
5610                         b: tup.1,
5611                 }
5612         }
5613 }
5614 impl C2Tuple_Z {
5615         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5616                 (self.a, self.b)
5617         }
5618 }
5619 /// Creates a new C2Tuple_Z from the contained elements.
5620 #[no_mangle]
5621 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5622         C2Tuple_Z { a, b, }
5623 }
5624
5625 #[no_mangle]
5626 /// Frees any resources used by the C2Tuple_Z.
5627 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5628 #[repr(C)]
5629 /// A tuple of 2 elements. See the individual fields for the types contained.
5630 pub struct C2Tuple__u1632_u1632Z {
5631         /// The element at position 0
5632         pub a: crate::c_types::ThirtyTwoU16s,
5633         /// The element at position 1
5634         pub b: crate::c_types::ThirtyTwoU16s,
5635 }
5636 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5637         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5638                 Self {
5639                         a: tup.0,
5640                         b: tup.1,
5641                 }
5642         }
5643 }
5644 impl C2Tuple__u1632_u1632Z {
5645         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5646                 (self.a, self.b)
5647         }
5648 }
5649 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5650 #[no_mangle]
5651 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5652         C2Tuple__u1632_u1632Z { a, b, }
5653 }
5654
5655 #[no_mangle]
5656 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5657 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5658 #[repr(C)]
5659 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5660 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5661         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5662         Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5663         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5664         None
5665 }
5666 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5667         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5668                 if let Self::None = self { false } else { true }
5669         }
5670         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5671                 !self.is_some()
5672         }
5673         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5674                 if let Self::Some(v) = self { v } else { unreachable!() }
5675         }
5676 }
5677 #[no_mangle]
5678 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5679 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5680         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5681 }
5682 #[no_mangle]
5683 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5684 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5685         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5686 }
5687 #[no_mangle]
5688 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5689 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5690 #[repr(C)]
5691 #[derive(Clone)]
5692 /// An enum which can either contain a f64 or not
5693 pub enum COption_f64Z {
5694         /// When we're in this state, this COption_f64Z contains a f64
5695         Some(f64),
5696         /// When we're in this state, this COption_f64Z contains nothing
5697         None
5698 }
5699 impl COption_f64Z {
5700         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5701                 if let Self::None = self { false } else { true }
5702         }
5703         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5704                 !self.is_some()
5705         }
5706         #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5707                 if let Self::Some(v) = self { v } else { unreachable!() }
5708         }
5709 }
5710 #[no_mangle]
5711 /// Constructs a new COption_f64Z containing a f64
5712 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5713         COption_f64Z::Some(o)
5714 }
5715 #[no_mangle]
5716 /// Constructs a new COption_f64Z containing nothing
5717 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5718         COption_f64Z::None
5719 }
5720 #[no_mangle]
5721 /// Frees any resources associated with the f64, if we are in the Some state
5722 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5723 #[no_mangle]
5724 /// Creates a new COption_f64Z which has the same data as `orig`
5725 /// but with all dynamically-allocated buffers duplicated in new buffers.
5726 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5727 #[repr(C)]
5728 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5729 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5730         /// A pointer to the contents in the success state.
5731         /// Reading from this pointer when `result_ok` is not set is undefined.
5732         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5733         /// A pointer to the contents in the error state.
5734         /// Reading from this pointer when `result_ok` is set is undefined.
5735         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5736 }
5737 #[repr(C)]
5738 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5739 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5741 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5742         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5743         /// `err` or `result` depending on the state of `result_ok`.
5744         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5745         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5746         pub result_ok: bool,
5747 }
5748 #[no_mangle]
5749 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5750 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5751         CResult_ProbabilisticScorerDecodeErrorZ {
5752                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5753                         result: Box::into_raw(Box::new(o)),
5754                 },
5755                 result_ok: true,
5756         }
5757 }
5758 #[no_mangle]
5759 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5760 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5761         CResult_ProbabilisticScorerDecodeErrorZ {
5762                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5763                         err: Box::into_raw(Box::new(e)),
5764                 },
5765                 result_ok: false,
5766         }
5767 }
5768 /// Checks if the given object is currently in the success state
5769 #[no_mangle]
5770 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5771         o.result_ok
5772 }
5773 #[no_mangle]
5774 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5775 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5776 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5777         fn drop(&mut self) {
5778                 if self.result_ok {
5779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5781                         }
5782                 } else {
5783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5785                         }
5786                 }
5787         }
5788 }
5789 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5790         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5791                 let contents = if o.result_ok {
5792                         let result = unsafe { o.contents.result };
5793                         unsafe { o.contents.result = core::ptr::null_mut() };
5794                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5795                 } else {
5796                         let err = unsafe { o.contents.err };
5797                         unsafe { o.contents.err = core::ptr::null_mut(); }
5798                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5799                 };
5800                 Self {
5801                         contents,
5802                         result_ok: o.result_ok,
5803                 }
5804         }
5805 }
5806 #[repr(C)]
5807 /// The contents of CResult_BestBlockDecodeErrorZ
5808 pub union CResult_BestBlockDecodeErrorZPtr {
5809         /// A pointer to the contents in the success state.
5810         /// Reading from this pointer when `result_ok` is not set is undefined.
5811         pub result: *mut crate::lightning::chain::BestBlock,
5812         /// A pointer to the contents in the error state.
5813         /// Reading from this pointer when `result_ok` is set is undefined.
5814         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5815 }
5816 #[repr(C)]
5817 /// A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation,
5818 /// containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure.
5819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5820 pub struct CResult_BestBlockDecodeErrorZ {
5821         /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either
5822         /// `err` or `result` depending on the state of `result_ok`.
5823         pub contents: CResult_BestBlockDecodeErrorZPtr,
5824         /// Whether this CResult_BestBlockDecodeErrorZ represents a success state.
5825         pub result_ok: bool,
5826 }
5827 #[no_mangle]
5828 /// Creates a new CResult_BestBlockDecodeErrorZ in the success state.
5829 pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ {
5830         CResult_BestBlockDecodeErrorZ {
5831                 contents: CResult_BestBlockDecodeErrorZPtr {
5832                         result: Box::into_raw(Box::new(o)),
5833                 },
5834                 result_ok: true,
5835         }
5836 }
5837 #[no_mangle]
5838 /// Creates a new CResult_BestBlockDecodeErrorZ in the error state.
5839 pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ {
5840         CResult_BestBlockDecodeErrorZ {
5841                 contents: CResult_BestBlockDecodeErrorZPtr {
5842                         err: Box::into_raw(Box::new(e)),
5843                 },
5844                 result_ok: false,
5845         }
5846 }
5847 /// Checks if the given object is currently in the success state
5848 #[no_mangle]
5849 pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool {
5850         o.result_ok
5851 }
5852 #[no_mangle]
5853 /// Frees any resources used by the CResult_BestBlockDecodeErrorZ.
5854 pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { }
5855 impl Drop for CResult_BestBlockDecodeErrorZ {
5856         fn drop(&mut self) {
5857                 if self.result_ok {
5858                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5859                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5860                         }
5861                 } else {
5862                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5863                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5864                         }
5865                 }
5866         }
5867 }
5868 impl From<crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>> for CResult_BestBlockDecodeErrorZ {
5869         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>) -> Self {
5870                 let contents = if o.result_ok {
5871                         let result = unsafe { o.contents.result };
5872                         unsafe { o.contents.result = core::ptr::null_mut() };
5873                         CResult_BestBlockDecodeErrorZPtr { result }
5874                 } else {
5875                         let err = unsafe { o.contents.err };
5876                         unsafe { o.contents.err = core::ptr::null_mut(); }
5877                         CResult_BestBlockDecodeErrorZPtr { err }
5878                 };
5879                 Self {
5880                         contents,
5881                         result_ok: o.result_ok,
5882                 }
5883         }
5884 }
5885 impl Clone for CResult_BestBlockDecodeErrorZ {
5886         fn clone(&self) -> Self {
5887                 if self.result_ok {
5888                         Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr {
5889                                 result: Box::into_raw(Box::new(<crate::lightning::chain::BestBlock>::clone(unsafe { &*self.contents.result })))
5890                         } }
5891                 } else {
5892                         Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr {
5893                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5894                         } }
5895                 }
5896         }
5897 }
5898 #[no_mangle]
5899 /// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig`
5900 /// but with all dynamically-allocated buffers duplicated in new buffers.
5901 pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) }
5902 #[repr(C)]
5903 /// A tuple of 2 elements. See the individual fields for the types contained.
5904 pub struct C2Tuple_usizeTransactionZ {
5905         /// The element at position 0
5906         pub a: usize,
5907         /// The element at position 1
5908         pub b: crate::c_types::Transaction,
5909 }
5910 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5911         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5912                 Self {
5913                         a: tup.0,
5914                         b: tup.1,
5915                 }
5916         }
5917 }
5918 impl C2Tuple_usizeTransactionZ {
5919         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5920                 (self.a, self.b)
5921         }
5922 }
5923 impl Clone for C2Tuple_usizeTransactionZ {
5924         fn clone(&self) -> Self {
5925                 Self {
5926                         a: Clone::clone(&self.a),
5927                         b: Clone::clone(&self.b),
5928                 }
5929         }
5930 }
5931 #[no_mangle]
5932 /// Creates a new tuple which has the same data as `orig`
5933 /// but with all dynamically-allocated buffers duplicated in new buffers.
5934 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5935 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5936 #[no_mangle]
5937 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5938         C2Tuple_usizeTransactionZ { a, b, }
5939 }
5940
5941 #[no_mangle]
5942 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5943 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5944 #[repr(C)]
5945 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5946 /// This corresponds to std::vector in C++
5947 pub struct CVec_C2Tuple_usizeTransactionZZ {
5948         /// The elements in the array.
5949         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5950         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5951         /// The number of elements pointed to by `data`.
5952         pub datalen: usize
5953 }
5954 impl CVec_C2Tuple_usizeTransactionZZ {
5955         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5956                 if self.datalen == 0 { return Vec::new(); }
5957                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5958                 self.data = core::ptr::null_mut();
5959                 self.datalen = 0;
5960                 ret
5961         }
5962         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5963                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5964         }
5965 }
5966 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5967         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5968                 let datalen = v.len();
5969                 let data = Box::into_raw(v.into_boxed_slice());
5970                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5971         }
5972 }
5973 #[no_mangle]
5974 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5975 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5976 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5977         fn drop(&mut self) {
5978                 if self.datalen == 0 { return; }
5979                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5980         }
5981 }
5982 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5983         fn clone(&self) -> Self {
5984                 let mut res = Vec::new();
5985                 if self.datalen == 0 { return Self::from(res); }
5986                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5987                 Self::from(res)
5988         }
5989 }
5990 #[repr(C)]
5991 /// A tuple of 3 elements. See the individual fields for the types contained.
5992 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5993         /// The element at position 0
5994         pub a: crate::c_types::ThirtyTwoBytes,
5995         /// The element at position 1
5996         pub b: u32,
5997         /// The element at position 2
5998         pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5999 }
6000 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6001         fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
6002                 Self {
6003                         a: tup.0,
6004                         b: tup.1,
6005                         c: tup.2,
6006                 }
6007         }
6008 }
6009 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6010         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
6011                 (self.a, self.b, self.c)
6012         }
6013 }
6014 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6015         fn clone(&self) -> Self {
6016                 Self {
6017                         a: Clone::clone(&self.a),
6018                         b: Clone::clone(&self.b),
6019                         c: Clone::clone(&self.c),
6020                 }
6021         }
6022 }
6023 #[no_mangle]
6024 /// Creates a new tuple which has the same data as `orig`
6025 /// but with all dynamically-allocated buffers duplicated in new buffers.
6026 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
6027 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
6028 #[no_mangle]
6029 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 {
6030         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
6031 }
6032
6033 #[no_mangle]
6034 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
6035 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
6036 #[repr(C)]
6037 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
6038 /// This corresponds to std::vector in C++
6039 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6040         /// The elements in the array.
6041         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6042         pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
6043         /// The number of elements pointed to by `data`.
6044         pub datalen: usize
6045 }
6046 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6047         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
6048                 if self.datalen == 0 { return Vec::new(); }
6049                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6050                 self.data = core::ptr::null_mut();
6051                 self.datalen = 0;
6052                 ret
6053         }
6054         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
6055                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6056         }
6057 }
6058 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6059         fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
6060                 let datalen = v.len();
6061                 let data = Box::into_raw(v.into_boxed_slice());
6062                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6063         }
6064 }
6065 #[no_mangle]
6066 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6067 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
6068 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6069         fn drop(&mut self) {
6070                 if self.datalen == 0 { return; }
6071                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6072         }
6073 }
6074 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6075         fn clone(&self) -> Self {
6076                 let mut res = Vec::new();
6077                 if self.datalen == 0 { return Self::from(res); }
6078                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6079                 Self::from(res)
6080         }
6081 }
6082 #[repr(C)]
6083 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
6084 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
6085         /// A pointer to the contents in the success state.
6086         /// Reading from this pointer when `result_ok` is not set is undefined.
6087         pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
6088         /// Note that this value is always NULL, as there are no contents in the Err variant
6089         pub err: *mut core::ffi::c_void,
6090 }
6091 #[repr(C)]
6092 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
6093 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
6094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6095 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
6096         /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
6097         /// `err` or `result` depending on the state of `result_ok`.
6098         pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
6099         /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
6100         pub result_ok: bool,
6101 }
6102 #[no_mangle]
6103 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
6104 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
6105         CResult_ChannelMonitorUpdateStatusNoneZ {
6106                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6107                         result: Box::into_raw(Box::new(o)),
6108                 },
6109                 result_ok: true,
6110         }
6111 }
6112 #[no_mangle]
6113 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
6114 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
6115         CResult_ChannelMonitorUpdateStatusNoneZ {
6116                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6117                         err: core::ptr::null_mut(),
6118                 },
6119                 result_ok: false,
6120         }
6121 }
6122 /// Checks if the given object is currently in the success state
6123 #[no_mangle]
6124 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
6125         o.result_ok
6126 }
6127 #[no_mangle]
6128 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
6129 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
6130 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
6131         fn drop(&mut self) {
6132                 if self.result_ok {
6133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6135                         }
6136                 } else {
6137                 }
6138         }
6139 }
6140 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
6141         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
6142                 let contents = if o.result_ok {
6143                         let result = unsafe { o.contents.result };
6144                         unsafe { o.contents.result = core::ptr::null_mut() };
6145                         CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
6146                 } else {
6147                         let _ = unsafe { Box::from_raw(o.contents.err) };
6148                         o.contents.err = core::ptr::null_mut();
6149                         CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
6150                 };
6151                 Self {
6152                         contents,
6153                         result_ok: o.result_ok,
6154                 }
6155         }
6156 }
6157 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
6158         fn clone(&self) -> Self {
6159                 if self.result_ok {
6160                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6161                                 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
6162                         } }
6163                 } else {
6164                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6165                                 err: core::ptr::null_mut()
6166                         } }
6167                 }
6168         }
6169 }
6170 #[no_mangle]
6171 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
6172 /// but with all dynamically-allocated buffers duplicated in new buffers.
6173 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
6174 #[repr(C)]
6175 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
6176 /// This corresponds to std::vector in C++
6177 pub struct CVec_MonitorEventZ {
6178         /// The elements in the array.
6179         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6180         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
6181         /// The number of elements pointed to by `data`.
6182         pub datalen: usize
6183 }
6184 impl CVec_MonitorEventZ {
6185         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
6186                 if self.datalen == 0 { return Vec::new(); }
6187                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6188                 self.data = core::ptr::null_mut();
6189                 self.datalen = 0;
6190                 ret
6191         }
6192         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
6193                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6194         }
6195 }
6196 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
6197         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
6198                 let datalen = v.len();
6199                 let data = Box::into_raw(v.into_boxed_slice());
6200                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6201         }
6202 }
6203 #[no_mangle]
6204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6205 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
6206 impl Drop for CVec_MonitorEventZ {
6207         fn drop(&mut self) {
6208                 if self.datalen == 0 { return; }
6209                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6210         }
6211 }
6212 impl Clone for CVec_MonitorEventZ {
6213         fn clone(&self) -> Self {
6214                 let mut res = Vec::new();
6215                 if self.datalen == 0 { return Self::from(res); }
6216                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6217                 Self::from(res)
6218         }
6219 }
6220 #[repr(C)]
6221 /// A tuple of 4 elements. See the individual fields for the types contained.
6222 pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6223         /// The element at position 0
6224         pub a: crate::lightning::chain::transaction::OutPoint,
6225         /// The element at position 1
6226         pub b: crate::lightning::ln::types::ChannelId,
6227         /// The element at position 2
6228         pub c: crate::c_types::derived::CVec_MonitorEventZ,
6229         /// The element at position 3
6230         pub d: crate::c_types::PublicKey,
6231 }
6232 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6233         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
6234                 Self {
6235                         a: tup.0,
6236                         b: tup.1,
6237                         c: tup.2,
6238                         d: tup.3,
6239                 }
6240         }
6241 }
6242 impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6243         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
6244                 (self.a, self.b, self.c, self.d)
6245         }
6246 }
6247 impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6248         fn clone(&self) -> Self {
6249                 Self {
6250                         a: Clone::clone(&self.a),
6251                         b: Clone::clone(&self.b),
6252                         c: Clone::clone(&self.c),
6253                         d: Clone::clone(&self.d),
6254                 }
6255         }
6256 }
6257 #[no_mangle]
6258 /// Creates a new tuple which has the same data as `orig`
6259 /// but with all dynamically-allocated buffers duplicated in new buffers.
6260 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
6261 /// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements.
6262 #[no_mangle]
6263 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId, c: crate::c_types::derived::CVec_MonitorEventZ, d: crate::c_types::PublicKey) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6264         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, }
6265 }
6266
6267 #[no_mangle]
6268 /// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ.
6269 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { }
6270 #[repr(C)]
6271 /// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size.
6272 /// This corresponds to std::vector in C++
6273 pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6274         /// The elements in the array.
6275         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6276         pub data: *mut crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ,
6277         /// The number of elements pointed to by `data`.
6278         pub datalen: usize
6279 }
6280 impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6281         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ> {
6282                 if self.datalen == 0 { return Vec::new(); }
6283                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6284                 self.data = core::ptr::null_mut();
6285                 self.datalen = 0;
6286                 ret
6287         }
6288         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] {
6289                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6290         }
6291 }
6292 impl From<Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6293         fn from(v: Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>) -> Self {
6294                 let datalen = v.len();
6295                 let data = Box::into_raw(v.into_boxed_slice());
6296                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6297         }
6298 }
6299 #[no_mangle]
6300 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6301 pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { }
6302 impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6303         fn drop(&mut self) {
6304                 if self.datalen == 0 { return; }
6305                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6306         }
6307 }
6308 impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6309         fn clone(&self) -> Self {
6310                 let mut res = Vec::new();
6311                 if self.datalen == 0 { return Self::from(res); }
6312                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6313                 Self::from(res)
6314         }
6315 }
6316 #[repr(C)]
6317 /// The contents of CResult_InitFeaturesDecodeErrorZ
6318 pub union CResult_InitFeaturesDecodeErrorZPtr {
6319         /// A pointer to the contents in the success state.
6320         /// Reading from this pointer when `result_ok` is not set is undefined.
6321         pub result: *mut crate::lightning::ln::features::InitFeatures,
6322         /// A pointer to the contents in the error state.
6323         /// Reading from this pointer when `result_ok` is set is undefined.
6324         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6325 }
6326 #[repr(C)]
6327 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
6328 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6330 pub struct CResult_InitFeaturesDecodeErrorZ {
6331         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
6332         /// `err` or `result` depending on the state of `result_ok`.
6333         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
6334         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
6335         pub result_ok: bool,
6336 }
6337 #[no_mangle]
6338 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
6339 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
6340         CResult_InitFeaturesDecodeErrorZ {
6341                 contents: CResult_InitFeaturesDecodeErrorZPtr {
6342                         result: Box::into_raw(Box::new(o)),
6343                 },
6344                 result_ok: true,
6345         }
6346 }
6347 #[no_mangle]
6348 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
6349 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
6350         CResult_InitFeaturesDecodeErrorZ {
6351                 contents: CResult_InitFeaturesDecodeErrorZPtr {
6352                         err: Box::into_raw(Box::new(e)),
6353                 },
6354                 result_ok: false,
6355         }
6356 }
6357 /// Checks if the given object is currently in the success state
6358 #[no_mangle]
6359 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
6360         o.result_ok
6361 }
6362 #[no_mangle]
6363 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
6364 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
6365 impl Drop for CResult_InitFeaturesDecodeErrorZ {
6366         fn drop(&mut self) {
6367                 if self.result_ok {
6368                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6369                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6370                         }
6371                 } else {
6372                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6373                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6374                         }
6375                 }
6376         }
6377 }
6378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
6379         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6380                 let contents = if o.result_ok {
6381                         let result = unsafe { o.contents.result };
6382                         unsafe { o.contents.result = core::ptr::null_mut() };
6383                         CResult_InitFeaturesDecodeErrorZPtr { result }
6384                 } else {
6385                         let err = unsafe { o.contents.err };
6386                         unsafe { o.contents.err = core::ptr::null_mut(); }
6387                         CResult_InitFeaturesDecodeErrorZPtr { err }
6388                 };
6389                 Self {
6390                         contents,
6391                         result_ok: o.result_ok,
6392                 }
6393         }
6394 }
6395 impl Clone for CResult_InitFeaturesDecodeErrorZ {
6396         fn clone(&self) -> Self {
6397                 if self.result_ok {
6398                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
6399                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
6400                         } }
6401                 } else {
6402                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
6403                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6404                         } }
6405                 }
6406         }
6407 }
6408 #[no_mangle]
6409 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
6410 /// but with all dynamically-allocated buffers duplicated in new buffers.
6411 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
6412 #[repr(C)]
6413 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
6414 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
6415         /// A pointer to the contents in the success state.
6416         /// Reading from this pointer when `result_ok` is not set is undefined.
6417         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
6418         /// A pointer to the contents in the error state.
6419         /// Reading from this pointer when `result_ok` is set is undefined.
6420         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6421 }
6422 #[repr(C)]
6423 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
6424 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6426 pub struct CResult_ChannelFeaturesDecodeErrorZ {
6427         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
6428         /// `err` or `result` depending on the state of `result_ok`.
6429         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
6430         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
6431         pub result_ok: bool,
6432 }
6433 #[no_mangle]
6434 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
6435 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
6436         CResult_ChannelFeaturesDecodeErrorZ {
6437                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6438                         result: Box::into_raw(Box::new(o)),
6439                 },
6440                 result_ok: true,
6441         }
6442 }
6443 #[no_mangle]
6444 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
6445 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
6446         CResult_ChannelFeaturesDecodeErrorZ {
6447                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6448                         err: Box::into_raw(Box::new(e)),
6449                 },
6450                 result_ok: false,
6451         }
6452 }
6453 /// Checks if the given object is currently in the success state
6454 #[no_mangle]
6455 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
6456         o.result_ok
6457 }
6458 #[no_mangle]
6459 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
6460 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
6461 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
6462         fn drop(&mut self) {
6463                 if self.result_ok {
6464                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6465                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6466                         }
6467                 } else {
6468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6470                         }
6471                 }
6472         }
6473 }
6474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
6475         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6476                 let contents = if o.result_ok {
6477                         let result = unsafe { o.contents.result };
6478                         unsafe { o.contents.result = core::ptr::null_mut() };
6479                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
6480                 } else {
6481                         let err = unsafe { o.contents.err };
6482                         unsafe { o.contents.err = core::ptr::null_mut(); }
6483                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
6484                 };
6485                 Self {
6486                         contents,
6487                         result_ok: o.result_ok,
6488                 }
6489         }
6490 }
6491 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
6492         fn clone(&self) -> Self {
6493                 if self.result_ok {
6494                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6495                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
6496                         } }
6497                 } else {
6498                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6499                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6500                         } }
6501                 }
6502         }
6503 }
6504 #[no_mangle]
6505 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
6506 /// but with all dynamically-allocated buffers duplicated in new buffers.
6507 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
6508 #[repr(C)]
6509 /// The contents of CResult_NodeFeaturesDecodeErrorZ
6510 pub union CResult_NodeFeaturesDecodeErrorZPtr {
6511         /// A pointer to the contents in the success state.
6512         /// Reading from this pointer when `result_ok` is not set is undefined.
6513         pub result: *mut crate::lightning::ln::features::NodeFeatures,
6514         /// A pointer to the contents in the error state.
6515         /// Reading from this pointer when `result_ok` is set is undefined.
6516         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6517 }
6518 #[repr(C)]
6519 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
6520 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6522 pub struct CResult_NodeFeaturesDecodeErrorZ {
6523         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6524         /// `err` or `result` depending on the state of `result_ok`.
6525         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6526         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6527         pub result_ok: bool,
6528 }
6529 #[no_mangle]
6530 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6531 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6532         CResult_NodeFeaturesDecodeErrorZ {
6533                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6534                         result: Box::into_raw(Box::new(o)),
6535                 },
6536                 result_ok: true,
6537         }
6538 }
6539 #[no_mangle]
6540 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6541 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6542         CResult_NodeFeaturesDecodeErrorZ {
6543                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6544                         err: Box::into_raw(Box::new(e)),
6545                 },
6546                 result_ok: false,
6547         }
6548 }
6549 /// Checks if the given object is currently in the success state
6550 #[no_mangle]
6551 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6552         o.result_ok
6553 }
6554 #[no_mangle]
6555 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6556 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6557 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6558         fn drop(&mut self) {
6559                 if self.result_ok {
6560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6562                         }
6563                 } else {
6564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6566                         }
6567                 }
6568         }
6569 }
6570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6572                 let contents = if o.result_ok {
6573                         let result = unsafe { o.contents.result };
6574                         unsafe { o.contents.result = core::ptr::null_mut() };
6575                         CResult_NodeFeaturesDecodeErrorZPtr { result }
6576                 } else {
6577                         let err = unsafe { o.contents.err };
6578                         unsafe { o.contents.err = core::ptr::null_mut(); }
6579                         CResult_NodeFeaturesDecodeErrorZPtr { err }
6580                 };
6581                 Self {
6582                         contents,
6583                         result_ok: o.result_ok,
6584                 }
6585         }
6586 }
6587 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6588         fn clone(&self) -> Self {
6589                 if self.result_ok {
6590                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6592                         } }
6593                 } else {
6594                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6595                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6596                         } }
6597                 }
6598         }
6599 }
6600 #[no_mangle]
6601 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6602 /// but with all dynamically-allocated buffers duplicated in new buffers.
6603 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6604 #[repr(C)]
6605 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6606 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6607         /// A pointer to the contents in the success state.
6608         /// Reading from this pointer when `result_ok` is not set is undefined.
6609         pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6610         /// A pointer to the contents in the error state.
6611         /// Reading from this pointer when `result_ok` is set is undefined.
6612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6613 }
6614 #[repr(C)]
6615 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6616 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6618 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6619         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6620         /// `err` or `result` depending on the state of `result_ok`.
6621         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6622         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6623         pub result_ok: bool,
6624 }
6625 #[no_mangle]
6626 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6627 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6628         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6629                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6630                         result: Box::into_raw(Box::new(o)),
6631                 },
6632                 result_ok: true,
6633         }
6634 }
6635 #[no_mangle]
6636 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6637 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6638         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6639                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6640                         err: Box::into_raw(Box::new(e)),
6641                 },
6642                 result_ok: false,
6643         }
6644 }
6645 /// Checks if the given object is currently in the success state
6646 #[no_mangle]
6647 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6648         o.result_ok
6649 }
6650 #[no_mangle]
6651 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6652 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6653 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6654         fn drop(&mut self) {
6655                 if self.result_ok {
6656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6658                         }
6659                 } else {
6660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6662                         }
6663                 }
6664         }
6665 }
6666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6668                 let contents = if o.result_ok {
6669                         let result = unsafe { o.contents.result };
6670                         unsafe { o.contents.result = core::ptr::null_mut() };
6671                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6672                 } else {
6673                         let err = unsafe { o.contents.err };
6674                         unsafe { o.contents.err = core::ptr::null_mut(); }
6675                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6676                 };
6677                 Self {
6678                         contents,
6679                         result_ok: o.result_ok,
6680                 }
6681         }
6682 }
6683 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6684         fn clone(&self) -> Self {
6685                 if self.result_ok {
6686                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6688                         } }
6689                 } else {
6690                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6692                         } }
6693                 }
6694         }
6695 }
6696 #[no_mangle]
6697 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6698 /// but with all dynamically-allocated buffers duplicated in new buffers.
6699 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6700 #[repr(C)]
6701 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6702 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6703         /// A pointer to the contents in the success state.
6704         /// Reading from this pointer when `result_ok` is not set is undefined.
6705         pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6706         /// A pointer to the contents in the error state.
6707         /// Reading from this pointer when `result_ok` is set is undefined.
6708         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6709 }
6710 #[repr(C)]
6711 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6712 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6714 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6715         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6716         /// `err` or `result` depending on the state of `result_ok`.
6717         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6718         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6719         pub result_ok: bool,
6720 }
6721 #[no_mangle]
6722 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6723 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6724         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6725                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6726                         result: Box::into_raw(Box::new(o)),
6727                 },
6728                 result_ok: true,
6729         }
6730 }
6731 #[no_mangle]
6732 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6733 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6734         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6735                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6736                         err: Box::into_raw(Box::new(e)),
6737                 },
6738                 result_ok: false,
6739         }
6740 }
6741 /// Checks if the given object is currently in the success state
6742 #[no_mangle]
6743 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6744         o.result_ok
6745 }
6746 #[no_mangle]
6747 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6748 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6749 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6750         fn drop(&mut self) {
6751                 if self.result_ok {
6752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6754                         }
6755                 } else {
6756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6758                         }
6759                 }
6760         }
6761 }
6762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6764                 let contents = if o.result_ok {
6765                         let result = unsafe { o.contents.result };
6766                         unsafe { o.contents.result = core::ptr::null_mut() };
6767                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6768                 } else {
6769                         let err = unsafe { o.contents.err };
6770                         unsafe { o.contents.err = core::ptr::null_mut(); }
6771                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6772                 };
6773                 Self {
6774                         contents,
6775                         result_ok: o.result_ok,
6776                 }
6777         }
6778 }
6779 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6780         fn clone(&self) -> Self {
6781                 if self.result_ok {
6782                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6784                         } }
6785                 } else {
6786                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6788                         } }
6789                 }
6790         }
6791 }
6792 #[no_mangle]
6793 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6794 /// but with all dynamically-allocated buffers duplicated in new buffers.
6795 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6796 #[repr(C)]
6797 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6798 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6799         /// A pointer to the contents in the success state.
6800         /// Reading from this pointer when `result_ok` is not set is undefined.
6801         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6802         /// A pointer to the contents in the error state.
6803         /// Reading from this pointer when `result_ok` is set is undefined.
6804         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6805 }
6806 #[repr(C)]
6807 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6808 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6810 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6811         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6812         /// `err` or `result` depending on the state of `result_ok`.
6813         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6814         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6815         pub result_ok: bool,
6816 }
6817 #[no_mangle]
6818 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6819 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6820         CResult_BlindedHopFeaturesDecodeErrorZ {
6821                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6822                         result: Box::into_raw(Box::new(o)),
6823                 },
6824                 result_ok: true,
6825         }
6826 }
6827 #[no_mangle]
6828 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6829 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6830         CResult_BlindedHopFeaturesDecodeErrorZ {
6831                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6832                         err: Box::into_raw(Box::new(e)),
6833                 },
6834                 result_ok: false,
6835         }
6836 }
6837 /// Checks if the given object is currently in the success state
6838 #[no_mangle]
6839 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6840         o.result_ok
6841 }
6842 #[no_mangle]
6843 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6844 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6845 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6846         fn drop(&mut self) {
6847                 if self.result_ok {
6848                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6849                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6850                         }
6851                 } else {
6852                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6853                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6854                         }
6855                 }
6856         }
6857 }
6858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6859         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6860                 let contents = if o.result_ok {
6861                         let result = unsafe { o.contents.result };
6862                         unsafe { o.contents.result = core::ptr::null_mut() };
6863                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6864                 } else {
6865                         let err = unsafe { o.contents.err };
6866                         unsafe { o.contents.err = core::ptr::null_mut(); }
6867                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6868                 };
6869                 Self {
6870                         contents,
6871                         result_ok: o.result_ok,
6872                 }
6873         }
6874 }
6875 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6876         fn clone(&self) -> Self {
6877                 if self.result_ok {
6878                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6879                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6880                         } }
6881                 } else {
6882                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6883                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6884                         } }
6885                 }
6886         }
6887 }
6888 #[no_mangle]
6889 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6890 /// but with all dynamically-allocated buffers duplicated in new buffers.
6891 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6892 #[repr(C)]
6893 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6894 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6895         /// A pointer to the contents in the success state.
6896         /// Reading from this pointer when `result_ok` is not set is undefined.
6897         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6898         /// A pointer to the contents in the error state.
6899         /// Reading from this pointer when `result_ok` is set is undefined.
6900         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6901 }
6902 #[repr(C)]
6903 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6904 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6906 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6907         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6908         /// `err` or `result` depending on the state of `result_ok`.
6909         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6910         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6911         pub result_ok: bool,
6912 }
6913 #[no_mangle]
6914 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6915 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6916         CResult_ChannelTypeFeaturesDecodeErrorZ {
6917                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6918                         result: Box::into_raw(Box::new(o)),
6919                 },
6920                 result_ok: true,
6921         }
6922 }
6923 #[no_mangle]
6924 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6925 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6926         CResult_ChannelTypeFeaturesDecodeErrorZ {
6927                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6928                         err: Box::into_raw(Box::new(e)),
6929                 },
6930                 result_ok: false,
6931         }
6932 }
6933 /// Checks if the given object is currently in the success state
6934 #[no_mangle]
6935 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6936         o.result_ok
6937 }
6938 #[no_mangle]
6939 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6940 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6941 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6942         fn drop(&mut self) {
6943                 if self.result_ok {
6944                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6945                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6946                         }
6947                 } else {
6948                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6949                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6950                         }
6951                 }
6952         }
6953 }
6954 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6955         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6956                 let contents = if o.result_ok {
6957                         let result = unsafe { o.contents.result };
6958                         unsafe { o.contents.result = core::ptr::null_mut() };
6959                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6960                 } else {
6961                         let err = unsafe { o.contents.err };
6962                         unsafe { o.contents.err = core::ptr::null_mut(); }
6963                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6964                 };
6965                 Self {
6966                         contents,
6967                         result_ok: o.result_ok,
6968                 }
6969         }
6970 }
6971 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6972         fn clone(&self) -> Self {
6973                 if self.result_ok {
6974                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6975                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6976                         } }
6977                 } else {
6978                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6979                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6980                         } }
6981                 }
6982         }
6983 }
6984 #[no_mangle]
6985 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6986 /// but with all dynamically-allocated buffers duplicated in new buffers.
6987 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6988 #[repr(C)]
6989 /// The contents of CResult_OfferIdDecodeErrorZ
6990 pub union CResult_OfferIdDecodeErrorZPtr {
6991         /// A pointer to the contents in the success state.
6992         /// Reading from this pointer when `result_ok` is not set is undefined.
6993         pub result: *mut crate::lightning::offers::offer::OfferId,
6994         /// A pointer to the contents in the error state.
6995         /// Reading from this pointer when `result_ok` is set is undefined.
6996         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6997 }
6998 #[repr(C)]
6999 /// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation,
7000 /// containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7002 pub struct CResult_OfferIdDecodeErrorZ {
7003         /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either
7004         /// `err` or `result` depending on the state of `result_ok`.
7005         pub contents: CResult_OfferIdDecodeErrorZPtr,
7006         /// Whether this CResult_OfferIdDecodeErrorZ represents a success state.
7007         pub result_ok: bool,
7008 }
7009 #[no_mangle]
7010 /// Creates a new CResult_OfferIdDecodeErrorZ in the success state.
7011 pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ {
7012         CResult_OfferIdDecodeErrorZ {
7013                 contents: CResult_OfferIdDecodeErrorZPtr {
7014                         result: Box::into_raw(Box::new(o)),
7015                 },
7016                 result_ok: true,
7017         }
7018 }
7019 #[no_mangle]
7020 /// Creates a new CResult_OfferIdDecodeErrorZ in the error state.
7021 pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ {
7022         CResult_OfferIdDecodeErrorZ {
7023                 contents: CResult_OfferIdDecodeErrorZPtr {
7024                         err: Box::into_raw(Box::new(e)),
7025                 },
7026                 result_ok: false,
7027         }
7028 }
7029 /// Checks if the given object is currently in the success state
7030 #[no_mangle]
7031 pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool {
7032         o.result_ok
7033 }
7034 #[no_mangle]
7035 /// Frees any resources used by the CResult_OfferIdDecodeErrorZ.
7036 pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { }
7037 impl Drop for CResult_OfferIdDecodeErrorZ {
7038         fn drop(&mut self) {
7039                 if self.result_ok {
7040                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7041                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7042                         }
7043                 } else {
7044                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7045                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7046                         }
7047                 }
7048         }
7049 }
7050 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferIdDecodeErrorZ {
7051         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7052                 let contents = if o.result_ok {
7053                         let result = unsafe { o.contents.result };
7054                         unsafe { o.contents.result = core::ptr::null_mut() };
7055                         CResult_OfferIdDecodeErrorZPtr { result }
7056                 } else {
7057                         let err = unsafe { o.contents.err };
7058                         unsafe { o.contents.err = core::ptr::null_mut(); }
7059                         CResult_OfferIdDecodeErrorZPtr { err }
7060                 };
7061                 Self {
7062                         contents,
7063                         result_ok: o.result_ok,
7064                 }
7065         }
7066 }
7067 impl Clone for CResult_OfferIdDecodeErrorZ {
7068         fn clone(&self) -> Self {
7069                 if self.result_ok {
7070                         Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr {
7071                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferId>::clone(unsafe { &*self.contents.result })))
7072                         } }
7073                 } else {
7074                         Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr {
7075                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7076                         } }
7077                 }
7078         }
7079 }
7080 #[no_mangle]
7081 /// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig`
7082 /// but with all dynamically-allocated buffers duplicated in new buffers.
7083 pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) }
7084 #[repr(C)]
7085 /// The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ
7086 pub union CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7087         /// A pointer to the contents in the success state.
7088         /// Reading from this pointer when `result_ok` is not set is undefined.
7089         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder,
7090         /// A pointer to the contents in the error state.
7091         /// Reading from this pointer when `result_ok` is set is undefined.
7092         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7093 }
7094 #[repr(C)]
7095 /// A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7096 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7097 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7098 pub struct CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7099         /// The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7100         /// `err` or `result` depending on the state of `result_ok`.
7101         pub contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr,
7102         /// Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7103         pub result_ok: bool,
7104 }
7105 #[no_mangle]
7106 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state.
7107 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7108         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7109                 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7110                         result: Box::into_raw(Box::new(o)),
7111                 },
7112                 result_ok: true,
7113         }
7114 }
7115 #[no_mangle]
7116 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state.
7117 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7118         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7119                 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7120                         err: Box::into_raw(Box::new(e)),
7121                 },
7122                 result_ok: false,
7123         }
7124 }
7125 /// Checks if the given object is currently in the success state
7126 #[no_mangle]
7127 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7128         o.result_ok
7129 }
7130 #[no_mangle]
7131 /// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ.
7132 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) { }
7133 impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7134         fn drop(&mut self) {
7135                 if self.result_ok {
7136                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7137                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7138                         }
7139                 } else {
7140                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7141                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7142                         }
7143                 }
7144         }
7145 }
7146 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7147         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7148                 let contents = if o.result_ok {
7149                         let result = unsafe { o.contents.result };
7150                         unsafe { o.contents.result = core::ptr::null_mut() };
7151                         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { result }
7152                 } else {
7153                         let err = unsafe { o.contents.err };
7154                         unsafe { o.contents.err = core::ptr::null_mut(); }
7155                         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { err }
7156                 };
7157                 Self {
7158                         contents,
7159                         result_ok: o.result_ok,
7160                 }
7161         }
7162 }
7163 #[repr(C)]
7164 /// The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ
7165 pub union CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7166         /// A pointer to the contents in the success state.
7167         /// Reading from this pointer when `result_ok` is not set is undefined.
7168         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder,
7169         /// A pointer to the contents in the error state.
7170         /// Reading from this pointer when `result_ok` is set is undefined.
7171         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7172 }
7173 #[repr(C)]
7174 /// A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7175 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7177 pub struct CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7178         /// The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7179         /// `err` or `result` depending on the state of `result_ok`.
7180         pub contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr,
7181         /// Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7182         pub result_ok: bool,
7183 }
7184 #[no_mangle]
7185 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
7186 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7187         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7188                 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7189                         result: Box::into_raw(Box::new(o)),
7190                 },
7191                 result_ok: true,
7192         }
7193 }
7194 #[no_mangle]
7195 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
7196 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7197         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7198                 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7199                         err: Box::into_raw(Box::new(e)),
7200                 },
7201                 result_ok: false,
7202         }
7203 }
7204 /// Checks if the given object is currently in the success state
7205 #[no_mangle]
7206 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7207         o.result_ok
7208 }
7209 #[no_mangle]
7210 /// Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.
7211 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) { }
7212 impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7213         fn drop(&mut self) {
7214                 if self.result_ok {
7215                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7216                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7217                         }
7218                 } else {
7219                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7220                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7221                         }
7222                 }
7223         }
7224 }
7225 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7226         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7227                 let contents = if o.result_ok {
7228                         let result = unsafe { o.contents.result };
7229                         unsafe { o.contents.result = core::ptr::null_mut() };
7230                         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { result }
7231                 } else {
7232                         let err = unsafe { o.contents.err };
7233                         unsafe { o.contents.err = core::ptr::null_mut(); }
7234                         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { err }
7235                 };
7236                 Self {
7237                         contents,
7238                         result_ok: o.result_ok,
7239                 }
7240         }
7241 }
7242 #[repr(C)]
7243 /// The contents of CResult_OfferBolt12ParseErrorZ
7244 pub union CResult_OfferBolt12ParseErrorZPtr {
7245         /// A pointer to the contents in the success state.
7246         /// Reading from this pointer when `result_ok` is not set is undefined.
7247         pub result: *mut crate::lightning::offers::offer::Offer,
7248         /// A pointer to the contents in the error state.
7249         /// Reading from this pointer when `result_ok` is set is undefined.
7250         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
7251 }
7252 #[repr(C)]
7253 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
7254 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
7255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7256 pub struct CResult_OfferBolt12ParseErrorZ {
7257         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
7258         /// `err` or `result` depending on the state of `result_ok`.
7259         pub contents: CResult_OfferBolt12ParseErrorZPtr,
7260         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
7261         pub result_ok: bool,
7262 }
7263 #[no_mangle]
7264 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
7265 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
7266         CResult_OfferBolt12ParseErrorZ {
7267                 contents: CResult_OfferBolt12ParseErrorZPtr {
7268                         result: Box::into_raw(Box::new(o)),
7269                 },
7270                 result_ok: true,
7271         }
7272 }
7273 #[no_mangle]
7274 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
7275 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
7276         CResult_OfferBolt12ParseErrorZ {
7277                 contents: CResult_OfferBolt12ParseErrorZPtr {
7278                         err: Box::into_raw(Box::new(e)),
7279                 },
7280                 result_ok: false,
7281         }
7282 }
7283 /// Checks if the given object is currently in the success state
7284 #[no_mangle]
7285 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
7286         o.result_ok
7287 }
7288 #[no_mangle]
7289 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
7290 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
7291 impl Drop for CResult_OfferBolt12ParseErrorZ {
7292         fn drop(&mut self) {
7293                 if self.result_ok {
7294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7296                         }
7297                 } else {
7298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7300                         }
7301                 }
7302         }
7303 }
7304 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
7305         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
7306                 let contents = if o.result_ok {
7307                         let result = unsafe { o.contents.result };
7308                         unsafe { o.contents.result = core::ptr::null_mut() };
7309                         CResult_OfferBolt12ParseErrorZPtr { result }
7310                 } else {
7311                         let err = unsafe { o.contents.err };
7312                         unsafe { o.contents.err = core::ptr::null_mut(); }
7313                         CResult_OfferBolt12ParseErrorZPtr { err }
7314                 };
7315                 Self {
7316                         contents,
7317                         result_ok: o.result_ok,
7318                 }
7319         }
7320 }
7321 impl Clone for CResult_OfferBolt12ParseErrorZ {
7322         fn clone(&self) -> Self {
7323                 if self.result_ok {
7324                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
7325                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7326                         } }
7327                 } else {
7328                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
7329                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
7330                         } }
7331                 }
7332         }
7333 }
7334 #[no_mangle]
7335 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
7336 /// but with all dynamically-allocated buffers duplicated in new buffers.
7337 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
7338 #[repr(C)]
7339 /// The contents of CResult_NodeIdDecodeErrorZ
7340 pub union CResult_NodeIdDecodeErrorZPtr {
7341         /// A pointer to the contents in the success state.
7342         /// Reading from this pointer when `result_ok` is not set is undefined.
7343         pub result: *mut crate::lightning::routing::gossip::NodeId,
7344         /// A pointer to the contents in the error state.
7345         /// Reading from this pointer when `result_ok` is set is undefined.
7346         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7347 }
7348 #[repr(C)]
7349 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7350 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7352 pub struct CResult_NodeIdDecodeErrorZ {
7353         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7354         /// `err` or `result` depending on the state of `result_ok`.
7355         pub contents: CResult_NodeIdDecodeErrorZPtr,
7356         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7357         pub result_ok: bool,
7358 }
7359 #[no_mangle]
7360 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
7361 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
7362         CResult_NodeIdDecodeErrorZ {
7363                 contents: CResult_NodeIdDecodeErrorZPtr {
7364                         result: Box::into_raw(Box::new(o)),
7365                 },
7366                 result_ok: true,
7367         }
7368 }
7369 #[no_mangle]
7370 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
7371 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
7372         CResult_NodeIdDecodeErrorZ {
7373                 contents: CResult_NodeIdDecodeErrorZPtr {
7374                         err: Box::into_raw(Box::new(e)),
7375                 },
7376                 result_ok: false,
7377         }
7378 }
7379 /// Checks if the given object is currently in the success state
7380 #[no_mangle]
7381 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
7382         o.result_ok
7383 }
7384 #[no_mangle]
7385 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
7386 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
7387 impl Drop for CResult_NodeIdDecodeErrorZ {
7388         fn drop(&mut self) {
7389                 if self.result_ok {
7390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7392                         }
7393                 } else {
7394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7396                         }
7397                 }
7398         }
7399 }
7400 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
7401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7402                 let contents = if o.result_ok {
7403                         let result = unsafe { o.contents.result };
7404                         unsafe { o.contents.result = core::ptr::null_mut() };
7405                         CResult_NodeIdDecodeErrorZPtr { result }
7406                 } else {
7407                         let err = unsafe { o.contents.err };
7408                         unsafe { o.contents.err = core::ptr::null_mut(); }
7409                         CResult_NodeIdDecodeErrorZPtr { err }
7410                 };
7411                 Self {
7412                         contents,
7413                         result_ok: o.result_ok,
7414                 }
7415         }
7416 }
7417 impl Clone for CResult_NodeIdDecodeErrorZ {
7418         fn clone(&self) -> Self {
7419                 if self.result_ok {
7420                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
7421                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
7422                         } }
7423                 } else {
7424                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
7425                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7426                         } }
7427                 }
7428         }
7429 }
7430 #[no_mangle]
7431 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
7432 /// but with all dynamically-allocated buffers duplicated in new buffers.
7433 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
7434 #[repr(C)]
7435 /// The contents of CResult_PublicKeySecp256k1ErrorZ
7436 pub union CResult_PublicKeySecp256k1ErrorZPtr {
7437         /// A pointer to the contents in the success state.
7438         /// Reading from this pointer when `result_ok` is not set is undefined.
7439         pub result: *mut crate::c_types::PublicKey,
7440         /// A pointer to the contents in the error state.
7441         /// Reading from this pointer when `result_ok` is set is undefined.
7442         pub err: *mut crate::c_types::Secp256k1Error,
7443 }
7444 #[repr(C)]
7445 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
7446 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
7447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7448 pub struct CResult_PublicKeySecp256k1ErrorZ {
7449         /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
7450         /// `err` or `result` depending on the state of `result_ok`.
7451         pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
7452         /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
7453         pub result_ok: bool,
7454 }
7455 #[no_mangle]
7456 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
7457 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
7458         CResult_PublicKeySecp256k1ErrorZ {
7459                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7460                         result: Box::into_raw(Box::new(o)),
7461                 },
7462                 result_ok: true,
7463         }
7464 }
7465 #[no_mangle]
7466 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
7467 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
7468         CResult_PublicKeySecp256k1ErrorZ {
7469                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7470                         err: Box::into_raw(Box::new(e)),
7471                 },
7472                 result_ok: false,
7473         }
7474 }
7475 /// Checks if the given object is currently in the success state
7476 #[no_mangle]
7477 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
7478         o.result_ok
7479 }
7480 #[no_mangle]
7481 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
7482 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
7483 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
7484         fn drop(&mut self) {
7485                 if self.result_ok {
7486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7488                         }
7489                 } else {
7490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7492                         }
7493                 }
7494         }
7495 }
7496 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
7497         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
7498                 let contents = if o.result_ok {
7499                         let result = unsafe { o.contents.result };
7500                         unsafe { o.contents.result = core::ptr::null_mut() };
7501                         CResult_PublicKeySecp256k1ErrorZPtr { result }
7502                 } else {
7503                         let err = unsafe { o.contents.err };
7504                         unsafe { o.contents.err = core::ptr::null_mut(); }
7505                         CResult_PublicKeySecp256k1ErrorZPtr { err }
7506                 };
7507                 Self {
7508                         contents,
7509                         result_ok: o.result_ok,
7510                 }
7511         }
7512 }
7513 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
7514         fn clone(&self) -> Self {
7515                 if self.result_ok {
7516                         Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7517                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7518                         } }
7519                 } else {
7520                         Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7521                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7522                         } }
7523                 }
7524         }
7525 }
7526 #[no_mangle]
7527 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
7528 /// but with all dynamically-allocated buffers duplicated in new buffers.
7529 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
7530 #[repr(C)]
7531 #[derive(Clone)]
7532 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
7533 pub enum COption_NetworkUpdateZ {
7534         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
7535         Some(crate::lightning::routing::gossip::NetworkUpdate),
7536         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
7537         None
7538 }
7539 impl COption_NetworkUpdateZ {
7540         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7541                 if let Self::None = self { false } else { true }
7542         }
7543         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7544                 !self.is_some()
7545         }
7546         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
7547                 if let Self::Some(v) = self { v } else { unreachable!() }
7548         }
7549 }
7550 #[no_mangle]
7551 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
7552 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
7553         COption_NetworkUpdateZ::Some(o)
7554 }
7555 #[no_mangle]
7556 /// Constructs a new COption_NetworkUpdateZ containing nothing
7557 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
7558         COption_NetworkUpdateZ::None
7559 }
7560 #[no_mangle]
7561 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
7562 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
7563 #[no_mangle]
7564 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
7565 /// but with all dynamically-allocated buffers duplicated in new buffers.
7566 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
7567 #[repr(C)]
7568 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7569 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7570         /// A pointer to the contents in the success state.
7571         /// Reading from this pointer when `result_ok` is not set is undefined.
7572         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
7573         /// A pointer to the contents in the error state.
7574         /// Reading from this pointer when `result_ok` is set is undefined.
7575         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7576 }
7577 #[repr(C)]
7578 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7579 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7581 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
7582         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7583         /// `err` or `result` depending on the state of `result_ok`.
7584         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
7585         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7586         pub result_ok: bool,
7587 }
7588 #[no_mangle]
7589 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
7590 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7591         CResult_COption_NetworkUpdateZDecodeErrorZ {
7592                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7593                         result: Box::into_raw(Box::new(o)),
7594                 },
7595                 result_ok: true,
7596         }
7597 }
7598 #[no_mangle]
7599 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
7600 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7601         CResult_COption_NetworkUpdateZDecodeErrorZ {
7602                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7603                         err: Box::into_raw(Box::new(e)),
7604                 },
7605                 result_ok: false,
7606         }
7607 }
7608 /// Checks if the given object is currently in the success state
7609 #[no_mangle]
7610 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
7611         o.result_ok
7612 }
7613 #[no_mangle]
7614 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
7615 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
7616 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
7617         fn drop(&mut self) {
7618                 if self.result_ok {
7619                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7620                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7621                         }
7622                 } else {
7623                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7624                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7625                         }
7626                 }
7627         }
7628 }
7629 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
7630         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7631                 let contents = if o.result_ok {
7632                         let result = unsafe { o.contents.result };
7633                         unsafe { o.contents.result = core::ptr::null_mut() };
7634                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
7635                 } else {
7636                         let err = unsafe { o.contents.err };
7637                         unsafe { o.contents.err = core::ptr::null_mut(); }
7638                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
7639                 };
7640                 Self {
7641                         contents,
7642                         result_ok: o.result_ok,
7643                 }
7644         }
7645 }
7646 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
7647         fn clone(&self) -> Self {
7648                 if self.result_ok {
7649                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7650                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
7651                         } }
7652                 } else {
7653                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7654                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7655                         } }
7656                 }
7657         }
7658 }
7659 #[no_mangle]
7660 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
7661 /// but with all dynamically-allocated buffers duplicated in new buffers.
7662 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
7663 #[repr(C)]
7664 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
7665 pub enum COption_UtxoLookupZ {
7666         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
7667         Some(crate::lightning::routing::utxo::UtxoLookup),
7668         /// When we're in this state, this COption_UtxoLookupZ contains nothing
7669         None
7670 }
7671 impl COption_UtxoLookupZ {
7672         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7673                 if let Self::None = self { false } else { true }
7674         }
7675         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7676                 !self.is_some()
7677         }
7678         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
7679                 if let Self::Some(v) = self { v } else { unreachable!() }
7680         }
7681 }
7682 #[no_mangle]
7683 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
7684 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
7685         COption_UtxoLookupZ::Some(o)
7686 }
7687 #[no_mangle]
7688 /// Constructs a new COption_UtxoLookupZ containing nothing
7689 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
7690         COption_UtxoLookupZ::None
7691 }
7692 #[no_mangle]
7693 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
7694 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
7695 #[repr(C)]
7696 /// The contents of CResult_NoneLightningErrorZ
7697 pub union CResult_NoneLightningErrorZPtr {
7698         /// Note that this value is always NULL, as there are no contents in the OK variant
7699         pub result: *mut core::ffi::c_void,
7700         /// A pointer to the contents in the error state.
7701         /// Reading from this pointer when `result_ok` is set is undefined.
7702         pub err: *mut crate::lightning::ln::msgs::LightningError,
7703 }
7704 #[repr(C)]
7705 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7706 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7708 pub struct CResult_NoneLightningErrorZ {
7709         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7710         /// `err` or `result` depending on the state of `result_ok`.
7711         pub contents: CResult_NoneLightningErrorZPtr,
7712         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7713         pub result_ok: bool,
7714 }
7715 #[no_mangle]
7716 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7717 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7718         CResult_NoneLightningErrorZ {
7719                 contents: CResult_NoneLightningErrorZPtr {
7720                         result: core::ptr::null_mut(),
7721                 },
7722                 result_ok: true,
7723         }
7724 }
7725 #[no_mangle]
7726 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7727 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7728         CResult_NoneLightningErrorZ {
7729                 contents: CResult_NoneLightningErrorZPtr {
7730                         err: Box::into_raw(Box::new(e)),
7731                 },
7732                 result_ok: false,
7733         }
7734 }
7735 /// Checks if the given object is currently in the success state
7736 #[no_mangle]
7737 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
7738         o.result_ok
7739 }
7740 #[no_mangle]
7741 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7742 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7743 impl Drop for CResult_NoneLightningErrorZ {
7744         fn drop(&mut self) {
7745                 if self.result_ok {
7746                 } else {
7747                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7749                         }
7750                 }
7751         }
7752 }
7753 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7754         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7755                 let contents = if o.result_ok {
7756                         let _ = unsafe { Box::from_raw(o.contents.result) };
7757                         o.contents.result = core::ptr::null_mut();
7758                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
7759                 } else {
7760                         let err = unsafe { o.contents.err };
7761                         unsafe { o.contents.err = core::ptr::null_mut(); }
7762                         CResult_NoneLightningErrorZPtr { err }
7763                 };
7764                 Self {
7765                         contents,
7766                         result_ok: o.result_ok,
7767                 }
7768         }
7769 }
7770 impl Clone for CResult_NoneLightningErrorZ {
7771         fn clone(&self) -> Self {
7772                 if self.result_ok {
7773                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7774                                 result: core::ptr::null_mut()
7775                         } }
7776                 } else {
7777                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7778                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7779                         } }
7780                 }
7781         }
7782 }
7783 #[no_mangle]
7784 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7787 #[repr(C)]
7788 /// The contents of CResult_boolLightningErrorZ
7789 pub union CResult_boolLightningErrorZPtr {
7790         /// A pointer to the contents in the success state.
7791         /// Reading from this pointer when `result_ok` is not set is undefined.
7792         pub result: *mut bool,
7793         /// A pointer to the contents in the error state.
7794         /// Reading from this pointer when `result_ok` is set is undefined.
7795         pub err: *mut crate::lightning::ln::msgs::LightningError,
7796 }
7797 #[repr(C)]
7798 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7799 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_boolLightningErrorZ {
7802         /// The contents of this CResult_boolLightningErrorZ, accessible via either
7803         /// `err` or `result` depending on the state of `result_ok`.
7804         pub contents: CResult_boolLightningErrorZPtr,
7805         /// Whether this CResult_boolLightningErrorZ represents a success state.
7806         pub result_ok: bool,
7807 }
7808 #[no_mangle]
7809 /// Creates a new CResult_boolLightningErrorZ in the success state.
7810 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7811         CResult_boolLightningErrorZ {
7812                 contents: CResult_boolLightningErrorZPtr {
7813                         result: Box::into_raw(Box::new(o)),
7814                 },
7815                 result_ok: true,
7816         }
7817 }
7818 #[no_mangle]
7819 /// Creates a new CResult_boolLightningErrorZ in the error state.
7820 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7821         CResult_boolLightningErrorZ {
7822                 contents: CResult_boolLightningErrorZPtr {
7823                         err: Box::into_raw(Box::new(e)),
7824                 },
7825                 result_ok: false,
7826         }
7827 }
7828 /// Checks if the given object is currently in the success state
7829 #[no_mangle]
7830 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
7831         o.result_ok
7832 }
7833 #[no_mangle]
7834 /// Frees any resources used by the CResult_boolLightningErrorZ.
7835 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7836 impl Drop for CResult_boolLightningErrorZ {
7837         fn drop(&mut self) {
7838                 if self.result_ok {
7839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7841                         }
7842                 } else {
7843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7845                         }
7846                 }
7847         }
7848 }
7849 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7850         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7851                 let contents = if o.result_ok {
7852                         let result = unsafe { o.contents.result };
7853                         unsafe { o.contents.result = core::ptr::null_mut() };
7854                         CResult_boolLightningErrorZPtr { result }
7855                 } else {
7856                         let err = unsafe { o.contents.err };
7857                         unsafe { o.contents.err = core::ptr::null_mut(); }
7858                         CResult_boolLightningErrorZPtr { err }
7859                 };
7860                 Self {
7861                         contents,
7862                         result_ok: o.result_ok,
7863                 }
7864         }
7865 }
7866 impl Clone for CResult_boolLightningErrorZ {
7867         fn clone(&self) -> Self {
7868                 if self.result_ok {
7869                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7870                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7871                         } }
7872                 } else {
7873                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7875                         } }
7876                 }
7877         }
7878 }
7879 #[no_mangle]
7880 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7883 #[repr(C)]
7884 /// A tuple of 3 elements. See the individual fields for the types contained.
7885 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7886         /// The element at position 0
7887         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7888         /// The element at position 1
7889         pub b: crate::lightning::ln::msgs::ChannelUpdate,
7890         /// The element at position 2
7891         pub c: crate::lightning::ln::msgs::ChannelUpdate,
7892 }
7893 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7894         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7895                 Self {
7896                         a: tup.0,
7897                         b: tup.1,
7898                         c: tup.2,
7899                 }
7900         }
7901 }
7902 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7903         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7904                 (self.a, self.b, self.c)
7905         }
7906 }
7907 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7908         fn clone(&self) -> Self {
7909                 Self {
7910                         a: Clone::clone(&self.a),
7911                         b: Clone::clone(&self.b),
7912                         c: Clone::clone(&self.c),
7913                 }
7914         }
7915 }
7916 #[no_mangle]
7917 /// Creates a new tuple which has the same data as `orig`
7918 /// but with all dynamically-allocated buffers duplicated in new buffers.
7919 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7920 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7921 #[no_mangle]
7922 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 {
7923         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7924 }
7925
7926 #[no_mangle]
7927 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7928 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7929 #[repr(C)]
7930 #[derive(Clone)]
7931 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
7932 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7933         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7934         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
7935         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
7936         None
7937 }
7938 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7939         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7940                 if let Self::None = self { false } else { true }
7941         }
7942         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7943                 !self.is_some()
7944         }
7945         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7946                 if let Self::Some(v) = self { v } else { unreachable!() }
7947         }
7948 }
7949 #[no_mangle]
7950 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7951 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7952         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
7953 }
7954 #[no_mangle]
7955 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
7956 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7957         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
7958 }
7959 #[no_mangle]
7960 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
7961 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7962 #[no_mangle]
7963 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
7964 /// but with all dynamically-allocated buffers duplicated in new buffers.
7965 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
7966 #[repr(C)]
7967 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
7968 /// This corresponds to std::vector in C++
7969 pub struct CVec_MessageSendEventZ {
7970         /// The elements in the array.
7971         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7972         pub data: *mut crate::lightning::events::MessageSendEvent,
7973         /// The number of elements pointed to by `data`.
7974         pub datalen: usize
7975 }
7976 impl CVec_MessageSendEventZ {
7977         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
7978                 if self.datalen == 0 { return Vec::new(); }
7979                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7980                 self.data = core::ptr::null_mut();
7981                 self.datalen = 0;
7982                 ret
7983         }
7984         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
7985                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7986         }
7987 }
7988 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
7989         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
7990                 let datalen = v.len();
7991                 let data = Box::into_raw(v.into_boxed_slice());
7992                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7993         }
7994 }
7995 #[no_mangle]
7996 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7997 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
7998 impl Drop for CVec_MessageSendEventZ {
7999         fn drop(&mut self) {
8000                 if self.datalen == 0 { return; }
8001                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8002         }
8003 }
8004 impl Clone for CVec_MessageSendEventZ {
8005         fn clone(&self) -> Self {
8006                 let mut res = Vec::new();
8007                 if self.datalen == 0 { return Self::from(res); }
8008                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8009                 Self::from(res)
8010         }
8011 }
8012 #[repr(C)]
8013 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8014 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
8015         /// A pointer to the contents in the success state.
8016         /// Reading from this pointer when `result_ok` is not set is undefined.
8017         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
8018         /// A pointer to the contents in the error state.
8019         /// Reading from this pointer when `result_ok` is set is undefined.
8020         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8021 }
8022 #[repr(C)]
8023 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8024 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8026 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
8027         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8028         /// `err` or `result` depending on the state of `result_ok`.
8029         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
8030         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8031         pub result_ok: bool,
8032 }
8033 #[no_mangle]
8034 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
8035 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8036         CResult_ChannelUpdateInfoDecodeErrorZ {
8037                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8038                         result: Box::into_raw(Box::new(o)),
8039                 },
8040                 result_ok: true,
8041         }
8042 }
8043 #[no_mangle]
8044 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
8045 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8046         CResult_ChannelUpdateInfoDecodeErrorZ {
8047                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8048                         err: Box::into_raw(Box::new(e)),
8049                 },
8050                 result_ok: false,
8051         }
8052 }
8053 /// Checks if the given object is currently in the success state
8054 #[no_mangle]
8055 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
8056         o.result_ok
8057 }
8058 #[no_mangle]
8059 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
8060 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
8061 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
8062         fn drop(&mut self) {
8063                 if self.result_ok {
8064                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8065                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8066                         }
8067                 } else {
8068                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8069                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8070                         }
8071                 }
8072         }
8073 }
8074 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
8075         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8076                 let contents = if o.result_ok {
8077                         let result = unsafe { o.contents.result };
8078                         unsafe { o.contents.result = core::ptr::null_mut() };
8079                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
8080                 } else {
8081                         let err = unsafe { o.contents.err };
8082                         unsafe { o.contents.err = core::ptr::null_mut(); }
8083                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
8084                 };
8085                 Self {
8086                         contents,
8087                         result_ok: o.result_ok,
8088                 }
8089         }
8090 }
8091 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
8092         fn clone(&self) -> Self {
8093                 if self.result_ok {
8094                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8095                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
8096                         } }
8097                 } else {
8098                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8099                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8100                         } }
8101                 }
8102         }
8103 }
8104 #[no_mangle]
8105 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
8106 /// but with all dynamically-allocated buffers duplicated in new buffers.
8107 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
8108 #[repr(C)]
8109 /// The contents of CResult_ChannelInfoDecodeErrorZ
8110 pub union CResult_ChannelInfoDecodeErrorZPtr {
8111         /// A pointer to the contents in the success state.
8112         /// Reading from this pointer when `result_ok` is not set is undefined.
8113         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
8114         /// A pointer to the contents in the error state.
8115         /// Reading from this pointer when `result_ok` is set is undefined.
8116         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8117 }
8118 #[repr(C)]
8119 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8120 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8122 pub struct CResult_ChannelInfoDecodeErrorZ {
8123         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8124         /// `err` or `result` depending on the state of `result_ok`.
8125         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8126         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8127         pub result_ok: bool,
8128 }
8129 #[no_mangle]
8130 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8131 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8132         CResult_ChannelInfoDecodeErrorZ {
8133                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8134                         result: Box::into_raw(Box::new(o)),
8135                 },
8136                 result_ok: true,
8137         }
8138 }
8139 #[no_mangle]
8140 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8141 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8142         CResult_ChannelInfoDecodeErrorZ {
8143                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8144                         err: Box::into_raw(Box::new(e)),
8145                 },
8146                 result_ok: false,
8147         }
8148 }
8149 /// Checks if the given object is currently in the success state
8150 #[no_mangle]
8151 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
8152         o.result_ok
8153 }
8154 #[no_mangle]
8155 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8156 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8157 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8158         fn drop(&mut self) {
8159                 if self.result_ok {
8160                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8161                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8162                         }
8163                 } else {
8164                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8165                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8166                         }
8167                 }
8168         }
8169 }
8170 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8171         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8172                 let contents = if o.result_ok {
8173                         let result = unsafe { o.contents.result };
8174                         unsafe { o.contents.result = core::ptr::null_mut() };
8175                         CResult_ChannelInfoDecodeErrorZPtr { result }
8176                 } else {
8177                         let err = unsafe { o.contents.err };
8178                         unsafe { o.contents.err = core::ptr::null_mut(); }
8179                         CResult_ChannelInfoDecodeErrorZPtr { err }
8180                 };
8181                 Self {
8182                         contents,
8183                         result_ok: o.result_ok,
8184                 }
8185         }
8186 }
8187 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8188         fn clone(&self) -> Self {
8189                 if self.result_ok {
8190                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8191                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8192                         } }
8193                 } else {
8194                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8195                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8196                         } }
8197                 }
8198         }
8199 }
8200 #[no_mangle]
8201 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8202 /// but with all dynamically-allocated buffers duplicated in new buffers.
8203 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8204 #[repr(C)]
8205 /// The contents of CResult_RoutingFeesDecodeErrorZ
8206 pub union CResult_RoutingFeesDecodeErrorZPtr {
8207         /// A pointer to the contents in the success state.
8208         /// Reading from this pointer when `result_ok` is not set is undefined.
8209         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
8210         /// A pointer to the contents in the error state.
8211         /// Reading from this pointer when `result_ok` is set is undefined.
8212         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8213 }
8214 #[repr(C)]
8215 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8216 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8218 pub struct CResult_RoutingFeesDecodeErrorZ {
8219         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8220         /// `err` or `result` depending on the state of `result_ok`.
8221         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8222         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8223         pub result_ok: bool,
8224 }
8225 #[no_mangle]
8226 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8227 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8228         CResult_RoutingFeesDecodeErrorZ {
8229                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8230                         result: Box::into_raw(Box::new(o)),
8231                 },
8232                 result_ok: true,
8233         }
8234 }
8235 #[no_mangle]
8236 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8237 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8238         CResult_RoutingFeesDecodeErrorZ {
8239                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8240                         err: Box::into_raw(Box::new(e)),
8241                 },
8242                 result_ok: false,
8243         }
8244 }
8245 /// Checks if the given object is currently in the success state
8246 #[no_mangle]
8247 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
8248         o.result_ok
8249 }
8250 #[no_mangle]
8251 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8252 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8253 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8254         fn drop(&mut self) {
8255                 if self.result_ok {
8256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8258                         }
8259                 } else {
8260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8262                         }
8263                 }
8264         }
8265 }
8266 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8268                 let contents = if o.result_ok {
8269                         let result = unsafe { o.contents.result };
8270                         unsafe { o.contents.result = core::ptr::null_mut() };
8271                         CResult_RoutingFeesDecodeErrorZPtr { result }
8272                 } else {
8273                         let err = unsafe { o.contents.err };
8274                         unsafe { o.contents.err = core::ptr::null_mut(); }
8275                         CResult_RoutingFeesDecodeErrorZPtr { err }
8276                 };
8277                 Self {
8278                         contents,
8279                         result_ok: o.result_ok,
8280                 }
8281         }
8282 }
8283 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8284         fn clone(&self) -> Self {
8285                 if self.result_ok {
8286                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8287                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
8288                         } }
8289                 } else {
8290                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8291                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8292                         } }
8293                 }
8294         }
8295 }
8296 #[no_mangle]
8297 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8298 /// but with all dynamically-allocated buffers duplicated in new buffers.
8299 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8300 #[repr(C)]
8301 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
8302 /// This corresponds to std::vector in C++
8303 pub struct CVec_SocketAddressZ {
8304         /// The elements in the array.
8305         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8306         pub data: *mut crate::lightning::ln::msgs::SocketAddress,
8307         /// The number of elements pointed to by `data`.
8308         pub datalen: usize
8309 }
8310 impl CVec_SocketAddressZ {
8311         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
8312                 if self.datalen == 0 { return Vec::new(); }
8313                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8314                 self.data = core::ptr::null_mut();
8315                 self.datalen = 0;
8316                 ret
8317         }
8318         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
8319                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8320         }
8321 }
8322 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
8323         fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
8324                 let datalen = v.len();
8325                 let data = Box::into_raw(v.into_boxed_slice());
8326                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8327         }
8328 }
8329 #[no_mangle]
8330 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8331 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
8332 impl Drop for CVec_SocketAddressZ {
8333         fn drop(&mut self) {
8334                 if self.datalen == 0 { return; }
8335                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8336         }
8337 }
8338 impl Clone for CVec_SocketAddressZ {
8339         fn clone(&self) -> Self {
8340                 let mut res = Vec::new();
8341                 if self.datalen == 0 { return Self::from(res); }
8342                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8343                 Self::from(res)
8344         }
8345 }
8346 #[repr(C)]
8347 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8348 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8349         /// A pointer to the contents in the success state.
8350         /// Reading from this pointer when `result_ok` is not set is undefined.
8351         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
8352         /// A pointer to the contents in the error state.
8353         /// Reading from this pointer when `result_ok` is set is undefined.
8354         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8355 }
8356 #[repr(C)]
8357 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8358 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8360 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8361         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8362         /// `err` or `result` depending on the state of `result_ok`.
8363         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8364         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8365         pub result_ok: bool,
8366 }
8367 #[no_mangle]
8368 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8369 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8370         CResult_NodeAnnouncementInfoDecodeErrorZ {
8371                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8372                         result: Box::into_raw(Box::new(o)),
8373                 },
8374                 result_ok: true,
8375         }
8376 }
8377 #[no_mangle]
8378 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8379 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8380         CResult_NodeAnnouncementInfoDecodeErrorZ {
8381                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8382                         err: Box::into_raw(Box::new(e)),
8383                 },
8384                 result_ok: false,
8385         }
8386 }
8387 /// Checks if the given object is currently in the success state
8388 #[no_mangle]
8389 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
8390         o.result_ok
8391 }
8392 #[no_mangle]
8393 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8394 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8395 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8396         fn drop(&mut self) {
8397                 if self.result_ok {
8398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8400                         }
8401                 } else {
8402                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8403                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8404                         }
8405                 }
8406         }
8407 }
8408 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8409         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8410                 let contents = if o.result_ok {
8411                         let result = unsafe { o.contents.result };
8412                         unsafe { o.contents.result = core::ptr::null_mut() };
8413                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8414                 } else {
8415                         let err = unsafe { o.contents.err };
8416                         unsafe { o.contents.err = core::ptr::null_mut(); }
8417                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8418                 };
8419                 Self {
8420                         contents,
8421                         result_ok: o.result_ok,
8422                 }
8423         }
8424 }
8425 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8426         fn clone(&self) -> Self {
8427                 if self.result_ok {
8428                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8429                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8430                         } }
8431                 } else {
8432                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8433                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8434                         } }
8435                 }
8436         }
8437 }
8438 #[no_mangle]
8439 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8440 /// but with all dynamically-allocated buffers duplicated in new buffers.
8441 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8442 #[repr(C)]
8443 /// The contents of CResult_NodeAliasDecodeErrorZ
8444 pub union CResult_NodeAliasDecodeErrorZPtr {
8445         /// A pointer to the contents in the success state.
8446         /// Reading from this pointer when `result_ok` is not set is undefined.
8447         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
8448         /// A pointer to the contents in the error state.
8449         /// Reading from this pointer when `result_ok` is set is undefined.
8450         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8451 }
8452 #[repr(C)]
8453 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
8454 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
8455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8456 pub struct CResult_NodeAliasDecodeErrorZ {
8457         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
8458         /// `err` or `result` depending on the state of `result_ok`.
8459         pub contents: CResult_NodeAliasDecodeErrorZPtr,
8460         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
8461         pub result_ok: bool,
8462 }
8463 #[no_mangle]
8464 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
8465 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
8466         CResult_NodeAliasDecodeErrorZ {
8467                 contents: CResult_NodeAliasDecodeErrorZPtr {
8468                         result: Box::into_raw(Box::new(o)),
8469                 },
8470                 result_ok: true,
8471         }
8472 }
8473 #[no_mangle]
8474 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
8475 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
8476         CResult_NodeAliasDecodeErrorZ {
8477                 contents: CResult_NodeAliasDecodeErrorZPtr {
8478                         err: Box::into_raw(Box::new(e)),
8479                 },
8480                 result_ok: false,
8481         }
8482 }
8483 /// Checks if the given object is currently in the success state
8484 #[no_mangle]
8485 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
8486         o.result_ok
8487 }
8488 #[no_mangle]
8489 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
8490 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
8491 impl Drop for CResult_NodeAliasDecodeErrorZ {
8492         fn drop(&mut self) {
8493                 if self.result_ok {
8494                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8495                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8496                         }
8497                 } else {
8498                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8499                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8500                         }
8501                 }
8502         }
8503 }
8504 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
8505         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
8506                 let contents = if o.result_ok {
8507                         let result = unsafe { o.contents.result };
8508                         unsafe { o.contents.result = core::ptr::null_mut() };
8509                         CResult_NodeAliasDecodeErrorZPtr { result }
8510                 } else {
8511                         let err = unsafe { o.contents.err };
8512                         unsafe { o.contents.err = core::ptr::null_mut(); }
8513                         CResult_NodeAliasDecodeErrorZPtr { err }
8514                 };
8515                 Self {
8516                         contents,
8517                         result_ok: o.result_ok,
8518                 }
8519         }
8520 }
8521 impl Clone for CResult_NodeAliasDecodeErrorZ {
8522         fn clone(&self) -> Self {
8523                 if self.result_ok {
8524                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
8525                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
8526                         } }
8527                 } else {
8528                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
8529                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8530                         } }
8531                 }
8532         }
8533 }
8534 #[no_mangle]
8535 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
8536 /// but with all dynamically-allocated buffers duplicated in new buffers.
8537 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
8538 #[repr(C)]
8539 /// The contents of CResult_NodeInfoDecodeErrorZ
8540 pub union CResult_NodeInfoDecodeErrorZPtr {
8541         /// A pointer to the contents in the success state.
8542         /// Reading from this pointer when `result_ok` is not set is undefined.
8543         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
8544         /// A pointer to the contents in the error state.
8545         /// Reading from this pointer when `result_ok` is set is undefined.
8546         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8547 }
8548 #[repr(C)]
8549 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8550 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8552 pub struct CResult_NodeInfoDecodeErrorZ {
8553         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8554         /// `err` or `result` depending on the state of `result_ok`.
8555         pub contents: CResult_NodeInfoDecodeErrorZPtr,
8556         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8557         pub result_ok: bool,
8558 }
8559 #[no_mangle]
8560 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8561 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8562         CResult_NodeInfoDecodeErrorZ {
8563                 contents: CResult_NodeInfoDecodeErrorZPtr {
8564                         result: Box::into_raw(Box::new(o)),
8565                 },
8566                 result_ok: true,
8567         }
8568 }
8569 #[no_mangle]
8570 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8571 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8572         CResult_NodeInfoDecodeErrorZ {
8573                 contents: CResult_NodeInfoDecodeErrorZPtr {
8574                         err: Box::into_raw(Box::new(e)),
8575                 },
8576                 result_ok: false,
8577         }
8578 }
8579 /// Checks if the given object is currently in the success state
8580 #[no_mangle]
8581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
8582         o.result_ok
8583 }
8584 #[no_mangle]
8585 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8586 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8587 impl Drop for CResult_NodeInfoDecodeErrorZ {
8588         fn drop(&mut self) {
8589                 if self.result_ok {
8590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8592                         }
8593                 } else {
8594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8596                         }
8597                 }
8598         }
8599 }
8600 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8602                 let contents = if o.result_ok {
8603                         let result = unsafe { o.contents.result };
8604                         unsafe { o.contents.result = core::ptr::null_mut() };
8605                         CResult_NodeInfoDecodeErrorZPtr { result }
8606                 } else {
8607                         let err = unsafe { o.contents.err };
8608                         unsafe { o.contents.err = core::ptr::null_mut(); }
8609                         CResult_NodeInfoDecodeErrorZPtr { err }
8610                 };
8611                 Self {
8612                         contents,
8613                         result_ok: o.result_ok,
8614                 }
8615         }
8616 }
8617 impl Clone for CResult_NodeInfoDecodeErrorZ {
8618         fn clone(&self) -> Self {
8619                 if self.result_ok {
8620                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8621                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
8622                         } }
8623                 } else {
8624                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8625                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8626                         } }
8627                 }
8628         }
8629 }
8630 #[no_mangle]
8631 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8632 /// but with all dynamically-allocated buffers duplicated in new buffers.
8633 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8634 #[repr(C)]
8635 /// The contents of CResult_NetworkGraphDecodeErrorZ
8636 pub union CResult_NetworkGraphDecodeErrorZPtr {
8637         /// A pointer to the contents in the success state.
8638         /// Reading from this pointer when `result_ok` is not set is undefined.
8639         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
8640         /// A pointer to the contents in the error state.
8641         /// Reading from this pointer when `result_ok` is set is undefined.
8642         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8643 }
8644 #[repr(C)]
8645 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8646 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8648 pub struct CResult_NetworkGraphDecodeErrorZ {
8649         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8650         /// `err` or `result` depending on the state of `result_ok`.
8651         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8652         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8653         pub result_ok: bool,
8654 }
8655 #[no_mangle]
8656 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8657 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8658         CResult_NetworkGraphDecodeErrorZ {
8659                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8660                         result: Box::into_raw(Box::new(o)),
8661                 },
8662                 result_ok: true,
8663         }
8664 }
8665 #[no_mangle]
8666 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8667 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8668         CResult_NetworkGraphDecodeErrorZ {
8669                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8670                         err: Box::into_raw(Box::new(e)),
8671                 },
8672                 result_ok: false,
8673         }
8674 }
8675 /// Checks if the given object is currently in the success state
8676 #[no_mangle]
8677 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
8678         o.result_ok
8679 }
8680 #[no_mangle]
8681 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8682 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8683 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8684         fn drop(&mut self) {
8685                 if self.result_ok {
8686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8688                         }
8689                 } else {
8690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8692                         }
8693                 }
8694         }
8695 }
8696 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8698                 let contents = if o.result_ok {
8699                         let result = unsafe { o.contents.result };
8700                         unsafe { o.contents.result = core::ptr::null_mut() };
8701                         CResult_NetworkGraphDecodeErrorZPtr { result }
8702                 } else {
8703                         let err = unsafe { o.contents.err };
8704                         unsafe { o.contents.err = core::ptr::null_mut(); }
8705                         CResult_NetworkGraphDecodeErrorZPtr { err }
8706                 };
8707                 Self {
8708                         contents,
8709                         result_ok: o.result_ok,
8710                 }
8711         }
8712 }
8713 #[repr(C)]
8714 #[derive(Clone)]
8715 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
8716 pub enum COption_CVec_SocketAddressZZ {
8717         /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
8718         Some(crate::c_types::derived::CVec_SocketAddressZ),
8719         /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
8720         None
8721 }
8722 impl COption_CVec_SocketAddressZZ {
8723         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8724                 if let Self::None = self { false } else { true }
8725         }
8726         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8727                 !self.is_some()
8728         }
8729         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
8730                 if let Self::Some(v) = self { v } else { unreachable!() }
8731         }
8732 }
8733 #[no_mangle]
8734 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
8735 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
8736         COption_CVec_SocketAddressZZ::Some(o)
8737 }
8738 #[no_mangle]
8739 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
8740 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
8741         COption_CVec_SocketAddressZZ::None
8742 }
8743 #[no_mangle]
8744 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
8745 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
8746 #[no_mangle]
8747 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
8748 /// but with all dynamically-allocated buffers duplicated in new buffers.
8749 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
8750 #[repr(C)]
8751 /// The contents of CResult_u64ShortChannelIdErrorZ
8752 pub union CResult_u64ShortChannelIdErrorZPtr {
8753         /// A pointer to the contents in the success state.
8754         /// Reading from this pointer when `result_ok` is not set is undefined.
8755         pub result: *mut u64,
8756         /// A pointer to the contents in the error state.
8757         /// Reading from this pointer when `result_ok` is set is undefined.
8758         pub err: *mut crate::lightning::util::scid_utils::ShortChannelIdError,
8759 }
8760 #[repr(C)]
8761 /// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation,
8762 /// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure.
8763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8764 pub struct CResult_u64ShortChannelIdErrorZ {
8765         /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either
8766         /// `err` or `result` depending on the state of `result_ok`.
8767         pub contents: CResult_u64ShortChannelIdErrorZPtr,
8768         /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state.
8769         pub result_ok: bool,
8770 }
8771 #[no_mangle]
8772 /// Creates a new CResult_u64ShortChannelIdErrorZ in the success state.
8773 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ {
8774         CResult_u64ShortChannelIdErrorZ {
8775                 contents: CResult_u64ShortChannelIdErrorZPtr {
8776                         result: Box::into_raw(Box::new(o)),
8777                 },
8778                 result_ok: true,
8779         }
8780 }
8781 #[no_mangle]
8782 /// Creates a new CResult_u64ShortChannelIdErrorZ in the error state.
8783 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ {
8784         CResult_u64ShortChannelIdErrorZ {
8785                 contents: CResult_u64ShortChannelIdErrorZPtr {
8786                         err: Box::into_raw(Box::new(e)),
8787                 },
8788                 result_ok: false,
8789         }
8790 }
8791 /// Checks if the given object is currently in the success state
8792 #[no_mangle]
8793 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool {
8794         o.result_ok
8795 }
8796 #[no_mangle]
8797 /// Frees any resources used by the CResult_u64ShortChannelIdErrorZ.
8798 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { }
8799 impl Drop for CResult_u64ShortChannelIdErrorZ {
8800         fn drop(&mut self) {
8801                 if self.result_ok {
8802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8804                         }
8805                 } else {
8806                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8807                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8808                         }
8809                 }
8810         }
8811 }
8812 impl From<crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>> for CResult_u64ShortChannelIdErrorZ {
8813         fn from(mut o: crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>) -> Self {
8814                 let contents = if o.result_ok {
8815                         let result = unsafe { o.contents.result };
8816                         unsafe { o.contents.result = core::ptr::null_mut() };
8817                         CResult_u64ShortChannelIdErrorZPtr { result }
8818                 } else {
8819                         let err = unsafe { o.contents.err };
8820                         unsafe { o.contents.err = core::ptr::null_mut(); }
8821                         CResult_u64ShortChannelIdErrorZPtr { err }
8822                 };
8823                 Self {
8824                         contents,
8825                         result_ok: o.result_ok,
8826                 }
8827         }
8828 }
8829 #[repr(C)]
8830 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
8831 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8832         /// A pointer to the contents in the success state.
8833         /// Reading from this pointer when `result_ok` is not set is undefined.
8834         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
8835         /// A pointer to the contents in the error state.
8836         /// Reading from this pointer when `result_ok` is set is undefined.
8837         pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
8838 }
8839 #[repr(C)]
8840 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
8841 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
8842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8843 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
8844         /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
8845         /// `err` or `result` depending on the state of `result_ok`.
8846         pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
8847         /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
8848         pub result_ok: bool,
8849 }
8850 #[no_mangle]
8851 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
8852 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8853         CResult_PendingHTLCInfoInboundHTLCErrZ {
8854                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8855                         result: Box::into_raw(Box::new(o)),
8856                 },
8857                 result_ok: true,
8858         }
8859 }
8860 #[no_mangle]
8861 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
8862 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8863         CResult_PendingHTLCInfoInboundHTLCErrZ {
8864                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8865                         err: Box::into_raw(Box::new(e)),
8866                 },
8867                 result_ok: false,
8868         }
8869 }
8870 /// Checks if the given object is currently in the success state
8871 #[no_mangle]
8872 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
8873         o.result_ok
8874 }
8875 #[no_mangle]
8876 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
8877 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
8878 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
8879         fn drop(&mut self) {
8880                 if self.result_ok {
8881                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8882                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8883                         }
8884                 } else {
8885                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8886                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8887                         }
8888                 }
8889         }
8890 }
8891 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
8892         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
8893                 let contents = if o.result_ok {
8894                         let result = unsafe { o.contents.result };
8895                         unsafe { o.contents.result = core::ptr::null_mut() };
8896                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
8897                 } else {
8898                         let err = unsafe { o.contents.err };
8899                         unsafe { o.contents.err = core::ptr::null_mut(); }
8900                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
8901                 };
8902                 Self {
8903                         contents,
8904                         result_ok: o.result_ok,
8905                 }
8906         }
8907 }
8908 #[repr(C)]
8909 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
8910 /// This corresponds to std::vector in C++
8911 pub struct CVec_HTLCOutputInCommitmentZ {
8912         /// The elements in the array.
8913         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8914         pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
8915         /// The number of elements pointed to by `data`.
8916         pub datalen: usize
8917 }
8918 impl CVec_HTLCOutputInCommitmentZ {
8919         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
8920                 if self.datalen == 0 { return Vec::new(); }
8921                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8922                 self.data = core::ptr::null_mut();
8923                 self.datalen = 0;
8924                 ret
8925         }
8926         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
8927                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8928         }
8929 }
8930 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
8931         fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
8932                 let datalen = v.len();
8933                 let data = Box::into_raw(v.into_boxed_slice());
8934                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8935         }
8936 }
8937 #[no_mangle]
8938 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8939 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
8940 impl Drop for CVec_HTLCOutputInCommitmentZ {
8941         fn drop(&mut self) {
8942                 if self.datalen == 0 { return; }
8943                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8944         }
8945 }
8946 impl Clone for CVec_HTLCOutputInCommitmentZ {
8947         fn clone(&self) -> Self {
8948                 let mut res = Vec::new();
8949                 if self.datalen == 0 { return Self::from(res); }
8950                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8951                 Self::from(res)
8952         }
8953 }
8954 #[repr(C)]
8955 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
8956 /// This corresponds to std::vector in C++
8957 pub struct CVec_HTLCDescriptorZ {
8958         /// The elements in the array.
8959         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8960         pub data: *mut crate::lightning::sign::HTLCDescriptor,
8961         /// The number of elements pointed to by `data`.
8962         pub datalen: usize
8963 }
8964 impl CVec_HTLCDescriptorZ {
8965         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
8966                 if self.datalen == 0 { return Vec::new(); }
8967                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8968                 self.data = core::ptr::null_mut();
8969                 self.datalen = 0;
8970                 ret
8971         }
8972         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
8973                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8974         }
8975 }
8976 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
8977         fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
8978                 let datalen = v.len();
8979                 let data = Box::into_raw(v.into_boxed_slice());
8980                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8981         }
8982 }
8983 #[no_mangle]
8984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8985 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
8986 impl Drop for CVec_HTLCDescriptorZ {
8987         fn drop(&mut self) {
8988                 if self.datalen == 0 { return; }
8989                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8990         }
8991 }
8992 impl Clone for CVec_HTLCDescriptorZ {
8993         fn clone(&self) -> Self {
8994                 let mut res = Vec::new();
8995                 if self.datalen == 0 { return Self::from(res); }
8996                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8997                 Self::from(res)
8998         }
8999 }
9000 #[repr(C)]
9001 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
9002 /// This corresponds to std::vector in C++
9003 pub struct CVec_UtxoZ {
9004         /// The elements in the array.
9005         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9006         pub data: *mut crate::lightning::events::bump_transaction::Utxo,
9007         /// The number of elements pointed to by `data`.
9008         pub datalen: usize
9009 }
9010 impl CVec_UtxoZ {
9011         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
9012                 if self.datalen == 0 { return Vec::new(); }
9013                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9014                 self.data = core::ptr::null_mut();
9015                 self.datalen = 0;
9016                 ret
9017         }
9018         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
9019                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9020         }
9021 }
9022 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
9023         fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
9024                 let datalen = v.len();
9025                 let data = Box::into_raw(v.into_boxed_slice());
9026                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9027         }
9028 }
9029 #[no_mangle]
9030 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9031 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
9032 impl Drop for CVec_UtxoZ {
9033         fn drop(&mut self) {
9034                 if self.datalen == 0 { return; }
9035                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9036         }
9037 }
9038 impl Clone for CVec_UtxoZ {
9039         fn clone(&self) -> Self {
9040                 let mut res = Vec::new();
9041                 if self.datalen == 0 { return Self::from(res); }
9042                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9043                 Self::from(res)
9044         }
9045 }
9046 #[repr(C)]
9047 #[derive(Clone)]
9048 /// An enum which can either contain a crate::c_types::TxOut or not
9049 pub enum COption_TxOutZ {
9050         /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
9051         Some(crate::c_types::TxOut),
9052         /// When we're in this state, this COption_TxOutZ contains nothing
9053         None
9054 }
9055 impl COption_TxOutZ {
9056         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9057                 if let Self::None = self { false } else { true }
9058         }
9059         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9060                 !self.is_some()
9061         }
9062         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
9063                 if let Self::Some(v) = self { v } else { unreachable!() }
9064         }
9065 }
9066 #[no_mangle]
9067 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
9068 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
9069         COption_TxOutZ::Some(o)
9070 }
9071 #[no_mangle]
9072 /// Constructs a new COption_TxOutZ containing nothing
9073 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
9074         COption_TxOutZ::None
9075 }
9076 #[no_mangle]
9077 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
9078 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
9079 #[no_mangle]
9080 /// Creates a new COption_TxOutZ which has the same data as `orig`
9081 /// but with all dynamically-allocated buffers duplicated in new buffers.
9082 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
9083 #[repr(C)]
9084 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
9085 /// This corresponds to std::vector in C++
9086 pub struct CVec_InputZ {
9087         /// The elements in the array.
9088         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9089         pub data: *mut crate::lightning::events::bump_transaction::Input,
9090         /// The number of elements pointed to by `data`.
9091         pub datalen: usize
9092 }
9093 impl CVec_InputZ {
9094         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
9095                 if self.datalen == 0 { return Vec::new(); }
9096                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9097                 self.data = core::ptr::null_mut();
9098                 self.datalen = 0;
9099                 ret
9100         }
9101         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
9102                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9103         }
9104 }
9105 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
9106         fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
9107                 let datalen = v.len();
9108                 let data = Box::into_raw(v.into_boxed_slice());
9109                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9110         }
9111 }
9112 #[no_mangle]
9113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9114 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
9115 impl Drop for CVec_InputZ {
9116         fn drop(&mut self) {
9117                 if self.datalen == 0 { return; }
9118                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9119         }
9120 }
9121 impl Clone for CVec_InputZ {
9122         fn clone(&self) -> Self {
9123                 let mut res = Vec::new();
9124                 if self.datalen == 0 { return Self::from(res); }
9125                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9126                 Self::from(res)
9127         }
9128 }
9129 #[repr(C)]
9130 /// The contents of CResult_CoinSelectionNoneZ
9131 pub union CResult_CoinSelectionNoneZPtr {
9132         /// A pointer to the contents in the success state.
9133         /// Reading from this pointer when `result_ok` is not set is undefined.
9134         pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
9135         /// Note that this value is always NULL, as there are no contents in the Err variant
9136         pub err: *mut core::ffi::c_void,
9137 }
9138 #[repr(C)]
9139 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
9140 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
9141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9142 pub struct CResult_CoinSelectionNoneZ {
9143         /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
9144         /// `err` or `result` depending on the state of `result_ok`.
9145         pub contents: CResult_CoinSelectionNoneZPtr,
9146         /// Whether this CResult_CoinSelectionNoneZ represents a success state.
9147         pub result_ok: bool,
9148 }
9149 #[no_mangle]
9150 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
9151 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
9152         CResult_CoinSelectionNoneZ {
9153                 contents: CResult_CoinSelectionNoneZPtr {
9154                         result: Box::into_raw(Box::new(o)),
9155                 },
9156                 result_ok: true,
9157         }
9158 }
9159 #[no_mangle]
9160 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
9161 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
9162         CResult_CoinSelectionNoneZ {
9163                 contents: CResult_CoinSelectionNoneZPtr {
9164                         err: core::ptr::null_mut(),
9165                 },
9166                 result_ok: false,
9167         }
9168 }
9169 /// Checks if the given object is currently in the success state
9170 #[no_mangle]
9171 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
9172         o.result_ok
9173 }
9174 #[no_mangle]
9175 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
9176 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
9177 impl Drop for CResult_CoinSelectionNoneZ {
9178         fn drop(&mut self) {
9179                 if self.result_ok {
9180                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9181                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9182                         }
9183                 } else {
9184                 }
9185         }
9186 }
9187 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
9188         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
9189                 let contents = if o.result_ok {
9190                         let result = unsafe { o.contents.result };
9191                         unsafe { o.contents.result = core::ptr::null_mut() };
9192                         CResult_CoinSelectionNoneZPtr { result }
9193                 } else {
9194                         let _ = unsafe { Box::from_raw(o.contents.err) };
9195                         o.contents.err = core::ptr::null_mut();
9196                         CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
9197                 };
9198                 Self {
9199                         contents,
9200                         result_ok: o.result_ok,
9201                 }
9202         }
9203 }
9204 impl Clone for CResult_CoinSelectionNoneZ {
9205         fn clone(&self) -> Self {
9206                 if self.result_ok {
9207                         Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
9208                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
9209                         } }
9210                 } else {
9211                         Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
9212                                 err: core::ptr::null_mut()
9213                         } }
9214                 }
9215         }
9216 }
9217 #[no_mangle]
9218 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
9219 /// but with all dynamically-allocated buffers duplicated in new buffers.
9220 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
9221 #[repr(C)]
9222 /// The contents of CResult_CVec_UtxoZNoneZ
9223 pub union CResult_CVec_UtxoZNoneZPtr {
9224         /// A pointer to the contents in the success state.
9225         /// Reading from this pointer when `result_ok` is not set is undefined.
9226         pub result: *mut crate::c_types::derived::CVec_UtxoZ,
9227         /// Note that this value is always NULL, as there are no contents in the Err variant
9228         pub err: *mut core::ffi::c_void,
9229 }
9230 #[repr(C)]
9231 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
9232 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
9233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9234 pub struct CResult_CVec_UtxoZNoneZ {
9235         /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
9236         /// `err` or `result` depending on the state of `result_ok`.
9237         pub contents: CResult_CVec_UtxoZNoneZPtr,
9238         /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
9239         pub result_ok: bool,
9240 }
9241 #[no_mangle]
9242 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
9243 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
9244         CResult_CVec_UtxoZNoneZ {
9245                 contents: CResult_CVec_UtxoZNoneZPtr {
9246                         result: Box::into_raw(Box::new(o)),
9247                 },
9248                 result_ok: true,
9249         }
9250 }
9251 #[no_mangle]
9252 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
9253 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
9254         CResult_CVec_UtxoZNoneZ {
9255                 contents: CResult_CVec_UtxoZNoneZPtr {
9256                         err: core::ptr::null_mut(),
9257                 },
9258                 result_ok: false,
9259         }
9260 }
9261 /// Checks if the given object is currently in the success state
9262 #[no_mangle]
9263 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
9264         o.result_ok
9265 }
9266 #[no_mangle]
9267 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
9268 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
9269 impl Drop for CResult_CVec_UtxoZNoneZ {
9270         fn drop(&mut self) {
9271                 if self.result_ok {
9272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9274                         }
9275                 } else {
9276                 }
9277         }
9278 }
9279 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
9280         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
9281                 let contents = if o.result_ok {
9282                         let result = unsafe { o.contents.result };
9283                         unsafe { o.contents.result = core::ptr::null_mut() };
9284                         CResult_CVec_UtxoZNoneZPtr { result }
9285                 } else {
9286                         let _ = unsafe { Box::from_raw(o.contents.err) };
9287                         o.contents.err = core::ptr::null_mut();
9288                         CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
9289                 };
9290                 Self {
9291                         contents,
9292                         result_ok: o.result_ok,
9293                 }
9294         }
9295 }
9296 impl Clone for CResult_CVec_UtxoZNoneZ {
9297         fn clone(&self) -> Self {
9298                 if self.result_ok {
9299                         Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
9300                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
9301                         } }
9302                 } else {
9303                         Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
9304                                 err: core::ptr::null_mut()
9305                         } }
9306                 }
9307         }
9308 }
9309 #[no_mangle]
9310 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
9311 /// but with all dynamically-allocated buffers duplicated in new buffers.
9312 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
9313 #[repr(C)]
9314 #[derive(Clone)]
9315 /// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not
9316 pub enum COption_PaymentContextZ {
9317         /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext
9318         Some(crate::lightning::blinded_path::payment::PaymentContext),
9319         /// When we're in this state, this COption_PaymentContextZ contains nothing
9320         None
9321 }
9322 impl COption_PaymentContextZ {
9323         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9324                 if let Self::None = self { false } else { true }
9325         }
9326         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9327                 !self.is_some()
9328         }
9329         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::payment::PaymentContext {
9330                 if let Self::Some(v) = self { v } else { unreachable!() }
9331         }
9332 }
9333 #[no_mangle]
9334 /// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext
9335 pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ {
9336         COption_PaymentContextZ::Some(o)
9337 }
9338 #[no_mangle]
9339 /// Constructs a new COption_PaymentContextZ containing nothing
9340 pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ {
9341         COption_PaymentContextZ::None
9342 }
9343 #[no_mangle]
9344 /// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state
9345 pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { }
9346 #[no_mangle]
9347 /// Creates a new COption_PaymentContextZ which has the same data as `orig`
9348 /// but with all dynamically-allocated buffers duplicated in new buffers.
9349 pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) }
9350 #[repr(C)]
9351 /// A tuple of 2 elements. See the individual fields for the types contained.
9352 pub struct C2Tuple_u64u16Z {
9353         /// The element at position 0
9354         pub a: u64,
9355         /// The element at position 1
9356         pub b: u16,
9357 }
9358 impl From<(u64, u16)> for C2Tuple_u64u16Z {
9359         fn from (tup: (u64, u16)) -> Self {
9360                 Self {
9361                         a: tup.0,
9362                         b: tup.1,
9363                 }
9364         }
9365 }
9366 impl C2Tuple_u64u16Z {
9367         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
9368                 (self.a, self.b)
9369         }
9370 }
9371 impl Clone for C2Tuple_u64u16Z {
9372         fn clone(&self) -> Self {
9373                 Self {
9374                         a: Clone::clone(&self.a),
9375                         b: Clone::clone(&self.b),
9376                 }
9377         }
9378 }
9379 #[no_mangle]
9380 /// Creates a new tuple which has the same data as `orig`
9381 /// but with all dynamically-allocated buffers duplicated in new buffers.
9382 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
9383 /// Creates a new C2Tuple_u64u16Z from the contained elements.
9384 #[no_mangle]
9385 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
9386         C2Tuple_u64u16Z { a, b, }
9387 }
9388
9389 #[no_mangle]
9390 /// Frees any resources used by the C2Tuple_u64u16Z.
9391 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
9392 #[repr(C)]
9393 #[derive(Clone)]
9394 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
9395 pub enum COption_C2Tuple_u64u16ZZ {
9396         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
9397         Some(crate::c_types::derived::C2Tuple_u64u16Z),
9398         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
9399         None
9400 }
9401 impl COption_C2Tuple_u64u16ZZ {
9402         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9403                 if let Self::None = self { false } else { true }
9404         }
9405         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9406                 !self.is_some()
9407         }
9408         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
9409                 if let Self::Some(v) = self { v } else { unreachable!() }
9410         }
9411 }
9412 #[no_mangle]
9413 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
9414 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
9415         COption_C2Tuple_u64u16ZZ::Some(o)
9416 }
9417 #[no_mangle]
9418 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
9419 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
9420         COption_C2Tuple_u64u16ZZ::None
9421 }
9422 #[no_mangle]
9423 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
9424 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
9425 #[no_mangle]
9426 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
9427 /// but with all dynamically-allocated buffers duplicated in new buffers.
9428 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
9429 #[repr(C)]
9430 #[derive(Clone)]
9431 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
9432 pub enum COption_ChannelShutdownStateZ {
9433         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
9434         Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
9435         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
9436         None
9437 }
9438 impl COption_ChannelShutdownStateZ {
9439         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9440                 if let Self::None = self { false } else { true }
9441         }
9442         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9443                 !self.is_some()
9444         }
9445         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
9446                 if let Self::Some(v) = self { v } else { unreachable!() }
9447         }
9448 }
9449 #[no_mangle]
9450 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
9451 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
9452         COption_ChannelShutdownStateZ::Some(o)
9453 }
9454 #[no_mangle]
9455 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
9456 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
9457         COption_ChannelShutdownStateZ::None
9458 }
9459 #[no_mangle]
9460 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
9461 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
9462 #[no_mangle]
9463 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
9464 /// but with all dynamically-allocated buffers duplicated in new buffers.
9465 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
9466 #[repr(C)]
9467 /// The contents of CResult_ChannelIdAPIErrorZ
9468 pub union CResult_ChannelIdAPIErrorZPtr {
9469         /// A pointer to the contents in the success state.
9470         /// Reading from this pointer when `result_ok` is not set is undefined.
9471         pub result: *mut crate::lightning::ln::types::ChannelId,
9472         /// A pointer to the contents in the error state.
9473         /// Reading from this pointer when `result_ok` is set is undefined.
9474         pub err: *mut crate::lightning::util::errors::APIError,
9475 }
9476 #[repr(C)]
9477 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9478 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9480 pub struct CResult_ChannelIdAPIErrorZ {
9481         /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9482         /// `err` or `result` depending on the state of `result_ok`.
9483         pub contents: CResult_ChannelIdAPIErrorZPtr,
9484         /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9485         pub result_ok: bool,
9486 }
9487 #[no_mangle]
9488 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9489 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9490         CResult_ChannelIdAPIErrorZ {
9491                 contents: CResult_ChannelIdAPIErrorZPtr {
9492                         result: Box::into_raw(Box::new(o)),
9493                 },
9494                 result_ok: true,
9495         }
9496 }
9497 #[no_mangle]
9498 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9499 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9500         CResult_ChannelIdAPIErrorZ {
9501                 contents: CResult_ChannelIdAPIErrorZPtr {
9502                         err: Box::into_raw(Box::new(e)),
9503                 },
9504                 result_ok: false,
9505         }
9506 }
9507 /// Checks if the given object is currently in the success state
9508 #[no_mangle]
9509 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9510         o.result_ok
9511 }
9512 #[no_mangle]
9513 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9514 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9515 impl Drop for CResult_ChannelIdAPIErrorZ {
9516         fn drop(&mut self) {
9517                 if self.result_ok {
9518                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9519                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9520                         }
9521                 } else {
9522                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9523                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9524                         }
9525                 }
9526         }
9527 }
9528 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9529         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9530                 let contents = if o.result_ok {
9531                         let result = unsafe { o.contents.result };
9532                         unsafe { o.contents.result = core::ptr::null_mut() };
9533                         CResult_ChannelIdAPIErrorZPtr { result }
9534                 } else {
9535                         let err = unsafe { o.contents.err };
9536                         unsafe { o.contents.err = core::ptr::null_mut(); }
9537                         CResult_ChannelIdAPIErrorZPtr { err }
9538                 };
9539                 Self {
9540                         contents,
9541                         result_ok: o.result_ok,
9542                 }
9543         }
9544 }
9545 impl Clone for CResult_ChannelIdAPIErrorZ {
9546         fn clone(&self) -> Self {
9547                 if self.result_ok {
9548                         Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9549                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9550                         } }
9551                 } else {
9552                         Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9553                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9554                         } }
9555                 }
9556         }
9557 }
9558 #[no_mangle]
9559 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9560 /// but with all dynamically-allocated buffers duplicated in new buffers.
9561 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9562 #[repr(C)]
9563 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9564 /// This corresponds to std::vector in C++
9565 pub struct CVec_RecentPaymentDetailsZ {
9566         /// The elements in the array.
9567         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9568         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9569         /// The number of elements pointed to by `data`.
9570         pub datalen: usize
9571 }
9572 impl CVec_RecentPaymentDetailsZ {
9573         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9574                 if self.datalen == 0 { return Vec::new(); }
9575                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9576                 self.data = core::ptr::null_mut();
9577                 self.datalen = 0;
9578                 ret
9579         }
9580         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9581                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9582         }
9583 }
9584 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9585         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9586                 let datalen = v.len();
9587                 let data = Box::into_raw(v.into_boxed_slice());
9588                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9589         }
9590 }
9591 #[no_mangle]
9592 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9593 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9594 impl Drop for CVec_RecentPaymentDetailsZ {
9595         fn drop(&mut self) {
9596                 if self.datalen == 0 { return; }
9597                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9598         }
9599 }
9600 #[repr(C)]
9601 /// The contents of CResult_NonePaymentSendFailureZ
9602 pub union CResult_NonePaymentSendFailureZPtr {
9603         /// Note that this value is always NULL, as there are no contents in the OK variant
9604         pub result: *mut core::ffi::c_void,
9605         /// A pointer to the contents in the error state.
9606         /// Reading from this pointer when `result_ok` is set is undefined.
9607         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9608 }
9609 #[repr(C)]
9610 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9611 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9613 pub struct CResult_NonePaymentSendFailureZ {
9614         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9615         /// `err` or `result` depending on the state of `result_ok`.
9616         pub contents: CResult_NonePaymentSendFailureZPtr,
9617         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9618         pub result_ok: bool,
9619 }
9620 #[no_mangle]
9621 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9622 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9623         CResult_NonePaymentSendFailureZ {
9624                 contents: CResult_NonePaymentSendFailureZPtr {
9625                         result: core::ptr::null_mut(),
9626                 },
9627                 result_ok: true,
9628         }
9629 }
9630 #[no_mangle]
9631 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9632 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9633         CResult_NonePaymentSendFailureZ {
9634                 contents: CResult_NonePaymentSendFailureZPtr {
9635                         err: Box::into_raw(Box::new(e)),
9636                 },
9637                 result_ok: false,
9638         }
9639 }
9640 /// Checks if the given object is currently in the success state
9641 #[no_mangle]
9642 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9643         o.result_ok
9644 }
9645 #[no_mangle]
9646 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9647 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9648 impl Drop for CResult_NonePaymentSendFailureZ {
9649         fn drop(&mut self) {
9650                 if self.result_ok {
9651                 } else {
9652                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9653                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9654                         }
9655                 }
9656         }
9657 }
9658 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9659         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9660                 let contents = if o.result_ok {
9661                         let _ = unsafe { Box::from_raw(o.contents.result) };
9662                         o.contents.result = core::ptr::null_mut();
9663                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9664                 } else {
9665                         let err = unsafe { o.contents.err };
9666                         unsafe { o.contents.err = core::ptr::null_mut(); }
9667                         CResult_NonePaymentSendFailureZPtr { err }
9668                 };
9669                 Self {
9670                         contents,
9671                         result_ok: o.result_ok,
9672                 }
9673         }
9674 }
9675 impl Clone for CResult_NonePaymentSendFailureZ {
9676         fn clone(&self) -> Self {
9677                 if self.result_ok {
9678                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9679                                 result: core::ptr::null_mut()
9680                         } }
9681                 } else {
9682                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9683                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9684                         } }
9685                 }
9686         }
9687 }
9688 #[no_mangle]
9689 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9690 /// but with all dynamically-allocated buffers duplicated in new buffers.
9691 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9692 #[repr(C)]
9693 /// The contents of CResult_NoneRetryableSendFailureZ
9694 pub union CResult_NoneRetryableSendFailureZPtr {
9695         /// Note that this value is always NULL, as there are no contents in the OK variant
9696         pub result: *mut core::ffi::c_void,
9697         /// A pointer to the contents in the error state.
9698         /// Reading from this pointer when `result_ok` is set is undefined.
9699         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9700 }
9701 #[repr(C)]
9702 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9703 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9705 pub struct CResult_NoneRetryableSendFailureZ {
9706         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9707         /// `err` or `result` depending on the state of `result_ok`.
9708         pub contents: CResult_NoneRetryableSendFailureZPtr,
9709         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9710         pub result_ok: bool,
9711 }
9712 #[no_mangle]
9713 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9714 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9715         CResult_NoneRetryableSendFailureZ {
9716                 contents: CResult_NoneRetryableSendFailureZPtr {
9717                         result: core::ptr::null_mut(),
9718                 },
9719                 result_ok: true,
9720         }
9721 }
9722 #[no_mangle]
9723 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9724 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9725         CResult_NoneRetryableSendFailureZ {
9726                 contents: CResult_NoneRetryableSendFailureZPtr {
9727                         err: Box::into_raw(Box::new(e)),
9728                 },
9729                 result_ok: false,
9730         }
9731 }
9732 /// Checks if the given object is currently in the success state
9733 #[no_mangle]
9734 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9735         o.result_ok
9736 }
9737 #[no_mangle]
9738 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9739 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9740 impl Drop for CResult_NoneRetryableSendFailureZ {
9741         fn drop(&mut self) {
9742                 if self.result_ok {
9743                 } else {
9744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9746                         }
9747                 }
9748         }
9749 }
9750 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9751         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9752                 let contents = if o.result_ok {
9753                         let _ = unsafe { Box::from_raw(o.contents.result) };
9754                         o.contents.result = core::ptr::null_mut();
9755                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9756                 } else {
9757                         let err = unsafe { o.contents.err };
9758                         unsafe { o.contents.err = core::ptr::null_mut(); }
9759                         CResult_NoneRetryableSendFailureZPtr { err }
9760                 };
9761                 Self {
9762                         contents,
9763                         result_ok: o.result_ok,
9764                 }
9765         }
9766 }
9767 impl Clone for CResult_NoneRetryableSendFailureZ {
9768         fn clone(&self) -> Self {
9769                 if self.result_ok {
9770                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9771                                 result: core::ptr::null_mut()
9772                         } }
9773                 } else {
9774                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9776                         } }
9777                 }
9778         }
9779 }
9780 #[no_mangle]
9781 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9784 #[repr(C)]
9785 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
9786 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9787         /// A pointer to the contents in the success state.
9788         /// Reading from this pointer when `result_ok` is not set is undefined.
9789         pub result: *mut crate::c_types::ThirtyTwoBytes,
9790         /// A pointer to the contents in the error state.
9791         /// Reading from this pointer when `result_ok` is set is undefined.
9792         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9793 }
9794 #[repr(C)]
9795 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
9796 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
9799         /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
9800         /// `err` or `result` depending on the state of `result_ok`.
9801         pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
9802         /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
9803         pub result_ok: bool,
9804 }
9805 #[no_mangle]
9806 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
9807 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
9808         CResult_ThirtyTwoBytesPaymentSendFailureZ {
9809                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9810                         result: Box::into_raw(Box::new(o)),
9811                 },
9812                 result_ok: true,
9813         }
9814 }
9815 #[no_mangle]
9816 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
9817 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
9818         CResult_ThirtyTwoBytesPaymentSendFailureZ {
9819                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9820                         err: Box::into_raw(Box::new(e)),
9821                 },
9822                 result_ok: false,
9823         }
9824 }
9825 /// Checks if the given object is currently in the success state
9826 #[no_mangle]
9827 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
9828         o.result_ok
9829 }
9830 #[no_mangle]
9831 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
9832 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
9833 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9834         fn drop(&mut self) {
9835                 if self.result_ok {
9836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9838                         }
9839                 } else {
9840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9842                         }
9843                 }
9844         }
9845 }
9846 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9847         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9848                 let contents = if o.result_ok {
9849                         let result = unsafe { o.contents.result };
9850                         unsafe { o.contents.result = core::ptr::null_mut() };
9851                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
9852                 } else {
9853                         let err = unsafe { o.contents.err };
9854                         unsafe { o.contents.err = core::ptr::null_mut(); }
9855                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
9856                 };
9857                 Self {
9858                         contents,
9859                         result_ok: o.result_ok,
9860                 }
9861         }
9862 }
9863 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9864         fn clone(&self) -> Self {
9865                 if self.result_ok {
9866                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9867                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9868                         } }
9869                 } else {
9870                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9871                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9872                         } }
9873                 }
9874         }
9875 }
9876 #[no_mangle]
9877 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
9878 /// but with all dynamically-allocated buffers duplicated in new buffers.
9879 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
9880 #[repr(C)]
9881 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
9882 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9883         /// A pointer to the contents in the success state.
9884         /// Reading from this pointer when `result_ok` is not set is undefined.
9885         pub result: *mut crate::c_types::ThirtyTwoBytes,
9886         /// A pointer to the contents in the error state.
9887         /// Reading from this pointer when `result_ok` is set is undefined.
9888         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9889 }
9890 #[repr(C)]
9891 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
9892 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9894 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
9895         /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
9896         /// `err` or `result` depending on the state of `result_ok`.
9897         pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
9898         /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
9899         pub result_ok: bool,
9900 }
9901 #[no_mangle]
9902 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
9903 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9904         CResult_ThirtyTwoBytesRetryableSendFailureZ {
9905                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9906                         result: Box::into_raw(Box::new(o)),
9907                 },
9908                 result_ok: true,
9909         }
9910 }
9911 #[no_mangle]
9912 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
9913 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9914         CResult_ThirtyTwoBytesRetryableSendFailureZ {
9915                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9916                         err: Box::into_raw(Box::new(e)),
9917                 },
9918                 result_ok: false,
9919         }
9920 }
9921 /// Checks if the given object is currently in the success state
9922 #[no_mangle]
9923 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
9924         o.result_ok
9925 }
9926 #[no_mangle]
9927 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
9928 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
9929 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9930         fn drop(&mut self) {
9931                 if self.result_ok {
9932                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9933                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9934                         }
9935                 } else {
9936                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9937                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9938                         }
9939                 }
9940         }
9941 }
9942 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9943         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9944                 let contents = if o.result_ok {
9945                         let result = unsafe { o.contents.result };
9946                         unsafe { o.contents.result = core::ptr::null_mut() };
9947                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
9948                 } else {
9949                         let err = unsafe { o.contents.err };
9950                         unsafe { o.contents.err = core::ptr::null_mut(); }
9951                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
9952                 };
9953                 Self {
9954                         contents,
9955                         result_ok: o.result_ok,
9956                 }
9957         }
9958 }
9959 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9960         fn clone(&self) -> Self {
9961                 if self.result_ok {
9962                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9963                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9964                         } }
9965                 } else {
9966                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9967                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9968                         } }
9969                 }
9970         }
9971 }
9972 #[no_mangle]
9973 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
9974 /// but with all dynamically-allocated buffers duplicated in new buffers.
9975 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
9976 #[repr(C)]
9977 /// A tuple of 2 elements. See the individual fields for the types contained.
9978 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9979         /// The element at position 0
9980         pub a: crate::c_types::ThirtyTwoBytes,
9981         /// The element at position 1
9982         pub b: crate::c_types::ThirtyTwoBytes,
9983 }
9984 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9985         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9986                 Self {
9987                         a: tup.0,
9988                         b: tup.1,
9989                 }
9990         }
9991 }
9992 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9993         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9994                 (self.a, self.b)
9995         }
9996 }
9997 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9998         fn clone(&self) -> Self {
9999                 Self {
10000                         a: Clone::clone(&self.a),
10001                         b: Clone::clone(&self.b),
10002                 }
10003         }
10004 }
10005 #[no_mangle]
10006 /// Creates a new tuple which has the same data as `orig`
10007 /// but with all dynamically-allocated buffers duplicated in new buffers.
10008 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10009 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10010 #[no_mangle]
10011 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10012         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10013 }
10014
10015 #[no_mangle]
10016 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10017 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10018 #[repr(C)]
10019 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10020 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10021         /// A pointer to the contents in the success state.
10022         /// Reading from this pointer when `result_ok` is not set is undefined.
10023         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10024         /// A pointer to the contents in the error state.
10025         /// Reading from this pointer when `result_ok` is set is undefined.
10026         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10027 }
10028 #[repr(C)]
10029 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10030 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10032 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10033         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10034         /// `err` or `result` depending on the state of `result_ok`.
10035         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10036         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10037         pub result_ok: bool,
10038 }
10039 #[no_mangle]
10040 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10041 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10042         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10043                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10044                         result: Box::into_raw(Box::new(o)),
10045                 },
10046                 result_ok: true,
10047         }
10048 }
10049 #[no_mangle]
10050 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10051 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10052         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10053                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10054                         err: Box::into_raw(Box::new(e)),
10055                 },
10056                 result_ok: false,
10057         }
10058 }
10059 /// Checks if the given object is currently in the success state
10060 #[no_mangle]
10061 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10062         o.result_ok
10063 }
10064 #[no_mangle]
10065 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10066 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10067 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10068         fn drop(&mut self) {
10069                 if self.result_ok {
10070                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10071                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10072                         }
10073                 } else {
10074                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10075                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10076                         }
10077                 }
10078         }
10079 }
10080 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10081         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10082                 let contents = if o.result_ok {
10083                         let result = unsafe { o.contents.result };
10084                         unsafe { o.contents.result = core::ptr::null_mut() };
10085                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10086                 } else {
10087                         let err = unsafe { o.contents.err };
10088                         unsafe { o.contents.err = core::ptr::null_mut(); }
10089                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10090                 };
10091                 Self {
10092                         contents,
10093                         result_ok: o.result_ok,
10094                 }
10095         }
10096 }
10097 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10098         fn clone(&self) -> Self {
10099                 if self.result_ok {
10100                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10101                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10102                         } }
10103                 } else {
10104                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10105                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10106                         } }
10107                 }
10108         }
10109 }
10110 #[no_mangle]
10111 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10112 /// but with all dynamically-allocated buffers duplicated in new buffers.
10113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10114 #[repr(C)]
10115 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10116 /// This corresponds to std::vector in C++
10117 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10118         /// The elements in the array.
10119         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10120         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10121         /// The number of elements pointed to by `data`.
10122         pub datalen: usize
10123 }
10124 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10125         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10126                 if self.datalen == 0 { return Vec::new(); }
10127                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10128                 self.data = core::ptr::null_mut();
10129                 self.datalen = 0;
10130                 ret
10131         }
10132         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10133                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10134         }
10135 }
10136 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10137         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10138                 let datalen = v.len();
10139                 let data = Box::into_raw(v.into_boxed_slice());
10140                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10141         }
10142 }
10143 #[no_mangle]
10144 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10145 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10146 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10147         fn drop(&mut self) {
10148                 if self.datalen == 0 { return; }
10149                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10150         }
10151 }
10152 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10153         fn clone(&self) -> Self {
10154                 let mut res = Vec::new();
10155                 if self.datalen == 0 { return Self::from(res); }
10156                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10157                 Self::from(res)
10158         }
10159 }
10160 #[repr(C)]
10161 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10162 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10163         /// A pointer to the contents in the success state.
10164         /// Reading from this pointer when `result_ok` is not set is undefined.
10165         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10166         /// A pointer to the contents in the error state.
10167         /// Reading from this pointer when `result_ok` is set is undefined.
10168         pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10169 }
10170 #[repr(C)]
10171 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10172 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10175         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10176         /// `err` or `result` depending on the state of `result_ok`.
10177         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10178         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10179         pub result_ok: bool,
10180 }
10181 #[no_mangle]
10182 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10183 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10184         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10185                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10186                         result: Box::into_raw(Box::new(o)),
10187                 },
10188                 result_ok: true,
10189         }
10190 }
10191 #[no_mangle]
10192 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10193 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10194         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10195                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10196                         err: Box::into_raw(Box::new(e)),
10197                 },
10198                 result_ok: false,
10199         }
10200 }
10201 /// Checks if the given object is currently in the success state
10202 #[no_mangle]
10203 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10204         o.result_ok
10205 }
10206 #[no_mangle]
10207 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10208 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10209 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10210         fn drop(&mut self) {
10211                 if self.result_ok {
10212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10214                         }
10215                 } else {
10216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10218                         }
10219                 }
10220         }
10221 }
10222 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10223         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10224                 let contents = if o.result_ok {
10225                         let result = unsafe { o.contents.result };
10226                         unsafe { o.contents.result = core::ptr::null_mut() };
10227                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10228                 } else {
10229                         let err = unsafe { o.contents.err };
10230                         unsafe { o.contents.err = core::ptr::null_mut(); }
10231                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10232                 };
10233                 Self {
10234                         contents,
10235                         result_ok: o.result_ok,
10236                 }
10237         }
10238 }
10239 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10240         fn clone(&self) -> Self {
10241                 if self.result_ok {
10242                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10243                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10244                         } }
10245                 } else {
10246                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10248                         } }
10249                 }
10250         }
10251 }
10252 #[no_mangle]
10253 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10256 #[repr(C)]
10257 /// A tuple of 2 elements. See the individual fields for the types contained.
10258 pub struct C2Tuple_ChannelIdPublicKeyZ {
10259         /// The element at position 0
10260         pub a: crate::lightning::ln::types::ChannelId,
10261         /// The element at position 1
10262         pub b: crate::c_types::PublicKey,
10263 }
10264 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10265         fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10266                 Self {
10267                         a: tup.0,
10268                         b: tup.1,
10269                 }
10270         }
10271 }
10272 impl C2Tuple_ChannelIdPublicKeyZ {
10273         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10274                 (self.a, self.b)
10275         }
10276 }
10277 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10278         fn clone(&self) -> Self {
10279                 Self {
10280                         a: Clone::clone(&self.a),
10281                         b: Clone::clone(&self.b),
10282                 }
10283         }
10284 }
10285 #[no_mangle]
10286 /// Creates a new tuple which has the same data as `orig`
10287 /// but with all dynamically-allocated buffers duplicated in new buffers.
10288 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10289 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10290 #[no_mangle]
10291 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10292         C2Tuple_ChannelIdPublicKeyZ { a, b, }
10293 }
10294
10295 #[no_mangle]
10296 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10297 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10298 #[repr(C)]
10299 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10300 /// This corresponds to std::vector in C++
10301 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10302         /// The elements in the array.
10303         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10304         pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10305         /// The number of elements pointed to by `data`.
10306         pub datalen: usize
10307 }
10308 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10309         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10310                 if self.datalen == 0 { return Vec::new(); }
10311                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10312                 self.data = core::ptr::null_mut();
10313                 self.datalen = 0;
10314                 ret
10315         }
10316         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10317                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10318         }
10319 }
10320 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10321         fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10322                 let datalen = v.len();
10323                 let data = Box::into_raw(v.into_boxed_slice());
10324                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10325         }
10326 }
10327 #[no_mangle]
10328 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10329 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10330 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10331         fn drop(&mut self) {
10332                 if self.datalen == 0 { return; }
10333                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10334         }
10335 }
10336 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10337         fn clone(&self) -> Self {
10338                 let mut res = Vec::new();
10339                 if self.datalen == 0 { return Self::from(res); }
10340                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10341                 Self::from(res)
10342         }
10343 }
10344 #[repr(C)]
10345 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10346 /// This corresponds to std::vector in C++
10347 pub struct CVec_ChannelIdZ {
10348         /// The elements in the array.
10349         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10350         pub data: *mut crate::lightning::ln::types::ChannelId,
10351         /// The number of elements pointed to by `data`.
10352         pub datalen: usize
10353 }
10354 impl CVec_ChannelIdZ {
10355         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10356                 if self.datalen == 0 { return Vec::new(); }
10357                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10358                 self.data = core::ptr::null_mut();
10359                 self.datalen = 0;
10360                 ret
10361         }
10362         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10363                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10364         }
10365 }
10366 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10367         fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10368                 let datalen = v.len();
10369                 let data = Box::into_raw(v.into_boxed_slice());
10370                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10371         }
10372 }
10373 #[no_mangle]
10374 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10375 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10376 impl Drop for CVec_ChannelIdZ {
10377         fn drop(&mut self) {
10378                 if self.datalen == 0 { return; }
10379                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10380         }
10381 }
10382 impl Clone for CVec_ChannelIdZ {
10383         fn clone(&self) -> Self {
10384                 let mut res = Vec::new();
10385                 if self.datalen == 0 { return Self::from(res); }
10386                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10387                 Self::from(res)
10388         }
10389 }
10390 #[repr(C)]
10391 #[derive(Clone)]
10392 /// An enum which can either contain a crate::c_types::Str or not
10393 pub enum COption_StrZ {
10394         /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10395         Some(crate::c_types::Str),
10396         /// When we're in this state, this COption_StrZ contains nothing
10397         None
10398 }
10399 impl COption_StrZ {
10400         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10401                 if let Self::None = self { false } else { true }
10402         }
10403         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10404                 !self.is_some()
10405         }
10406         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10407                 if let Self::Some(v) = self { v } else { unreachable!() }
10408         }
10409 }
10410 #[no_mangle]
10411 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10412 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10413         COption_StrZ::Some(o)
10414 }
10415 #[no_mangle]
10416 /// Constructs a new COption_StrZ containing nothing
10417 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10418         COption_StrZ::None
10419 }
10420 #[no_mangle]
10421 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10422 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10423 #[no_mangle]
10424 /// Creates a new COption_StrZ which has the same data as `orig`
10425 /// but with all dynamically-allocated buffers duplicated in new buffers.
10426 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10427 #[repr(C)]
10428 /// The contents of CResult_NoneBolt12SemanticErrorZ
10429 pub union CResult_NoneBolt12SemanticErrorZPtr {
10430         /// Note that this value is always NULL, as there are no contents in the OK variant
10431         pub result: *mut core::ffi::c_void,
10432         /// A pointer to the contents in the error state.
10433         /// Reading from this pointer when `result_ok` is set is undefined.
10434         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10435 }
10436 #[repr(C)]
10437 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
10438 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10440 pub struct CResult_NoneBolt12SemanticErrorZ {
10441         /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
10442         /// `err` or `result` depending on the state of `result_ok`.
10443         pub contents: CResult_NoneBolt12SemanticErrorZPtr,
10444         /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
10445         pub result_ok: bool,
10446 }
10447 #[no_mangle]
10448 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
10449 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
10450         CResult_NoneBolt12SemanticErrorZ {
10451                 contents: CResult_NoneBolt12SemanticErrorZPtr {
10452                         result: core::ptr::null_mut(),
10453                 },
10454                 result_ok: true,
10455         }
10456 }
10457 #[no_mangle]
10458 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
10459 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
10460         CResult_NoneBolt12SemanticErrorZ {
10461                 contents: CResult_NoneBolt12SemanticErrorZPtr {
10462                         err: Box::into_raw(Box::new(e)),
10463                 },
10464                 result_ok: false,
10465         }
10466 }
10467 /// Checks if the given object is currently in the success state
10468 #[no_mangle]
10469 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
10470         o.result_ok
10471 }
10472 #[no_mangle]
10473 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
10474 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
10475 impl Drop for CResult_NoneBolt12SemanticErrorZ {
10476         fn drop(&mut self) {
10477                 if self.result_ok {
10478                 } else {
10479                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10480                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10481                         }
10482                 }
10483         }
10484 }
10485 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
10486         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10487                 let contents = if o.result_ok {
10488                         let _ = unsafe { Box::from_raw(o.contents.result) };
10489                         o.contents.result = core::ptr::null_mut();
10490                         CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
10491                 } else {
10492                         let err = unsafe { o.contents.err };
10493                         unsafe { o.contents.err = core::ptr::null_mut(); }
10494                         CResult_NoneBolt12SemanticErrorZPtr { err }
10495                 };
10496                 Self {
10497                         contents,
10498                         result_ok: o.result_ok,
10499                 }
10500         }
10501 }
10502 impl Clone for CResult_NoneBolt12SemanticErrorZ {
10503         fn clone(&self) -> Self {
10504                 if self.result_ok {
10505                         Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
10506                                 result: core::ptr::null_mut()
10507                         } }
10508                 } else {
10509                         Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
10510                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10511                         } }
10512                 }
10513         }
10514 }
10515 #[no_mangle]
10516 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
10517 /// but with all dynamically-allocated buffers duplicated in new buffers.
10518 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
10519 #[repr(C)]
10520 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10521 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10522         /// A pointer to the contents in the success state.
10523         /// Reading from this pointer when `result_ok` is not set is undefined.
10524         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10525         /// Note that this value is always NULL, as there are no contents in the Err variant
10526         pub err: *mut core::ffi::c_void,
10527 }
10528 #[repr(C)]
10529 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10530 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10532 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10533         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10534         /// `err` or `result` depending on the state of `result_ok`.
10535         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10536         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10537         pub result_ok: bool,
10538 }
10539 #[no_mangle]
10540 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10541 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10542         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10543                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10544                         result: Box::into_raw(Box::new(o)),
10545                 },
10546                 result_ok: true,
10547         }
10548 }
10549 #[no_mangle]
10550 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10551 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10552         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10553                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10554                         err: core::ptr::null_mut(),
10555                 },
10556                 result_ok: false,
10557         }
10558 }
10559 /// Checks if the given object is currently in the success state
10560 #[no_mangle]
10561 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10562         o.result_ok
10563 }
10564 #[no_mangle]
10565 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10566 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10567 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10568         fn drop(&mut self) {
10569                 if self.result_ok {
10570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10572                         }
10573                 } else {
10574                 }
10575         }
10576 }
10577 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10578         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10579                 let contents = if o.result_ok {
10580                         let result = unsafe { o.contents.result };
10581                         unsafe { o.contents.result = core::ptr::null_mut() };
10582                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10583                 } else {
10584                         let _ = unsafe { Box::from_raw(o.contents.err) };
10585                         o.contents.err = core::ptr::null_mut();
10586                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10587                 };
10588                 Self {
10589                         contents,
10590                         result_ok: o.result_ok,
10591                 }
10592         }
10593 }
10594 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10595         fn clone(&self) -> Self {
10596                 if self.result_ok {
10597                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10598                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10599                         } }
10600                 } else {
10601                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10602                                 err: core::ptr::null_mut()
10603                         } }
10604                 }
10605         }
10606 }
10607 #[no_mangle]
10608 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10609 /// but with all dynamically-allocated buffers duplicated in new buffers.
10610 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10611 #[repr(C)]
10612 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10613 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10614         /// A pointer to the contents in the success state.
10615         /// Reading from this pointer when `result_ok` is not set is undefined.
10616         pub result: *mut crate::c_types::ThirtyTwoBytes,
10617         /// A pointer to the contents in the error state.
10618         /// Reading from this pointer when `result_ok` is set is undefined.
10619         pub err: *mut crate::lightning::util::errors::APIError,
10620 }
10621 #[repr(C)]
10622 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10623 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10625 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10626         /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10627         /// `err` or `result` depending on the state of `result_ok`.
10628         pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10629         /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10630         pub result_ok: bool,
10631 }
10632 #[no_mangle]
10633 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10634 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10635         CResult_ThirtyTwoBytesAPIErrorZ {
10636                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10637                         result: Box::into_raw(Box::new(o)),
10638                 },
10639                 result_ok: true,
10640         }
10641 }
10642 #[no_mangle]
10643 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10644 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10645         CResult_ThirtyTwoBytesAPIErrorZ {
10646                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10647                         err: Box::into_raw(Box::new(e)),
10648                 },
10649                 result_ok: false,
10650         }
10651 }
10652 /// Checks if the given object is currently in the success state
10653 #[no_mangle]
10654 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10655         o.result_ok
10656 }
10657 #[no_mangle]
10658 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10659 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10660 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10661         fn drop(&mut self) {
10662                 if self.result_ok {
10663                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10664                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10665                         }
10666                 } else {
10667                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10668                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10669                         }
10670                 }
10671         }
10672 }
10673 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10674         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10675                 let contents = if o.result_ok {
10676                         let result = unsafe { o.contents.result };
10677                         unsafe { o.contents.result = core::ptr::null_mut() };
10678                         CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10679                 } else {
10680                         let err = unsafe { o.contents.err };
10681                         unsafe { o.contents.err = core::ptr::null_mut(); }
10682                         CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10683                 };
10684                 Self {
10685                         contents,
10686                         result_ok: o.result_ok,
10687                 }
10688         }
10689 }
10690 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10691         fn clone(&self) -> Self {
10692                 if self.result_ok {
10693                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10694                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10695                         } }
10696                 } else {
10697                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10698                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10699                         } }
10700                 }
10701         }
10702 }
10703 #[no_mangle]
10704 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10705 /// but with all dynamically-allocated buffers duplicated in new buffers.
10706 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10707 #[repr(C)]
10708 #[derive(Clone)]
10709 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10710 pub enum COption_OffersMessageZ {
10711         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10712         Some(crate::lightning::onion_message::offers::OffersMessage),
10713         /// When we're in this state, this COption_OffersMessageZ contains nothing
10714         None
10715 }
10716 impl COption_OffersMessageZ {
10717         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10718                 if let Self::None = self { false } else { true }
10719         }
10720         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10721                 !self.is_some()
10722         }
10723         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10724                 if let Self::Some(v) = self { v } else { unreachable!() }
10725         }
10726 }
10727 #[no_mangle]
10728 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10729 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10730         COption_OffersMessageZ::Some(o)
10731 }
10732 #[no_mangle]
10733 /// Constructs a new COption_OffersMessageZ containing nothing
10734 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10735         COption_OffersMessageZ::None
10736 }
10737 #[no_mangle]
10738 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10739 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10740 #[no_mangle]
10741 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10742 /// but with all dynamically-allocated buffers duplicated in new buffers.
10743 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10744 #[repr(C)]
10745 /// A tuple of 3 elements. See the individual fields for the types contained.
10746 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10747         /// The element at position 0
10748         pub a: crate::lightning::onion_message::offers::OffersMessage,
10749         /// The element at position 1
10750         pub b: crate::lightning::onion_message::messenger::Destination,
10751         /// The element at position 2
10752         pub c: crate::lightning::blinded_path::BlindedPath,
10753 }
10754 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10755         fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
10756                 Self {
10757                         a: tup.0,
10758                         b: tup.1,
10759                         c: tup.2,
10760                 }
10761         }
10762 }
10763 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
10764         #[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) {
10765                 (self.a, self.b, self.c)
10766         }
10767 }
10768 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
10769         fn clone(&self) -> Self {
10770                 Self {
10771                         a: Clone::clone(&self.a),
10772                         b: Clone::clone(&self.b),
10773                         c: Clone::clone(&self.c),
10774                 }
10775         }
10776 }
10777 #[no_mangle]
10778 /// Creates a new tuple which has the same data as `orig`
10779 /// but with all dynamically-allocated buffers duplicated in new buffers.
10780 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
10781 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
10782 #[no_mangle]
10783 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 {
10784         C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
10785 }
10786
10787 #[no_mangle]
10788 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
10789 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
10790 #[repr(C)]
10791 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
10792 /// This corresponds to std::vector in C++
10793 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10794         /// The elements in the array.
10795         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10796         pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
10797         /// The number of elements pointed to by `data`.
10798         pub datalen: usize
10799 }
10800 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10801         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
10802                 if self.datalen == 0 { return Vec::new(); }
10803                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10804                 self.data = core::ptr::null_mut();
10805                 self.datalen = 0;
10806                 ret
10807         }
10808         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
10809                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10810         }
10811 }
10812 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10813         fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
10814                 let datalen = v.len();
10815                 let data = Box::into_raw(v.into_boxed_slice());
10816                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10817         }
10818 }
10819 #[no_mangle]
10820 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10821 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
10822 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10823         fn drop(&mut self) {
10824                 if self.datalen == 0 { return; }
10825                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10826         }
10827 }
10828 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10829         fn clone(&self) -> Self {
10830                 let mut res = Vec::new();
10831                 if self.datalen == 0 { return Self::from(res); }
10832                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10833                 Self::from(res)
10834         }
10835 }
10836 #[repr(C)]
10837 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
10838 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10839         /// A pointer to the contents in the success state.
10840         /// Reading from this pointer when `result_ok` is not set is undefined.
10841         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
10842         /// A pointer to the contents in the error state.
10843         /// Reading from this pointer when `result_ok` is set is undefined.
10844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10845 }
10846 #[repr(C)]
10847 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
10848 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10850 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
10851         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
10852         /// `err` or `result` depending on the state of `result_ok`.
10853         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
10854         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
10855         pub result_ok: bool,
10856 }
10857 #[no_mangle]
10858 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
10859 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
10860         CResult_CounterpartyForwardingInfoDecodeErrorZ {
10861                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10862                         result: Box::into_raw(Box::new(o)),
10863                 },
10864                 result_ok: true,
10865         }
10866 }
10867 #[no_mangle]
10868 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
10869 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
10870         CResult_CounterpartyForwardingInfoDecodeErrorZ {
10871                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10872                         err: Box::into_raw(Box::new(e)),
10873                 },
10874                 result_ok: false,
10875         }
10876 }
10877 /// Checks if the given object is currently in the success state
10878 #[no_mangle]
10879 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
10880         o.result_ok
10881 }
10882 #[no_mangle]
10883 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
10884 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
10885 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10886         fn drop(&mut self) {
10887                 if self.result_ok {
10888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10890                         }
10891                 } else {
10892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10894                         }
10895                 }
10896         }
10897 }
10898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10900                 let contents = if o.result_ok {
10901                         let result = unsafe { o.contents.result };
10902                         unsafe { o.contents.result = core::ptr::null_mut() };
10903                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10904                 } else {
10905                         let err = unsafe { o.contents.err };
10906                         unsafe { o.contents.err = core::ptr::null_mut(); }
10907                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10908                 };
10909                 Self {
10910                         contents,
10911                         result_ok: o.result_ok,
10912                 }
10913         }
10914 }
10915 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10916         fn clone(&self) -> Self {
10917                 if self.result_ok {
10918                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10920                         } }
10921                 } else {
10922                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10924                         } }
10925                 }
10926         }
10927 }
10928 #[no_mangle]
10929 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10930 /// but with all dynamically-allocated buffers duplicated in new buffers.
10931 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10932 #[repr(C)]
10933 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10934 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10935         /// A pointer to the contents in the success state.
10936         /// Reading from this pointer when `result_ok` is not set is undefined.
10937         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10938         /// A pointer to the contents in the error state.
10939         /// Reading from this pointer when `result_ok` is set is undefined.
10940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10941 }
10942 #[repr(C)]
10943 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10944 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10946 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10947         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10948         /// `err` or `result` depending on the state of `result_ok`.
10949         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10950         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10951         pub result_ok: bool,
10952 }
10953 #[no_mangle]
10954 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10955 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10956         CResult_ChannelCounterpartyDecodeErrorZ {
10957                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10958                         result: Box::into_raw(Box::new(o)),
10959                 },
10960                 result_ok: true,
10961         }
10962 }
10963 #[no_mangle]
10964 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10965 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10966         CResult_ChannelCounterpartyDecodeErrorZ {
10967                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10968                         err: Box::into_raw(Box::new(e)),
10969                 },
10970                 result_ok: false,
10971         }
10972 }
10973 /// Checks if the given object is currently in the success state
10974 #[no_mangle]
10975 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10976         o.result_ok
10977 }
10978 #[no_mangle]
10979 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10980 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10981 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10982         fn drop(&mut self) {
10983                 if self.result_ok {
10984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10986                         }
10987                 } else {
10988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10990                         }
10991                 }
10992         }
10993 }
10994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10996                 let contents = if o.result_ok {
10997                         let result = unsafe { o.contents.result };
10998                         unsafe { o.contents.result = core::ptr::null_mut() };
10999                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
11000                 } else {
11001                         let err = unsafe { o.contents.err };
11002                         unsafe { o.contents.err = core::ptr::null_mut(); }
11003                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
11004                 };
11005                 Self {
11006                         contents,
11007                         result_ok: o.result_ok,
11008                 }
11009         }
11010 }
11011 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
11012         fn clone(&self) -> Self {
11013                 if self.result_ok {
11014                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
11016                         } }
11017                 } else {
11018                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11020                         } }
11021                 }
11022         }
11023 }
11024 #[no_mangle]
11025 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
11026 /// but with all dynamically-allocated buffers duplicated in new buffers.
11027 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
11028 #[repr(C)]
11029 /// The contents of CResult_ChannelDetailsDecodeErrorZ
11030 pub union CResult_ChannelDetailsDecodeErrorZPtr {
11031         /// A pointer to the contents in the success state.
11032         /// Reading from this pointer when `result_ok` is not set is undefined.
11033         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
11034         /// A pointer to the contents in the error state.
11035         /// Reading from this pointer when `result_ok` is set is undefined.
11036         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11037 }
11038 #[repr(C)]
11039 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
11040 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
11041 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11042 pub struct CResult_ChannelDetailsDecodeErrorZ {
11043         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
11044         /// `err` or `result` depending on the state of `result_ok`.
11045         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
11046         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
11047         pub result_ok: bool,
11048 }
11049 #[no_mangle]
11050 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
11051 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
11052         CResult_ChannelDetailsDecodeErrorZ {
11053                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11054                         result: Box::into_raw(Box::new(o)),
11055                 },
11056                 result_ok: true,
11057         }
11058 }
11059 #[no_mangle]
11060 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
11061 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
11062         CResult_ChannelDetailsDecodeErrorZ {
11063                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11064                         err: Box::into_raw(Box::new(e)),
11065                 },
11066                 result_ok: false,
11067         }
11068 }
11069 /// Checks if the given object is currently in the success state
11070 #[no_mangle]
11071 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
11072         o.result_ok
11073 }
11074 #[no_mangle]
11075 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
11076 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
11077 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
11078         fn drop(&mut self) {
11079                 if self.result_ok {
11080                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11081                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11082                         }
11083                 } else {
11084                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11085                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11086                         }
11087                 }
11088         }
11089 }
11090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
11091         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
11092                 let contents = if o.result_ok {
11093                         let result = unsafe { o.contents.result };
11094                         unsafe { o.contents.result = core::ptr::null_mut() };
11095                         CResult_ChannelDetailsDecodeErrorZPtr { result }
11096                 } else {
11097                         let err = unsafe { o.contents.err };
11098                         unsafe { o.contents.err = core::ptr::null_mut(); }
11099                         CResult_ChannelDetailsDecodeErrorZPtr { err }
11100                 };
11101                 Self {
11102                         contents,
11103                         result_ok: o.result_ok,
11104                 }
11105         }
11106 }
11107 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
11108         fn clone(&self) -> Self {
11109                 if self.result_ok {
11110                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11111                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
11112                         } }
11113                 } else {
11114                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11115                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11116                         } }
11117                 }
11118         }
11119 }
11120 #[no_mangle]
11121 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
11122 /// but with all dynamically-allocated buffers duplicated in new buffers.
11123 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
11124 #[repr(C)]
11125 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11126 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11127         /// A pointer to the contents in the success state.
11128         /// Reading from this pointer when `result_ok` is not set is undefined.
11129         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11130         /// A pointer to the contents in the error state.
11131         /// Reading from this pointer when `result_ok` is set is undefined.
11132         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11133 }
11134 #[repr(C)]
11135 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11136 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11138 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11139         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11140         /// `err` or `result` depending on the state of `result_ok`.
11141         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11142         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11143         pub result_ok: bool,
11144 }
11145 #[no_mangle]
11146 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11147 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11148         CResult_PhantomRouteHintsDecodeErrorZ {
11149                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11150                         result: Box::into_raw(Box::new(o)),
11151                 },
11152                 result_ok: true,
11153         }
11154 }
11155 #[no_mangle]
11156 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11157 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11158         CResult_PhantomRouteHintsDecodeErrorZ {
11159                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11160                         err: Box::into_raw(Box::new(e)),
11161                 },
11162                 result_ok: false,
11163         }
11164 }
11165 /// Checks if the given object is currently in the success state
11166 #[no_mangle]
11167 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11168         o.result_ok
11169 }
11170 #[no_mangle]
11171 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11172 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11173 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11174         fn drop(&mut self) {
11175                 if self.result_ok {
11176                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11177                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11178                         }
11179                 } else {
11180                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11181                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11182                         }
11183                 }
11184         }
11185 }
11186 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11187         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11188                 let contents = if o.result_ok {
11189                         let result = unsafe { o.contents.result };
11190                         unsafe { o.contents.result = core::ptr::null_mut() };
11191                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11192                 } else {
11193                         let err = unsafe { o.contents.err };
11194                         unsafe { o.contents.err = core::ptr::null_mut(); }
11195                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11196                 };
11197                 Self {
11198                         contents,
11199                         result_ok: o.result_ok,
11200                 }
11201         }
11202 }
11203 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11204         fn clone(&self) -> Self {
11205                 if self.result_ok {
11206                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11207                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11208                         } }
11209                 } else {
11210                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11211                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11212                         } }
11213                 }
11214         }
11215 }
11216 #[no_mangle]
11217 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11218 /// but with all dynamically-allocated buffers duplicated in new buffers.
11219 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11220 #[repr(C)]
11221 /// The contents of CResult_BlindedForwardDecodeErrorZ
11222 pub union CResult_BlindedForwardDecodeErrorZPtr {
11223         /// A pointer to the contents in the success state.
11224         /// Reading from this pointer when `result_ok` is not set is undefined.
11225         pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11226         /// A pointer to the contents in the error state.
11227         /// Reading from this pointer when `result_ok` is set is undefined.
11228         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11229 }
11230 #[repr(C)]
11231 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11232 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11234 pub struct CResult_BlindedForwardDecodeErrorZ {
11235         /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11236         /// `err` or `result` depending on the state of `result_ok`.
11237         pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11238         /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11239         pub result_ok: bool,
11240 }
11241 #[no_mangle]
11242 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11243 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11244         CResult_BlindedForwardDecodeErrorZ {
11245                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11246                         result: Box::into_raw(Box::new(o)),
11247                 },
11248                 result_ok: true,
11249         }
11250 }
11251 #[no_mangle]
11252 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11253 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11254         CResult_BlindedForwardDecodeErrorZ {
11255                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11256                         err: Box::into_raw(Box::new(e)),
11257                 },
11258                 result_ok: false,
11259         }
11260 }
11261 /// Checks if the given object is currently in the success state
11262 #[no_mangle]
11263 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11264         o.result_ok
11265 }
11266 #[no_mangle]
11267 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11268 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11269 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11270         fn drop(&mut self) {
11271                 if self.result_ok {
11272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11274                         }
11275                 } else {
11276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11278                         }
11279                 }
11280         }
11281 }
11282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11283         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11284                 let contents = if o.result_ok {
11285                         let result = unsafe { o.contents.result };
11286                         unsafe { o.contents.result = core::ptr::null_mut() };
11287                         CResult_BlindedForwardDecodeErrorZPtr { result }
11288                 } else {
11289                         let err = unsafe { o.contents.err };
11290                         unsafe { o.contents.err = core::ptr::null_mut(); }
11291                         CResult_BlindedForwardDecodeErrorZPtr { err }
11292                 };
11293                 Self {
11294                         contents,
11295                         result_ok: o.result_ok,
11296                 }
11297         }
11298 }
11299 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11300         fn clone(&self) -> Self {
11301                 if self.result_ok {
11302                         Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11303                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11304                         } }
11305                 } else {
11306                         Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11307                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11308                         } }
11309                 }
11310         }
11311 }
11312 #[no_mangle]
11313 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11314 /// but with all dynamically-allocated buffers duplicated in new buffers.
11315 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11316 #[repr(C)]
11317 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11318 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11319         /// A pointer to the contents in the success state.
11320         /// Reading from this pointer when `result_ok` is not set is undefined.
11321         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11322         /// A pointer to the contents in the error state.
11323         /// Reading from this pointer when `result_ok` is set is undefined.
11324         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11325 }
11326 #[repr(C)]
11327 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11328 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11330 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11331         /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11332         /// `err` or `result` depending on the state of `result_ok`.
11333         pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11334         /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11335         pub result_ok: bool,
11336 }
11337 #[no_mangle]
11338 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11339 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11340         CResult_PendingHTLCRoutingDecodeErrorZ {
11341                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11342                         result: Box::into_raw(Box::new(o)),
11343                 },
11344                 result_ok: true,
11345         }
11346 }
11347 #[no_mangle]
11348 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11349 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11350         CResult_PendingHTLCRoutingDecodeErrorZ {
11351                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11352                         err: Box::into_raw(Box::new(e)),
11353                 },
11354                 result_ok: false,
11355         }
11356 }
11357 /// Checks if the given object is currently in the success state
11358 #[no_mangle]
11359 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11360         o.result_ok
11361 }
11362 #[no_mangle]
11363 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11364 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11365 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11366         fn drop(&mut self) {
11367                 if self.result_ok {
11368                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11369                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11370                         }
11371                 } else {
11372                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11373                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11374                         }
11375                 }
11376         }
11377 }
11378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11379         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11380                 let contents = if o.result_ok {
11381                         let result = unsafe { o.contents.result };
11382                         unsafe { o.contents.result = core::ptr::null_mut() };
11383                         CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11384                 } else {
11385                         let err = unsafe { o.contents.err };
11386                         unsafe { o.contents.err = core::ptr::null_mut(); }
11387                         CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11388                 };
11389                 Self {
11390                         contents,
11391                         result_ok: o.result_ok,
11392                 }
11393         }
11394 }
11395 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11396         fn clone(&self) -> Self {
11397                 if self.result_ok {
11398                         Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11399                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11400                         } }
11401                 } else {
11402                         Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11403                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11404                         } }
11405                 }
11406         }
11407 }
11408 #[no_mangle]
11409 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11410 /// but with all dynamically-allocated buffers duplicated in new buffers.
11411 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11412 #[repr(C)]
11413 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11414 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11415         /// A pointer to the contents in the success state.
11416         /// Reading from this pointer when `result_ok` is not set is undefined.
11417         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11418         /// A pointer to the contents in the error state.
11419         /// Reading from this pointer when `result_ok` is set is undefined.
11420         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11421 }
11422 #[repr(C)]
11423 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11424 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11426 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11427         /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11428         /// `err` or `result` depending on the state of `result_ok`.
11429         pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11430         /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11431         pub result_ok: bool,
11432 }
11433 #[no_mangle]
11434 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11435 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11436         CResult_PendingHTLCInfoDecodeErrorZ {
11437                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11438                         result: Box::into_raw(Box::new(o)),
11439                 },
11440                 result_ok: true,
11441         }
11442 }
11443 #[no_mangle]
11444 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11445 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11446         CResult_PendingHTLCInfoDecodeErrorZ {
11447                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11448                         err: Box::into_raw(Box::new(e)),
11449                 },
11450                 result_ok: false,
11451         }
11452 }
11453 /// Checks if the given object is currently in the success state
11454 #[no_mangle]
11455 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11456         o.result_ok
11457 }
11458 #[no_mangle]
11459 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11460 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11461 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11462         fn drop(&mut self) {
11463                 if self.result_ok {
11464                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11465                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11466                         }
11467                 } else {
11468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11470                         }
11471                 }
11472         }
11473 }
11474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11475         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11476                 let contents = if o.result_ok {
11477                         let result = unsafe { o.contents.result };
11478                         unsafe { o.contents.result = core::ptr::null_mut() };
11479                         CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11480                 } else {
11481                         let err = unsafe { o.contents.err };
11482                         unsafe { o.contents.err = core::ptr::null_mut(); }
11483                         CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11484                 };
11485                 Self {
11486                         contents,
11487                         result_ok: o.result_ok,
11488                 }
11489         }
11490 }
11491 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11492         fn clone(&self) -> Self {
11493                 if self.result_ok {
11494                         Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11495                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11496                         } }
11497                 } else {
11498                         Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11499                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11500                         } }
11501                 }
11502         }
11503 }
11504 #[no_mangle]
11505 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11506 /// but with all dynamically-allocated buffers duplicated in new buffers.
11507 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11508 #[repr(C)]
11509 /// The contents of CResult_BlindedFailureDecodeErrorZ
11510 pub union CResult_BlindedFailureDecodeErrorZPtr {
11511         /// A pointer to the contents in the success state.
11512         /// Reading from this pointer when `result_ok` is not set is undefined.
11513         pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11514         /// A pointer to the contents in the error state.
11515         /// Reading from this pointer when `result_ok` is set is undefined.
11516         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11517 }
11518 #[repr(C)]
11519 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11520 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11522 pub struct CResult_BlindedFailureDecodeErrorZ {
11523         /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11524         /// `err` or `result` depending on the state of `result_ok`.
11525         pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11526         /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11527         pub result_ok: bool,
11528 }
11529 #[no_mangle]
11530 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11531 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11532         CResult_BlindedFailureDecodeErrorZ {
11533                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11534                         result: Box::into_raw(Box::new(o)),
11535                 },
11536                 result_ok: true,
11537         }
11538 }
11539 #[no_mangle]
11540 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11541 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11542         CResult_BlindedFailureDecodeErrorZ {
11543                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11544                         err: Box::into_raw(Box::new(e)),
11545                 },
11546                 result_ok: false,
11547         }
11548 }
11549 /// Checks if the given object is currently in the success state
11550 #[no_mangle]
11551 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11552         o.result_ok
11553 }
11554 #[no_mangle]
11555 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11556 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11557 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11558         fn drop(&mut self) {
11559                 if self.result_ok {
11560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11562                         }
11563                 } else {
11564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11566                         }
11567                 }
11568         }
11569 }
11570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11572                 let contents = if o.result_ok {
11573                         let result = unsafe { o.contents.result };
11574                         unsafe { o.contents.result = core::ptr::null_mut() };
11575                         CResult_BlindedFailureDecodeErrorZPtr { result }
11576                 } else {
11577                         let err = unsafe { o.contents.err };
11578                         unsafe { o.contents.err = core::ptr::null_mut(); }
11579                         CResult_BlindedFailureDecodeErrorZPtr { err }
11580                 };
11581                 Self {
11582                         contents,
11583                         result_ok: o.result_ok,
11584                 }
11585         }
11586 }
11587 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11588         fn clone(&self) -> Self {
11589                 if self.result_ok {
11590                         Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11592                         } }
11593                 } else {
11594                         Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11595                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11596                         } }
11597                 }
11598         }
11599 }
11600 #[no_mangle]
11601 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11604 #[repr(C)]
11605 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
11606 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
11607         /// A pointer to the contents in the success state.
11608         /// Reading from this pointer when `result_ok` is not set is undefined.
11609         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
11610         /// A pointer to the contents in the error state.
11611         /// Reading from this pointer when `result_ok` is set is undefined.
11612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11613 }
11614 #[repr(C)]
11615 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
11619         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
11620         /// `err` or `result` depending on the state of `result_ok`.
11621         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
11622         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
11623         pub result_ok: bool,
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
11628         CResult_ChannelShutdownStateDecodeErrorZ {
11629                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11630                         result: Box::into_raw(Box::new(o)),
11631                 },
11632                 result_ok: true,
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
11638         CResult_ChannelShutdownStateDecodeErrorZ {
11639                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11640                         err: Box::into_raw(Box::new(e)),
11641                 },
11642                 result_ok: false,
11643         }
11644 }
11645 /// Checks if the given object is currently in the success state
11646 #[no_mangle]
11647 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
11648         o.result_ok
11649 }
11650 #[no_mangle]
11651 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
11652 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
11653 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
11654         fn drop(&mut self) {
11655                 if self.result_ok {
11656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11658                         }
11659                 } else {
11660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11662                         }
11663                 }
11664         }
11665 }
11666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
11667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668                 let contents = if o.result_ok {
11669                         let result = unsafe { o.contents.result };
11670                         unsafe { o.contents.result = core::ptr::null_mut() };
11671                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
11672                 } else {
11673                         let err = unsafe { o.contents.err };
11674                         unsafe { o.contents.err = core::ptr::null_mut(); }
11675                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
11676                 };
11677                 Self {
11678                         contents,
11679                         result_ok: o.result_ok,
11680                 }
11681         }
11682 }
11683 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
11684         fn clone(&self) -> Self {
11685                 if self.result_ok {
11686                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
11688                         } }
11689                 } else {
11690                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11692                         } }
11693                 }
11694         }
11695 }
11696 #[no_mangle]
11697 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
11698 /// but with all dynamically-allocated buffers duplicated in new buffers.
11699 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
11700 #[repr(C)]
11701 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11702 /// This corresponds to std::vector in C++
11703 pub struct CVec_ChannelMonitorZ {
11704         /// The elements in the array.
11705         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11706         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11707         /// The number of elements pointed to by `data`.
11708         pub datalen: usize
11709 }
11710 impl CVec_ChannelMonitorZ {
11711         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11712                 if self.datalen == 0 { return Vec::new(); }
11713                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11714                 self.data = core::ptr::null_mut();
11715                 self.datalen = 0;
11716                 ret
11717         }
11718         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11719                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11720         }
11721 }
11722 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11723         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11724                 let datalen = v.len();
11725                 let data = Box::into_raw(v.into_boxed_slice());
11726                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11727         }
11728 }
11729 #[no_mangle]
11730 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11731 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11732 impl Drop for CVec_ChannelMonitorZ {
11733         fn drop(&mut self) {
11734                 if self.datalen == 0 { return; }
11735                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11736         }
11737 }
11738 impl Clone for CVec_ChannelMonitorZ {
11739         fn clone(&self) -> Self {
11740                 let mut res = Vec::new();
11741                 if self.datalen == 0 { return Self::from(res); }
11742                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11743                 Self::from(res)
11744         }
11745 }
11746 #[repr(C)]
11747 /// A tuple of 2 elements. See the individual fields for the types contained.
11748 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11749         /// The element at position 0
11750         pub a: crate::c_types::ThirtyTwoBytes,
11751         /// The element at position 1
11752         pub b: crate::lightning::ln::channelmanager::ChannelManager,
11753 }
11754 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11755         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
11756                 Self {
11757                         a: tup.0,
11758                         b: tup.1,
11759                 }
11760         }
11761 }
11762 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
11763         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
11764                 (self.a, self.b)
11765         }
11766 }
11767 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
11768 #[no_mangle]
11769 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
11770         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
11771 }
11772
11773 #[no_mangle]
11774 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
11775 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
11776 #[repr(C)]
11777 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
11778 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11779         /// A pointer to the contents in the success state.
11780         /// Reading from this pointer when `result_ok` is not set is undefined.
11781         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
11782         /// A pointer to the contents in the error state.
11783         /// Reading from this pointer when `result_ok` is set is undefined.
11784         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11785 }
11786 #[repr(C)]
11787 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
11788 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11789 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11790 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11791         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
11792         /// `err` or `result` depending on the state of `result_ok`.
11793         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
11794         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
11795         pub result_ok: bool,
11796 }
11797 #[no_mangle]
11798 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
11799 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11800         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11801                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11802                         result: Box::into_raw(Box::new(o)),
11803                 },
11804                 result_ok: true,
11805         }
11806 }
11807 #[no_mangle]
11808 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
11809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11810         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11811                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11812                         err: Box::into_raw(Box::new(e)),
11813                 },
11814                 result_ok: false,
11815         }
11816 }
11817 /// Checks if the given object is currently in the success state
11818 #[no_mangle]
11819 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
11820         o.result_ok
11821 }
11822 #[no_mangle]
11823 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
11824 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
11825 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11826         fn drop(&mut self) {
11827                 if self.result_ok {
11828                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11829                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11830                         }
11831                 } else {
11832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11834                         }
11835                 }
11836         }
11837 }
11838 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11839         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11840                 let contents = if o.result_ok {
11841                         let result = unsafe { o.contents.result };
11842                         unsafe { o.contents.result = core::ptr::null_mut() };
11843                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
11844                 } else {
11845                         let err = unsafe { o.contents.err };
11846                         unsafe { o.contents.err = core::ptr::null_mut(); }
11847                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
11848                 };
11849                 Self {
11850                         contents,
11851                         result_ok: o.result_ok,
11852                 }
11853         }
11854 }
11855 #[repr(C)]
11856 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
11857 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11858         /// A pointer to the contents in the success state.
11859         /// Reading from this pointer when `result_ok` is not set is undefined.
11860         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
11861         /// A pointer to the contents in the error state.
11862         /// Reading from this pointer when `result_ok` is set is undefined.
11863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11864 }
11865 #[repr(C)]
11866 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
11867 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11869 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
11870         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
11871         /// `err` or `result` depending on the state of `result_ok`.
11872         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
11873         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
11874         pub result_ok: bool,
11875 }
11876 #[no_mangle]
11877 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
11878 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11879         CResult_MaxDustHTLCExposureDecodeErrorZ {
11880                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11881                         result: Box::into_raw(Box::new(o)),
11882                 },
11883                 result_ok: true,
11884         }
11885 }
11886 #[no_mangle]
11887 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
11888 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11889         CResult_MaxDustHTLCExposureDecodeErrorZ {
11890                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11891                         err: Box::into_raw(Box::new(e)),
11892                 },
11893                 result_ok: false,
11894         }
11895 }
11896 /// Checks if the given object is currently in the success state
11897 #[no_mangle]
11898 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
11899         o.result_ok
11900 }
11901 #[no_mangle]
11902 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
11903 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
11904 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
11905         fn drop(&mut self) {
11906                 if self.result_ok {
11907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11909                         }
11910                 } else {
11911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11913                         }
11914                 }
11915         }
11916 }
11917 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
11918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11919                 let contents = if o.result_ok {
11920                         let result = unsafe { o.contents.result };
11921                         unsafe { o.contents.result = core::ptr::null_mut() };
11922                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
11923                 } else {
11924                         let err = unsafe { o.contents.err };
11925                         unsafe { o.contents.err = core::ptr::null_mut(); }
11926                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
11927                 };
11928                 Self {
11929                         contents,
11930                         result_ok: o.result_ok,
11931                 }
11932         }
11933 }
11934 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
11935         fn clone(&self) -> Self {
11936                 if self.result_ok {
11937                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11938                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
11939                         } }
11940                 } else {
11941                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11943                         } }
11944                 }
11945         }
11946 }
11947 #[no_mangle]
11948 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
11949 /// but with all dynamically-allocated buffers duplicated in new buffers.
11950 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
11951 #[repr(C)]
11952 /// The contents of CResult_ChannelConfigDecodeErrorZ
11953 pub union CResult_ChannelConfigDecodeErrorZPtr {
11954         /// A pointer to the contents in the success state.
11955         /// Reading from this pointer when `result_ok` is not set is undefined.
11956         pub result: *mut crate::lightning::util::config::ChannelConfig,
11957         /// A pointer to the contents in the error state.
11958         /// Reading from this pointer when `result_ok` is set is undefined.
11959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11960 }
11961 #[repr(C)]
11962 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
11963 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
11964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11965 pub struct CResult_ChannelConfigDecodeErrorZ {
11966         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
11967         /// `err` or `result` depending on the state of `result_ok`.
11968         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
11969         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
11970         pub result_ok: bool,
11971 }
11972 #[no_mangle]
11973 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11974 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
11975         CResult_ChannelConfigDecodeErrorZ {
11976                 contents: CResult_ChannelConfigDecodeErrorZPtr {
11977                         result: Box::into_raw(Box::new(o)),
11978                 },
11979                 result_ok: true,
11980         }
11981 }
11982 #[no_mangle]
11983 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11984 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
11985         CResult_ChannelConfigDecodeErrorZ {
11986                 contents: CResult_ChannelConfigDecodeErrorZPtr {
11987                         err: Box::into_raw(Box::new(e)),
11988                 },
11989                 result_ok: false,
11990         }
11991 }
11992 /// Checks if the given object is currently in the success state
11993 #[no_mangle]
11994 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
11995         o.result_ok
11996 }
11997 #[no_mangle]
11998 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11999 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
12000 impl Drop for CResult_ChannelConfigDecodeErrorZ {
12001         fn drop(&mut self) {
12002                 if self.result_ok {
12003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12005                         }
12006                 } else {
12007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12009                         }
12010                 }
12011         }
12012 }
12013 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
12014         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
12015                 let contents = if o.result_ok {
12016                         let result = unsafe { o.contents.result };
12017                         unsafe { o.contents.result = core::ptr::null_mut() };
12018                         CResult_ChannelConfigDecodeErrorZPtr { result }
12019                 } else {
12020                         let err = unsafe { o.contents.err };
12021                         unsafe { o.contents.err = core::ptr::null_mut(); }
12022                         CResult_ChannelConfigDecodeErrorZPtr { err }
12023                 };
12024                 Self {
12025                         contents,
12026                         result_ok: o.result_ok,
12027                 }
12028         }
12029 }
12030 impl Clone for CResult_ChannelConfigDecodeErrorZ {
12031         fn clone(&self) -> Self {
12032                 if self.result_ok {
12033                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
12034                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
12035                         } }
12036                 } else {
12037                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
12038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12039                         } }
12040                 }
12041         }
12042 }
12043 #[no_mangle]
12044 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12045 /// but with all dynamically-allocated buffers duplicated in new buffers.
12046 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
12047 #[repr(C)]
12048 #[derive(Clone)]
12049 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
12050 pub enum COption_MaxDustHTLCExposureZ {
12051         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
12052         Some(crate::lightning::util::config::MaxDustHTLCExposure),
12053         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
12054         None
12055 }
12056 impl COption_MaxDustHTLCExposureZ {
12057         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12058                 if let Self::None = self { false } else { true }
12059         }
12060         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12061                 !self.is_some()
12062         }
12063         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
12064                 if let Self::Some(v) = self { v } else { unreachable!() }
12065         }
12066 }
12067 #[no_mangle]
12068 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
12069 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
12070         COption_MaxDustHTLCExposureZ::Some(o)
12071 }
12072 #[no_mangle]
12073 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
12074 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
12075         COption_MaxDustHTLCExposureZ::None
12076 }
12077 #[no_mangle]
12078 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
12079 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
12080 #[no_mangle]
12081 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
12082 /// but with all dynamically-allocated buffers duplicated in new buffers.
12083 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
12084 #[repr(C)]
12085 #[derive(Clone)]
12086 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
12087 pub enum COption_APIErrorZ {
12088         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
12089         Some(crate::lightning::util::errors::APIError),
12090         /// When we're in this state, this COption_APIErrorZ contains nothing
12091         None
12092 }
12093 impl COption_APIErrorZ {
12094         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12095                 if let Self::None = self { false } else { true }
12096         }
12097         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12098                 !self.is_some()
12099         }
12100         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
12101                 if let Self::Some(v) = self { v } else { unreachable!() }
12102         }
12103 }
12104 #[no_mangle]
12105 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
12106 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
12107         COption_APIErrorZ::Some(o)
12108 }
12109 #[no_mangle]
12110 /// Constructs a new COption_APIErrorZ containing nothing
12111 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
12112         COption_APIErrorZ::None
12113 }
12114 #[no_mangle]
12115 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
12116 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
12117 #[no_mangle]
12118 /// Creates a new COption_APIErrorZ which has the same data as `orig`
12119 /// but with all dynamically-allocated buffers duplicated in new buffers.
12120 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
12121 #[repr(C)]
12122 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
12123 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
12124         /// A pointer to the contents in the success state.
12125         /// Reading from this pointer when `result_ok` is not set is undefined.
12126         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
12127         /// A pointer to the contents in the error state.
12128         /// Reading from this pointer when `result_ok` is set is undefined.
12129         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12130 }
12131 #[repr(C)]
12132 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
12133 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12135 pub struct CResult_COption_APIErrorZDecodeErrorZ {
12136         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
12137         /// `err` or `result` depending on the state of `result_ok`.
12138         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
12139         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
12140         pub result_ok: bool,
12141 }
12142 #[no_mangle]
12143 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
12144 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
12145         CResult_COption_APIErrorZDecodeErrorZ {
12146                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12147                         result: Box::into_raw(Box::new(o)),
12148                 },
12149                 result_ok: true,
12150         }
12151 }
12152 #[no_mangle]
12153 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
12154 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
12155         CResult_COption_APIErrorZDecodeErrorZ {
12156                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12157                         err: Box::into_raw(Box::new(e)),
12158                 },
12159                 result_ok: false,
12160         }
12161 }
12162 /// Checks if the given object is currently in the success state
12163 #[no_mangle]
12164 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
12165         o.result_ok
12166 }
12167 #[no_mangle]
12168 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
12169 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
12170 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
12171         fn drop(&mut self) {
12172                 if self.result_ok {
12173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12175                         }
12176                 } else {
12177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12179                         }
12180                 }
12181         }
12182 }
12183 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12184         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12185                 let contents = if o.result_ok {
12186                         let result = unsafe { o.contents.result };
12187                         unsafe { o.contents.result = core::ptr::null_mut() };
12188                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
12189                 } else {
12190                         let err = unsafe { o.contents.err };
12191                         unsafe { o.contents.err = core::ptr::null_mut(); }
12192                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
12193                 };
12194                 Self {
12195                         contents,
12196                         result_ok: o.result_ok,
12197                 }
12198         }
12199 }
12200 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12201         fn clone(&self) -> Self {
12202                 if self.result_ok {
12203                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12204                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12205                         } }
12206                 } else {
12207                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12208                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12209                         } }
12210                 }
12211         }
12212 }
12213 #[no_mangle]
12214 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12215 /// but with all dynamically-allocated buffers duplicated in new buffers.
12216 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12217 #[repr(C)]
12218 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12219 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12220         /// A pointer to the contents in the success state.
12221         /// Reading from this pointer when `result_ok` is not set is undefined.
12222         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12223         /// A pointer to the contents in the error state.
12224         /// Reading from this pointer when `result_ok` is set is undefined.
12225         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12226 }
12227 #[repr(C)]
12228 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12229 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12231 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12232         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12233         /// `err` or `result` depending on the state of `result_ok`.
12234         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12235         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12236         pub result_ok: bool,
12237 }
12238 #[no_mangle]
12239 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12240 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12241         CResult_ChannelMonitorUpdateDecodeErrorZ {
12242                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12243                         result: Box::into_raw(Box::new(o)),
12244                 },
12245                 result_ok: true,
12246         }
12247 }
12248 #[no_mangle]
12249 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12250 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12251         CResult_ChannelMonitorUpdateDecodeErrorZ {
12252                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12253                         err: Box::into_raw(Box::new(e)),
12254                 },
12255                 result_ok: false,
12256         }
12257 }
12258 /// Checks if the given object is currently in the success state
12259 #[no_mangle]
12260 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12261         o.result_ok
12262 }
12263 #[no_mangle]
12264 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12265 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12266 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12267         fn drop(&mut self) {
12268                 if self.result_ok {
12269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12271                         }
12272                 } else {
12273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12275                         }
12276                 }
12277         }
12278 }
12279 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12281                 let contents = if o.result_ok {
12282                         let result = unsafe { o.contents.result };
12283                         unsafe { o.contents.result = core::ptr::null_mut() };
12284                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12285                 } else {
12286                         let err = unsafe { o.contents.err };
12287                         unsafe { o.contents.err = core::ptr::null_mut(); }
12288                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12289                 };
12290                 Self {
12291                         contents,
12292                         result_ok: o.result_ok,
12293                 }
12294         }
12295 }
12296 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12297         fn clone(&self) -> Self {
12298                 if self.result_ok {
12299                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12300                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12301                         } }
12302                 } else {
12303                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12305                         } }
12306                 }
12307         }
12308 }
12309 #[no_mangle]
12310 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12311 /// but with all dynamically-allocated buffers duplicated in new buffers.
12312 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12313 #[repr(C)]
12314 #[derive(Clone)]
12315 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12316 pub enum COption_MonitorEventZ {
12317         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12318         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12319         /// When we're in this state, this COption_MonitorEventZ contains nothing
12320         None
12321 }
12322 impl COption_MonitorEventZ {
12323         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12324                 if let Self::None = self { false } else { true }
12325         }
12326         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12327                 !self.is_some()
12328         }
12329         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12330                 if let Self::Some(v) = self { v } else { unreachable!() }
12331         }
12332 }
12333 #[no_mangle]
12334 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12335 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12336         COption_MonitorEventZ::Some(o)
12337 }
12338 #[no_mangle]
12339 /// Constructs a new COption_MonitorEventZ containing nothing
12340 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12341         COption_MonitorEventZ::None
12342 }
12343 #[no_mangle]
12344 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12345 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12346 #[no_mangle]
12347 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12348 /// but with all dynamically-allocated buffers duplicated in new buffers.
12349 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12350 #[repr(C)]
12351 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12352 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12353         /// A pointer to the contents in the success state.
12354         /// Reading from this pointer when `result_ok` is not set is undefined.
12355         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12356         /// A pointer to the contents in the error state.
12357         /// Reading from this pointer when `result_ok` is set is undefined.
12358         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12359 }
12360 #[repr(C)]
12361 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12362 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12364 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12365         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12366         /// `err` or `result` depending on the state of `result_ok`.
12367         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12368         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12369         pub result_ok: bool,
12370 }
12371 #[no_mangle]
12372 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12373 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12374         CResult_COption_MonitorEventZDecodeErrorZ {
12375                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12376                         result: Box::into_raw(Box::new(o)),
12377                 },
12378                 result_ok: true,
12379         }
12380 }
12381 #[no_mangle]
12382 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12383 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12384         CResult_COption_MonitorEventZDecodeErrorZ {
12385                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12386                         err: Box::into_raw(Box::new(e)),
12387                 },
12388                 result_ok: false,
12389         }
12390 }
12391 /// Checks if the given object is currently in the success state
12392 #[no_mangle]
12393 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12394         o.result_ok
12395 }
12396 #[no_mangle]
12397 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12398 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12399 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12400         fn drop(&mut self) {
12401                 if self.result_ok {
12402                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12403                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12404                         }
12405                 } else {
12406                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12407                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12408                         }
12409                 }
12410         }
12411 }
12412 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12413         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12414                 let contents = if o.result_ok {
12415                         let result = unsafe { o.contents.result };
12416                         unsafe { o.contents.result = core::ptr::null_mut() };
12417                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12418                 } else {
12419                         let err = unsafe { o.contents.err };
12420                         unsafe { o.contents.err = core::ptr::null_mut(); }
12421                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12422                 };
12423                 Self {
12424                         contents,
12425                         result_ok: o.result_ok,
12426                 }
12427         }
12428 }
12429 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12430         fn clone(&self) -> Self {
12431                 if self.result_ok {
12432                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12433                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12434                         } }
12435                 } else {
12436                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12437                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12438                         } }
12439                 }
12440         }
12441 }
12442 #[no_mangle]
12443 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12444 /// but with all dynamically-allocated buffers duplicated in new buffers.
12445 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12446 #[repr(C)]
12447 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12448 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12449         /// A pointer to the contents in the success state.
12450         /// Reading from this pointer when `result_ok` is not set is undefined.
12451         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12452         /// A pointer to the contents in the error state.
12453         /// Reading from this pointer when `result_ok` is set is undefined.
12454         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12455 }
12456 #[repr(C)]
12457 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12458 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12460 pub struct CResult_HTLCUpdateDecodeErrorZ {
12461         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12462         /// `err` or `result` depending on the state of `result_ok`.
12463         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12464         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12465         pub result_ok: bool,
12466 }
12467 #[no_mangle]
12468 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12469 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12470         CResult_HTLCUpdateDecodeErrorZ {
12471                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12472                         result: Box::into_raw(Box::new(o)),
12473                 },
12474                 result_ok: true,
12475         }
12476 }
12477 #[no_mangle]
12478 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12479 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12480         CResult_HTLCUpdateDecodeErrorZ {
12481                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12482                         err: Box::into_raw(Box::new(e)),
12483                 },
12484                 result_ok: false,
12485         }
12486 }
12487 /// Checks if the given object is currently in the success state
12488 #[no_mangle]
12489 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12490         o.result_ok
12491 }
12492 #[no_mangle]
12493 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12494 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12495 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12496         fn drop(&mut self) {
12497                 if self.result_ok {
12498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12500                         }
12501                 } else {
12502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12504                         }
12505                 }
12506         }
12507 }
12508 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12509         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12510                 let contents = if o.result_ok {
12511                         let result = unsafe { o.contents.result };
12512                         unsafe { o.contents.result = core::ptr::null_mut() };
12513                         CResult_HTLCUpdateDecodeErrorZPtr { result }
12514                 } else {
12515                         let err = unsafe { o.contents.err };
12516                         unsafe { o.contents.err = core::ptr::null_mut(); }
12517                         CResult_HTLCUpdateDecodeErrorZPtr { err }
12518                 };
12519                 Self {
12520                         contents,
12521                         result_ok: o.result_ok,
12522                 }
12523         }
12524 }
12525 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12526         fn clone(&self) -> Self {
12527                 if self.result_ok {
12528                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12529                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12530                         } }
12531                 } else {
12532                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12533                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12534                         } }
12535                 }
12536         }
12537 }
12538 #[no_mangle]
12539 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12540 /// but with all dynamically-allocated buffers duplicated in new buffers.
12541 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12542 #[repr(C)]
12543 /// A tuple of 2 elements. See the individual fields for the types contained.
12544 pub struct C2Tuple_OutPointCVec_u8ZZ {
12545         /// The element at position 0
12546         pub a: crate::lightning::chain::transaction::OutPoint,
12547         /// The element at position 1
12548         pub b: crate::c_types::derived::CVec_u8Z,
12549 }
12550 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12551         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12552                 Self {
12553                         a: tup.0,
12554                         b: tup.1,
12555                 }
12556         }
12557 }
12558 impl C2Tuple_OutPointCVec_u8ZZ {
12559         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12560                 (self.a, self.b)
12561         }
12562 }
12563 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12564         fn clone(&self) -> Self {
12565                 Self {
12566                         a: Clone::clone(&self.a),
12567                         b: Clone::clone(&self.b),
12568                 }
12569         }
12570 }
12571 #[no_mangle]
12572 /// Creates a new tuple which has the same data as `orig`
12573 /// but with all dynamically-allocated buffers duplicated in new buffers.
12574 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12575 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12576 #[no_mangle]
12577 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12578         C2Tuple_OutPointCVec_u8ZZ { a, b, }
12579 }
12580
12581 #[no_mangle]
12582 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12583 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12584 #[repr(C)]
12585 /// A tuple of 2 elements. See the individual fields for the types contained.
12586 pub struct C2Tuple_u32CVec_u8ZZ {
12587         /// The element at position 0
12588         pub a: u32,
12589         /// The element at position 1
12590         pub b: crate::c_types::derived::CVec_u8Z,
12591 }
12592 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12593         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12594                 Self {
12595                         a: tup.0,
12596                         b: tup.1,
12597                 }
12598         }
12599 }
12600 impl C2Tuple_u32CVec_u8ZZ {
12601         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12602                 (self.a, self.b)
12603         }
12604 }
12605 impl Clone for C2Tuple_u32CVec_u8ZZ {
12606         fn clone(&self) -> Self {
12607                 Self {
12608                         a: Clone::clone(&self.a),
12609                         b: Clone::clone(&self.b),
12610                 }
12611         }
12612 }
12613 #[no_mangle]
12614 /// Creates a new tuple which has the same data as `orig`
12615 /// but with all dynamically-allocated buffers duplicated in new buffers.
12616 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12617 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12618 #[no_mangle]
12619 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12620         C2Tuple_u32CVec_u8ZZ { a, b, }
12621 }
12622
12623 #[no_mangle]
12624 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12625 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12626 #[repr(C)]
12627 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12628 /// This corresponds to std::vector in C++
12629 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12630         /// The elements in the array.
12631         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12632         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12633         /// The number of elements pointed to by `data`.
12634         pub datalen: usize
12635 }
12636 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12637         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12638                 if self.datalen == 0 { return Vec::new(); }
12639                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12640                 self.data = core::ptr::null_mut();
12641                 self.datalen = 0;
12642                 ret
12643         }
12644         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12645                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12646         }
12647 }
12648 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12649         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12650                 let datalen = v.len();
12651                 let data = Box::into_raw(v.into_boxed_slice());
12652                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12653         }
12654 }
12655 #[no_mangle]
12656 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12657 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12658 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12659         fn drop(&mut self) {
12660                 if self.datalen == 0 { return; }
12661                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12662         }
12663 }
12664 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12665         fn clone(&self) -> Self {
12666                 let mut res = Vec::new();
12667                 if self.datalen == 0 { return Self::from(res); }
12668                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12669                 Self::from(res)
12670         }
12671 }
12672 #[repr(C)]
12673 /// A tuple of 2 elements. See the individual fields for the types contained.
12674 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12675         /// The element at position 0
12676         pub a: crate::c_types::ThirtyTwoBytes,
12677         /// The element at position 1
12678         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12679 }
12680 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12681         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12682                 Self {
12683                         a: tup.0,
12684                         b: tup.1,
12685                 }
12686         }
12687 }
12688 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12689         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12690                 (self.a, self.b)
12691         }
12692 }
12693 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12694         fn clone(&self) -> Self {
12695                 Self {
12696                         a: Clone::clone(&self.a),
12697                         b: Clone::clone(&self.b),
12698                 }
12699         }
12700 }
12701 #[no_mangle]
12702 /// Creates a new tuple which has the same data as `orig`
12703 /// but with all dynamically-allocated buffers duplicated in new buffers.
12704 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12705 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12706 #[no_mangle]
12707 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 {
12708         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12709 }
12710
12711 #[no_mangle]
12712 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12713 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12714 #[repr(C)]
12715 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12716 /// This corresponds to std::vector in C++
12717 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12718         /// The elements in the array.
12719         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12720         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12721         /// The number of elements pointed to by `data`.
12722         pub datalen: usize
12723 }
12724 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12725         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12726                 if self.datalen == 0 { return Vec::new(); }
12727                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12728                 self.data = core::ptr::null_mut();
12729                 self.datalen = 0;
12730                 ret
12731         }
12732         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12733                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12734         }
12735 }
12736 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12737         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12738                 let datalen = v.len();
12739                 let data = Box::into_raw(v.into_boxed_slice());
12740                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12741         }
12742 }
12743 #[no_mangle]
12744 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12745 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12746 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12747         fn drop(&mut self) {
12748                 if self.datalen == 0 { return; }
12749                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12750         }
12751 }
12752 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12753         fn clone(&self) -> Self {
12754                 let mut res = Vec::new();
12755                 if self.datalen == 0 { return Self::from(res); }
12756                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12757                 Self::from(res)
12758         }
12759 }
12760 #[repr(C)]
12761 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
12762 /// This corresponds to std::vector in C++
12763 pub struct CVec_CommitmentTransactionZ {
12764         /// The elements in the array.
12765         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12766         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
12767         /// The number of elements pointed to by `data`.
12768         pub datalen: usize
12769 }
12770 impl CVec_CommitmentTransactionZ {
12771         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
12772                 if self.datalen == 0 { return Vec::new(); }
12773                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12774                 self.data = core::ptr::null_mut();
12775                 self.datalen = 0;
12776                 ret
12777         }
12778         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
12779                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12780         }
12781 }
12782 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
12783         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
12784                 let datalen = v.len();
12785                 let data = Box::into_raw(v.into_boxed_slice());
12786                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12787         }
12788 }
12789 #[no_mangle]
12790 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12791 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
12792 impl Drop for CVec_CommitmentTransactionZ {
12793         fn drop(&mut self) {
12794                 if self.datalen == 0 { return; }
12795                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12796         }
12797 }
12798 impl Clone for CVec_CommitmentTransactionZ {
12799         fn clone(&self) -> Self {
12800                 let mut res = Vec::new();
12801                 if self.datalen == 0 { return Self::from(res); }
12802                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12803                 Self::from(res)
12804         }
12805 }
12806 #[repr(C)]
12807 /// A tuple of 2 elements. See the individual fields for the types contained.
12808 pub struct C2Tuple_u32TxOutZ {
12809         /// The element at position 0
12810         pub a: u32,
12811         /// The element at position 1
12812         pub b: crate::c_types::TxOut,
12813 }
12814 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
12815         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
12816                 Self {
12817                         a: tup.0,
12818                         b: tup.1,
12819                 }
12820         }
12821 }
12822 impl C2Tuple_u32TxOutZ {
12823         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
12824                 (self.a, self.b)
12825         }
12826 }
12827 impl Clone for C2Tuple_u32TxOutZ {
12828         fn clone(&self) -> Self {
12829                 Self {
12830                         a: Clone::clone(&self.a),
12831                         b: Clone::clone(&self.b),
12832                 }
12833         }
12834 }
12835 #[no_mangle]
12836 /// Creates a new tuple which has the same data as `orig`
12837 /// but with all dynamically-allocated buffers duplicated in new buffers.
12838 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
12839 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
12840 #[no_mangle]
12841 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
12842         C2Tuple_u32TxOutZ { a, b, }
12843 }
12844
12845 #[no_mangle]
12846 /// Frees any resources used by the C2Tuple_u32TxOutZ.
12847 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
12848 #[repr(C)]
12849 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
12850 /// This corresponds to std::vector in C++
12851 pub struct CVec_C2Tuple_u32TxOutZZ {
12852         /// The elements in the array.
12853         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12854         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
12855         /// The number of elements pointed to by `data`.
12856         pub datalen: usize
12857 }
12858 impl CVec_C2Tuple_u32TxOutZZ {
12859         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
12860                 if self.datalen == 0 { return Vec::new(); }
12861                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12862                 self.data = core::ptr::null_mut();
12863                 self.datalen = 0;
12864                 ret
12865         }
12866         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
12867                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12868         }
12869 }
12870 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
12871         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
12872                 let datalen = v.len();
12873                 let data = Box::into_raw(v.into_boxed_slice());
12874                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12875         }
12876 }
12877 #[no_mangle]
12878 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12879 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
12880 impl Drop for CVec_C2Tuple_u32TxOutZZ {
12881         fn drop(&mut self) {
12882                 if self.datalen == 0 { return; }
12883                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12884         }
12885 }
12886 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12887         fn clone(&self) -> Self {
12888                 let mut res = Vec::new();
12889                 if self.datalen == 0 { return Self::from(res); }
12890                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12891                 Self::from(res)
12892         }
12893 }
12894 #[repr(C)]
12895 /// A tuple of 2 elements. See the individual fields for the types contained.
12896 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12897         /// The element at position 0
12898         pub a: crate::c_types::ThirtyTwoBytes,
12899         /// The element at position 1
12900         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12901 }
12902 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12903         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12904                 Self {
12905                         a: tup.0,
12906                         b: tup.1,
12907                 }
12908         }
12909 }
12910 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12911         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12912                 (self.a, self.b)
12913         }
12914 }
12915 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12916         fn clone(&self) -> Self {
12917                 Self {
12918                         a: Clone::clone(&self.a),
12919                         b: Clone::clone(&self.b),
12920                 }
12921         }
12922 }
12923 #[no_mangle]
12924 /// Creates a new tuple which has the same data as `orig`
12925 /// but with all dynamically-allocated buffers duplicated in new buffers.
12926 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12927 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12928 #[no_mangle]
12929 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 {
12930         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
12931 }
12932
12933 #[no_mangle]
12934 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
12935 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
12936 #[repr(C)]
12937 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12938 /// This corresponds to std::vector in C++
12939 pub struct CVec_TransactionOutputsZ {
12940         /// The elements in the array.
12941         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12942         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
12943         /// The number of elements pointed to by `data`.
12944         pub datalen: usize
12945 }
12946 impl CVec_TransactionOutputsZ {
12947         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
12948                 if self.datalen == 0 { return Vec::new(); }
12949                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12950                 self.data = core::ptr::null_mut();
12951                 self.datalen = 0;
12952                 ret
12953         }
12954         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
12955                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12956         }
12957 }
12958 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12959         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12960                 let datalen = v.len();
12961                 let data = Box::into_raw(v.into_boxed_slice());
12962                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12963         }
12964 }
12965 #[no_mangle]
12966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12967 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12968 impl Drop for CVec_TransactionOutputsZ {
12969         fn drop(&mut self) {
12970                 if self.datalen == 0 { return; }
12971                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12972         }
12973 }
12974 impl Clone for CVec_TransactionOutputsZ {
12975         fn clone(&self) -> Self {
12976                 let mut res = Vec::new();
12977                 if self.datalen == 0 { return Self::from(res); }
12978                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12979                 Self::from(res)
12980         }
12981 }
12982 #[repr(C)]
12983 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12984 /// This corresponds to std::vector in C++
12985 pub struct CVec_BalanceZ {
12986         /// The elements in the array.
12987         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12988         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12989         /// The number of elements pointed to by `data`.
12990         pub datalen: usize
12991 }
12992 impl CVec_BalanceZ {
12993         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12994                 if self.datalen == 0 { return Vec::new(); }
12995                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12996                 self.data = core::ptr::null_mut();
12997                 self.datalen = 0;
12998                 ret
12999         }
13000         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
13001                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13002         }
13003 }
13004 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
13005         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
13006                 let datalen = v.len();
13007                 let data = Box::into_raw(v.into_boxed_slice());
13008                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13009         }
13010 }
13011 #[no_mangle]
13012 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13013 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
13014 impl Drop for CVec_BalanceZ {
13015         fn drop(&mut self) {
13016                 if self.datalen == 0 { return; }
13017                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13018         }
13019 }
13020 impl Clone for CVec_BalanceZ {
13021         fn clone(&self) -> Self {
13022                 let mut res = Vec::new();
13023                 if self.datalen == 0 { return Self::from(res); }
13024                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13025                 Self::from(res)
13026         }
13027 }
13028 #[repr(C)]
13029 /// A tuple of 2 elements. See the individual fields for the types contained.
13030 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13031         /// The element at position 0
13032         pub a: crate::c_types::ThirtyTwoBytes,
13033         /// The element at position 1
13034         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
13035 }
13036 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13037         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
13038                 Self {
13039                         a: tup.0,
13040                         b: tup.1,
13041                 }
13042         }
13043 }
13044 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13045         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
13046                 (self.a, self.b)
13047         }
13048 }
13049 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13050         fn clone(&self) -> Self {
13051                 Self {
13052                         a: Clone::clone(&self.a),
13053                         b: Clone::clone(&self.b),
13054                 }
13055         }
13056 }
13057 #[no_mangle]
13058 /// Creates a new tuple which has the same data as `orig`
13059 /// but with all dynamically-allocated buffers duplicated in new buffers.
13060 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
13061 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
13062 #[no_mangle]
13063 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13064         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
13065 }
13066
13067 #[no_mangle]
13068 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
13069 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
13070 #[repr(C)]
13071 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
13072 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13073         /// A pointer to the contents in the success state.
13074         /// Reading from this pointer when `result_ok` is not set is undefined.
13075         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13076         /// A pointer to the contents in the error state.
13077         /// Reading from this pointer when `result_ok` is set is undefined.
13078         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13079 }
13080 #[repr(C)]
13081 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
13082 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13084 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13085         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
13086         /// `err` or `result` depending on the state of `result_ok`.
13087         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
13088         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
13089         pub result_ok: bool,
13090 }
13091 #[no_mangle]
13092 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
13093 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13094         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13095                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13096                         result: Box::into_raw(Box::new(o)),
13097                 },
13098                 result_ok: true,
13099         }
13100 }
13101 #[no_mangle]
13102 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
13103 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13104         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13105                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13106                         err: Box::into_raw(Box::new(e)),
13107                 },
13108                 result_ok: false,
13109         }
13110 }
13111 /// Checks if the given object is currently in the success state
13112 #[no_mangle]
13113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
13114         o.result_ok
13115 }
13116 #[no_mangle]
13117 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
13118 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
13119 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13120         fn drop(&mut self) {
13121                 if self.result_ok {
13122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13124                         }
13125                 } else {
13126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13128                         }
13129                 }
13130         }
13131 }
13132 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13133         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13134                 let contents = if o.result_ok {
13135                         let result = unsafe { o.contents.result };
13136                         unsafe { o.contents.result = core::ptr::null_mut() };
13137                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
13138                 } else {
13139                         let err = unsafe { o.contents.err };
13140                         unsafe { o.contents.err = core::ptr::null_mut(); }
13141                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
13142                 };
13143                 Self {
13144                         contents,
13145                         result_ok: o.result_ok,
13146                 }
13147         }
13148 }
13149 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13150         fn clone(&self) -> Self {
13151                 if self.result_ok {
13152                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13153                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13154                         } }
13155                 } else {
13156                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13157                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13158                         } }
13159                 }
13160         }
13161 }
13162 #[no_mangle]
13163 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
13164 /// but with all dynamically-allocated buffers duplicated in new buffers.
13165 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
13166 #[repr(C)]
13167 /// A tuple of 2 elements. See the individual fields for the types contained.
13168 pub struct C2Tuple_PublicKeyTypeZ {
13169         /// The element at position 0
13170         pub a: crate::c_types::PublicKey,
13171         /// The element at position 1
13172         pub b: crate::lightning::ln::wire::Type,
13173 }
13174 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
13175         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
13176                 Self {
13177                         a: tup.0,
13178                         b: tup.1,
13179                 }
13180         }
13181 }
13182 impl C2Tuple_PublicKeyTypeZ {
13183         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13184                 (self.a, self.b)
13185         }
13186 }
13187 impl Clone for C2Tuple_PublicKeyTypeZ {
13188         fn clone(&self) -> Self {
13189                 Self {
13190                         a: Clone::clone(&self.a),
13191                         b: Clone::clone(&self.b),
13192                 }
13193         }
13194 }
13195 #[no_mangle]
13196 /// Creates a new tuple which has the same data as `orig`
13197 /// but with all dynamically-allocated buffers duplicated in new buffers.
13198 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13199 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13200 #[no_mangle]
13201 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13202         C2Tuple_PublicKeyTypeZ { a, b, }
13203 }
13204
13205 #[no_mangle]
13206 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13207 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13208 #[repr(C)]
13209 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13210 /// This corresponds to std::vector in C++
13211 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13212         /// The elements in the array.
13213         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13214         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13215         /// The number of elements pointed to by `data`.
13216         pub datalen: usize
13217 }
13218 impl CVec_C2Tuple_PublicKeyTypeZZ {
13219         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13220                 if self.datalen == 0 { return Vec::new(); }
13221                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13222                 self.data = core::ptr::null_mut();
13223                 self.datalen = 0;
13224                 ret
13225         }
13226         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13227                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13228         }
13229 }
13230 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13231         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13232                 let datalen = v.len();
13233                 let data = Box::into_raw(v.into_boxed_slice());
13234                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13235         }
13236 }
13237 #[no_mangle]
13238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13239 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13240 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13241         fn drop(&mut self) {
13242                 if self.datalen == 0 { return; }
13243                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13244         }
13245 }
13246 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13247         fn clone(&self) -> Self {
13248                 let mut res = Vec::new();
13249                 if self.datalen == 0 { return Self::from(res); }
13250                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13251                 Self::from(res)
13252         }
13253 }
13254 #[repr(C)]
13255 /// A tuple of 2 elements. See the individual fields for the types contained.
13256 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13257         /// The element at position 0
13258         pub a: crate::c_types::PublicKey,
13259         /// The element at position 1
13260         pub b: crate::c_types::derived::CVec_SocketAddressZ,
13261 }
13262 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13263         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13264                 Self {
13265                         a: tup.0,
13266                         b: tup.1,
13267                 }
13268         }
13269 }
13270 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13271         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13272                 (self.a, self.b)
13273         }
13274 }
13275 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13276         fn clone(&self) -> Self {
13277                 Self {
13278                         a: Clone::clone(&self.a),
13279                         b: Clone::clone(&self.b),
13280                 }
13281         }
13282 }
13283 #[no_mangle]
13284 /// Creates a new tuple which has the same data as `orig`
13285 /// but with all dynamically-allocated buffers duplicated in new buffers.
13286 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13287 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13288 #[no_mangle]
13289 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13290         C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13291 }
13292
13293 #[no_mangle]
13294 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13295 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13296 #[repr(C)]
13297 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13298 /// This corresponds to std::vector in C++
13299 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13300         /// The elements in the array.
13301         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13302         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13303         /// The number of elements pointed to by `data`.
13304         pub datalen: usize
13305 }
13306 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13307         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13308                 if self.datalen == 0 { return Vec::new(); }
13309                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13310                 self.data = core::ptr::null_mut();
13311                 self.datalen = 0;
13312                 ret
13313         }
13314         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13315                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13316         }
13317 }
13318 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13319         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13320                 let datalen = v.len();
13321                 let data = Box::into_raw(v.into_boxed_slice());
13322                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13323         }
13324 }
13325 #[no_mangle]
13326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13327 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13328 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13329         fn drop(&mut self) {
13330                 if self.datalen == 0 { return; }
13331                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13332         }
13333 }
13334 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13335         fn clone(&self) -> Self {
13336                 let mut res = Vec::new();
13337                 if self.datalen == 0 { return Self::from(res); }
13338                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13339                 Self::from(res)
13340         }
13341 }
13342 #[repr(C)]
13343 #[derive(Clone)]
13344 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13345 pub enum COption_OnionMessageContentsZ {
13346         /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13347         Some(crate::lightning::onion_message::packet::OnionMessageContents),
13348         /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13349         None
13350 }
13351 impl COption_OnionMessageContentsZ {
13352         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13353                 if let Self::None = self { false } else { true }
13354         }
13355         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13356                 !self.is_some()
13357         }
13358         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13359                 if let Self::Some(v) = self { v } else { unreachable!() }
13360         }
13361 }
13362 #[no_mangle]
13363 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13364 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13365         COption_OnionMessageContentsZ::Some(o)
13366 }
13367 #[no_mangle]
13368 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13369 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13370         COption_OnionMessageContentsZ::None
13371 }
13372 #[no_mangle]
13373 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13374 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13375 #[no_mangle]
13376 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13377 /// but with all dynamically-allocated buffers duplicated in new buffers.
13378 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13379 #[repr(C)]
13380 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13381 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13382         /// A pointer to the contents in the success state.
13383         /// Reading from this pointer when `result_ok` is not set is undefined.
13384         pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13385         /// A pointer to the contents in the error state.
13386         /// Reading from this pointer when `result_ok` is set is undefined.
13387         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13388 }
13389 #[repr(C)]
13390 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13391 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13393 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13394         /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13395         /// `err` or `result` depending on the state of `result_ok`.
13396         pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13397         /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13398         pub result_ok: bool,
13399 }
13400 #[no_mangle]
13401 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13402 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13403         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13404                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13405                         result: Box::into_raw(Box::new(o)),
13406                 },
13407                 result_ok: true,
13408         }
13409 }
13410 #[no_mangle]
13411 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13412 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13413         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13414                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13415                         err: Box::into_raw(Box::new(e)),
13416                 },
13417                 result_ok: false,
13418         }
13419 }
13420 /// Checks if the given object is currently in the success state
13421 #[no_mangle]
13422 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13423         o.result_ok
13424 }
13425 #[no_mangle]
13426 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13427 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13428 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13429         fn drop(&mut self) {
13430                 if self.result_ok {
13431                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13432                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13433                         }
13434                 } else {
13435                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13436                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13437                         }
13438                 }
13439         }
13440 }
13441 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13442         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13443                 let contents = if o.result_ok {
13444                         let result = unsafe { o.contents.result };
13445                         unsafe { o.contents.result = core::ptr::null_mut() };
13446                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13447                 } else {
13448                         let err = unsafe { o.contents.err };
13449                         unsafe { o.contents.err = core::ptr::null_mut(); }
13450                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13451                 };
13452                 Self {
13453                         contents,
13454                         result_ok: o.result_ok,
13455                 }
13456         }
13457 }
13458 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13459         fn clone(&self) -> Self {
13460                 if self.result_ok {
13461                         Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13462                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13463                         } }
13464                 } else {
13465                         Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13466                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13467                         } }
13468                 }
13469         }
13470 }
13471 #[no_mangle]
13472 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13473 /// but with all dynamically-allocated buffers duplicated in new buffers.
13474 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13475 #[repr(C)]
13476 /// A tuple of 3 elements. See the individual fields for the types contained.
13477 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13478         /// The element at position 0
13479         pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13480         /// The element at position 1
13481         pub b: crate::lightning::onion_message::messenger::Destination,
13482         /// The element at position 2
13483         pub c: crate::lightning::blinded_path::BlindedPath,
13484 }
13485 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13486         fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13487                 Self {
13488                         a: tup.0,
13489                         b: tup.1,
13490                         c: tup.2,
13491                 }
13492         }
13493 }
13494 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13495         #[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) {
13496                 (self.a, self.b, self.c)
13497         }
13498 }
13499 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13500         fn clone(&self) -> Self {
13501                 Self {
13502                         a: Clone::clone(&self.a),
13503                         b: Clone::clone(&self.b),
13504                         c: Clone::clone(&self.c),
13505                 }
13506         }
13507 }
13508 #[no_mangle]
13509 /// Creates a new tuple which has the same data as `orig`
13510 /// but with all dynamically-allocated buffers duplicated in new buffers.
13511 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13512 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13513 #[no_mangle]
13514 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 {
13515         C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13516 }
13517
13518 #[no_mangle]
13519 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13520 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13521 #[repr(C)]
13522 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13523 /// This corresponds to std::vector in C++
13524 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13525         /// The elements in the array.
13526         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13527         pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13528         /// The number of elements pointed to by `data`.
13529         pub datalen: usize
13530 }
13531 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13532         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13533                 if self.datalen == 0 { return Vec::new(); }
13534                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13535                 self.data = core::ptr::null_mut();
13536                 self.datalen = 0;
13537                 ret
13538         }
13539         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13540                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13541         }
13542 }
13543 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13544         fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13545                 let datalen = v.len();
13546                 let data = Box::into_raw(v.into_boxed_slice());
13547                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13548         }
13549 }
13550 #[no_mangle]
13551 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13552 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13553 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13554         fn drop(&mut self) {
13555                 if self.datalen == 0 { return; }
13556                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13557         }
13558 }
13559 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13560         fn clone(&self) -> Self {
13561                 let mut res = Vec::new();
13562                 if self.datalen == 0 { return Self::from(res); }
13563                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13564                 Self::from(res)
13565         }
13566 }
13567 #[repr(C)]
13568 #[derive(Clone)]
13569 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13570 pub enum COption_TypeZ {
13571         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13572         Some(crate::lightning::ln::wire::Type),
13573         /// When we're in this state, this COption_TypeZ contains nothing
13574         None
13575 }
13576 impl COption_TypeZ {
13577         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13578                 if let Self::None = self { false } else { true }
13579         }
13580         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13581                 !self.is_some()
13582         }
13583         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13584                 if let Self::Some(v) = self { v } else { unreachable!() }
13585         }
13586 }
13587 #[no_mangle]
13588 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13589 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13590         COption_TypeZ::Some(o)
13591 }
13592 #[no_mangle]
13593 /// Constructs a new COption_TypeZ containing nothing
13594 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13595         COption_TypeZ::None
13596 }
13597 #[no_mangle]
13598 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13599 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13600 #[no_mangle]
13601 /// Creates a new COption_TypeZ which has the same data as `orig`
13602 /// but with all dynamically-allocated buffers duplicated in new buffers.
13603 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13604 #[repr(C)]
13605 /// The contents of CResult_COption_TypeZDecodeErrorZ
13606 pub union CResult_COption_TypeZDecodeErrorZPtr {
13607         /// A pointer to the contents in the success state.
13608         /// Reading from this pointer when `result_ok` is not set is undefined.
13609         pub result: *mut crate::c_types::derived::COption_TypeZ,
13610         /// A pointer to the contents in the error state.
13611         /// Reading from this pointer when `result_ok` is set is undefined.
13612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13613 }
13614 #[repr(C)]
13615 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13616 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13618 pub struct CResult_COption_TypeZDecodeErrorZ {
13619         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13620         /// `err` or `result` depending on the state of `result_ok`.
13621         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13622         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13623         pub result_ok: bool,
13624 }
13625 #[no_mangle]
13626 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13627 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13628         CResult_COption_TypeZDecodeErrorZ {
13629                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13630                         result: Box::into_raw(Box::new(o)),
13631                 },
13632                 result_ok: true,
13633         }
13634 }
13635 #[no_mangle]
13636 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13637 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13638         CResult_COption_TypeZDecodeErrorZ {
13639                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13640                         err: Box::into_raw(Box::new(e)),
13641                 },
13642                 result_ok: false,
13643         }
13644 }
13645 /// Checks if the given object is currently in the success state
13646 #[no_mangle]
13647 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13648         o.result_ok
13649 }
13650 #[no_mangle]
13651 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13652 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13653 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13654         fn drop(&mut self) {
13655                 if self.result_ok {
13656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13658                         }
13659                 } else {
13660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13662                         }
13663                 }
13664         }
13665 }
13666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13667         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13668                 let contents = if o.result_ok {
13669                         let result = unsafe { o.contents.result };
13670                         unsafe { o.contents.result = core::ptr::null_mut() };
13671                         CResult_COption_TypeZDecodeErrorZPtr { result }
13672                 } else {
13673                         let err = unsafe { o.contents.err };
13674                         unsafe { o.contents.err = core::ptr::null_mut(); }
13675                         CResult_COption_TypeZDecodeErrorZPtr { err }
13676                 };
13677                 Self {
13678                         contents,
13679                         result_ok: o.result_ok,
13680                 }
13681         }
13682 }
13683 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13684         fn clone(&self) -> Self {
13685                 if self.result_ok {
13686                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13687                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13688                         } }
13689                 } else {
13690                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13692                         } }
13693                 }
13694         }
13695 }
13696 #[no_mangle]
13697 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13698 /// but with all dynamically-allocated buffers duplicated in new buffers.
13699 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13700 #[repr(C)]
13701 #[derive(Clone)]
13702 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13703 pub enum COption_SocketAddressZ {
13704         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13705         Some(crate::lightning::ln::msgs::SocketAddress),
13706         /// When we're in this state, this COption_SocketAddressZ contains nothing
13707         None
13708 }
13709 impl COption_SocketAddressZ {
13710         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13711                 if let Self::None = self { false } else { true }
13712         }
13713         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13714                 !self.is_some()
13715         }
13716         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13717                 if let Self::Some(v) = self { v } else { unreachable!() }
13718         }
13719 }
13720 #[no_mangle]
13721 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13722 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13723         COption_SocketAddressZ::Some(o)
13724 }
13725 #[no_mangle]
13726 /// Constructs a new COption_SocketAddressZ containing nothing
13727 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13728         COption_SocketAddressZ::None
13729 }
13730 #[no_mangle]
13731 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13732 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13733 #[no_mangle]
13734 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13735 /// but with all dynamically-allocated buffers duplicated in new buffers.
13736 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13737 #[repr(C)]
13738 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13739 /// This corresponds to std::vector in C++
13740 pub struct CVec_PeerDetailsZ {
13741         /// The elements in the array.
13742         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13743         pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13744         /// The number of elements pointed to by `data`.
13745         pub datalen: usize
13746 }
13747 impl CVec_PeerDetailsZ {
13748         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13749                 if self.datalen == 0 { return Vec::new(); }
13750                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13751                 self.data = core::ptr::null_mut();
13752                 self.datalen = 0;
13753                 ret
13754         }
13755         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13756                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13757         }
13758 }
13759 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
13760         fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
13761                 let datalen = v.len();
13762                 let data = Box::into_raw(v.into_boxed_slice());
13763                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13764         }
13765 }
13766 #[no_mangle]
13767 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13768 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
13769 impl Drop for CVec_PeerDetailsZ {
13770         fn drop(&mut self) {
13771                 if self.datalen == 0 { return; }
13772                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13773         }
13774 }
13775 #[repr(C)]
13776 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
13777 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
13778         /// A pointer to the contents in the success state.
13779         /// Reading from this pointer when `result_ok` is not set is undefined.
13780         pub result: *mut crate::c_types::derived::CVec_u8Z,
13781         /// A pointer to the contents in the error state.
13782         /// Reading from this pointer when `result_ok` is set is undefined.
13783         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13784 }
13785 #[repr(C)]
13786 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
13787 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13789 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
13790         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
13791         /// `err` or `result` depending on the state of `result_ok`.
13792         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
13793         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
13794         pub result_ok: bool,
13795 }
13796 #[no_mangle]
13797 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
13798 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
13799         CResult_CVec_u8ZPeerHandleErrorZ {
13800                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13801                         result: Box::into_raw(Box::new(o)),
13802                 },
13803                 result_ok: true,
13804         }
13805 }
13806 #[no_mangle]
13807 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
13808 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
13809         CResult_CVec_u8ZPeerHandleErrorZ {
13810                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13811                         err: Box::into_raw(Box::new(e)),
13812                 },
13813                 result_ok: false,
13814         }
13815 }
13816 /// Checks if the given object is currently in the success state
13817 #[no_mangle]
13818 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
13819         o.result_ok
13820 }
13821 #[no_mangle]
13822 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
13823 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
13824 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
13825         fn drop(&mut self) {
13826                 if self.result_ok {
13827                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13828                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13829                         }
13830                 } else {
13831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13833                         }
13834                 }
13835         }
13836 }
13837 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
13838         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13839                 let contents = if o.result_ok {
13840                         let result = unsafe { o.contents.result };
13841                         unsafe { o.contents.result = core::ptr::null_mut() };
13842                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
13843                 } else {
13844                         let err = unsafe { o.contents.err };
13845                         unsafe { o.contents.err = core::ptr::null_mut(); }
13846                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
13847                 };
13848                 Self {
13849                         contents,
13850                         result_ok: o.result_ok,
13851                 }
13852         }
13853 }
13854 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
13855         fn clone(&self) -> Self {
13856                 if self.result_ok {
13857                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13858                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13859                         } }
13860                 } else {
13861                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13862                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13863                         } }
13864                 }
13865         }
13866 }
13867 #[no_mangle]
13868 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
13869 /// but with all dynamically-allocated buffers duplicated in new buffers.
13870 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
13871 #[repr(C)]
13872 /// The contents of CResult_NonePeerHandleErrorZ
13873 pub union CResult_NonePeerHandleErrorZPtr {
13874         /// Note that this value is always NULL, as there are no contents in the OK variant
13875         pub result: *mut core::ffi::c_void,
13876         /// A pointer to the contents in the error state.
13877         /// Reading from this pointer when `result_ok` is set is undefined.
13878         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13879 }
13880 #[repr(C)]
13881 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
13882 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13884 pub struct CResult_NonePeerHandleErrorZ {
13885         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
13886         /// `err` or `result` depending on the state of `result_ok`.
13887         pub contents: CResult_NonePeerHandleErrorZPtr,
13888         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
13889         pub result_ok: bool,
13890 }
13891 #[no_mangle]
13892 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
13893 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
13894         CResult_NonePeerHandleErrorZ {
13895                 contents: CResult_NonePeerHandleErrorZPtr {
13896                         result: core::ptr::null_mut(),
13897                 },
13898                 result_ok: true,
13899         }
13900 }
13901 #[no_mangle]
13902 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
13903 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
13904         CResult_NonePeerHandleErrorZ {
13905                 contents: CResult_NonePeerHandleErrorZPtr {
13906                         err: Box::into_raw(Box::new(e)),
13907                 },
13908                 result_ok: false,
13909         }
13910 }
13911 /// Checks if the given object is currently in the success state
13912 #[no_mangle]
13913 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
13914         o.result_ok
13915 }
13916 #[no_mangle]
13917 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
13918 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
13919 impl Drop for CResult_NonePeerHandleErrorZ {
13920         fn drop(&mut self) {
13921                 if self.result_ok {
13922                 } else {
13923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13925                         }
13926                 }
13927         }
13928 }
13929 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
13930         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13931                 let contents = if o.result_ok {
13932                         let _ = unsafe { Box::from_raw(o.contents.result) };
13933                         o.contents.result = core::ptr::null_mut();
13934                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
13935                 } else {
13936                         let err = unsafe { o.contents.err };
13937                         unsafe { o.contents.err = core::ptr::null_mut(); }
13938                         CResult_NonePeerHandleErrorZPtr { err }
13939                 };
13940                 Self {
13941                         contents,
13942                         result_ok: o.result_ok,
13943                 }
13944         }
13945 }
13946 impl Clone for CResult_NonePeerHandleErrorZ {
13947         fn clone(&self) -> Self {
13948                 if self.result_ok {
13949                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13950                                 result: core::ptr::null_mut()
13951                         } }
13952                 } else {
13953                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13954                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13955                         } }
13956                 }
13957         }
13958 }
13959 #[no_mangle]
13960 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13961 /// but with all dynamically-allocated buffers duplicated in new buffers.
13962 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13963 #[repr(C)]
13964 /// The contents of CResult_boolPeerHandleErrorZ
13965 pub union CResult_boolPeerHandleErrorZPtr {
13966         /// A pointer to the contents in the success state.
13967         /// Reading from this pointer when `result_ok` is not set is undefined.
13968         pub result: *mut bool,
13969         /// A pointer to the contents in the error state.
13970         /// Reading from this pointer when `result_ok` is set is undefined.
13971         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13972 }
13973 #[repr(C)]
13974 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13975 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13977 pub struct CResult_boolPeerHandleErrorZ {
13978         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13979         /// `err` or `result` depending on the state of `result_ok`.
13980         pub contents: CResult_boolPeerHandleErrorZPtr,
13981         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13982         pub result_ok: bool,
13983 }
13984 #[no_mangle]
13985 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13986 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13987         CResult_boolPeerHandleErrorZ {
13988                 contents: CResult_boolPeerHandleErrorZPtr {
13989                         result: Box::into_raw(Box::new(o)),
13990                 },
13991                 result_ok: true,
13992         }
13993 }
13994 #[no_mangle]
13995 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13996 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13997         CResult_boolPeerHandleErrorZ {
13998                 contents: CResult_boolPeerHandleErrorZPtr {
13999                         err: Box::into_raw(Box::new(e)),
14000                 },
14001                 result_ok: false,
14002         }
14003 }
14004 /// Checks if the given object is currently in the success state
14005 #[no_mangle]
14006 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
14007         o.result_ok
14008 }
14009 #[no_mangle]
14010 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
14011 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
14012 impl Drop for CResult_boolPeerHandleErrorZ {
14013         fn drop(&mut self) {
14014                 if self.result_ok {
14015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14017                         }
14018                 } else {
14019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14021                         }
14022                 }
14023         }
14024 }
14025 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
14026         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14027                 let contents = if o.result_ok {
14028                         let result = unsafe { o.contents.result };
14029                         unsafe { o.contents.result = core::ptr::null_mut() };
14030                         CResult_boolPeerHandleErrorZPtr { result }
14031                 } else {
14032                         let err = unsafe { o.contents.err };
14033                         unsafe { o.contents.err = core::ptr::null_mut(); }
14034                         CResult_boolPeerHandleErrorZPtr { err }
14035                 };
14036                 Self {
14037                         contents,
14038                         result_ok: o.result_ok,
14039                 }
14040         }
14041 }
14042 impl Clone for CResult_boolPeerHandleErrorZ {
14043         fn clone(&self) -> Self {
14044                 if self.result_ok {
14045                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
14046                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
14047                         } }
14048                 } else {
14049                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
14050                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14051                         } }
14052                 }
14053         }
14054 }
14055 #[no_mangle]
14056 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
14057 /// but with all dynamically-allocated buffers duplicated in new buffers.
14058 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
14059 #[repr(C)]
14060 /// The contents of CResult_u32GraphSyncErrorZ
14061 pub union CResult_u32GraphSyncErrorZPtr {
14062         /// A pointer to the contents in the success state.
14063         /// Reading from this pointer when `result_ok` is not set is undefined.
14064         pub result: *mut u32,
14065         /// A pointer to the contents in the error state.
14066         /// Reading from this pointer when `result_ok` is set is undefined.
14067         pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
14068 }
14069 #[repr(C)]
14070 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
14071 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
14072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14073 pub struct CResult_u32GraphSyncErrorZ {
14074         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
14075         /// `err` or `result` depending on the state of `result_ok`.
14076         pub contents: CResult_u32GraphSyncErrorZPtr,
14077         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
14078         pub result_ok: bool,
14079 }
14080 #[no_mangle]
14081 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
14082 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
14083         CResult_u32GraphSyncErrorZ {
14084                 contents: CResult_u32GraphSyncErrorZPtr {
14085                         result: Box::into_raw(Box::new(o)),
14086                 },
14087                 result_ok: true,
14088         }
14089 }
14090 #[no_mangle]
14091 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
14092 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
14093         CResult_u32GraphSyncErrorZ {
14094                 contents: CResult_u32GraphSyncErrorZPtr {
14095                         err: Box::into_raw(Box::new(e)),
14096                 },
14097                 result_ok: false,
14098         }
14099 }
14100 /// Checks if the given object is currently in the success state
14101 #[no_mangle]
14102 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
14103         o.result_ok
14104 }
14105 #[no_mangle]
14106 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
14107 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
14108 impl Drop for CResult_u32GraphSyncErrorZ {
14109         fn drop(&mut self) {
14110                 if self.result_ok {
14111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14113                         }
14114                 } else {
14115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14117                         }
14118                 }
14119         }
14120 }
14121 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
14122         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
14123                 let contents = if o.result_ok {
14124                         let result = unsafe { o.contents.result };
14125                         unsafe { o.contents.result = core::ptr::null_mut() };
14126                         CResult_u32GraphSyncErrorZPtr { result }
14127                 } else {
14128                         let err = unsafe { o.contents.err };
14129                         unsafe { o.contents.err = core::ptr::null_mut(); }
14130                         CResult_u32GraphSyncErrorZPtr { err }
14131                 };
14132                 Self {
14133                         contents,
14134                         result_ok: o.result_ok,
14135                 }
14136         }
14137 }
14138 #[repr(C)]
14139 /// The contents of CResult_CVec_u8ZIOErrorZ
14140 pub union CResult_CVec_u8ZIOErrorZPtr {
14141         /// A pointer to the contents in the success state.
14142         /// Reading from this pointer when `result_ok` is not set is undefined.
14143         pub result: *mut crate::c_types::derived::CVec_u8Z,
14144         /// A pointer to the contents in the error state.
14145         /// Reading from this pointer when `result_ok` is set is undefined.
14146         pub err: *mut crate::c_types::IOError,
14147 }
14148 #[repr(C)]
14149 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
14150 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
14151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14152 pub struct CResult_CVec_u8ZIOErrorZ {
14153         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
14154         /// `err` or `result` depending on the state of `result_ok`.
14155         pub contents: CResult_CVec_u8ZIOErrorZPtr,
14156         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
14157         pub result_ok: bool,
14158 }
14159 #[no_mangle]
14160 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
14161 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
14162         CResult_CVec_u8ZIOErrorZ {
14163                 contents: CResult_CVec_u8ZIOErrorZPtr {
14164                         result: Box::into_raw(Box::new(o)),
14165                 },
14166                 result_ok: true,
14167         }
14168 }
14169 #[no_mangle]
14170 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
14171 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
14172         CResult_CVec_u8ZIOErrorZ {
14173                 contents: CResult_CVec_u8ZIOErrorZPtr {
14174                         err: Box::into_raw(Box::new(e)),
14175                 },
14176                 result_ok: false,
14177         }
14178 }
14179 /// Checks if the given object is currently in the success state
14180 #[no_mangle]
14181 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14182         o.result_ok
14183 }
14184 #[no_mangle]
14185 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14186 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14187 impl Drop for CResult_CVec_u8ZIOErrorZ {
14188         fn drop(&mut self) {
14189                 if self.result_ok {
14190                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14191                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14192                         }
14193                 } else {
14194                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14195                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14196                         }
14197                 }
14198         }
14199 }
14200 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14201         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14202                 let contents = if o.result_ok {
14203                         let result = unsafe { o.contents.result };
14204                         unsafe { o.contents.result = core::ptr::null_mut() };
14205                         CResult_CVec_u8ZIOErrorZPtr { result }
14206                 } else {
14207                         let err = unsafe { o.contents.err };
14208                         unsafe { o.contents.err = core::ptr::null_mut(); }
14209                         CResult_CVec_u8ZIOErrorZPtr { err }
14210                 };
14211                 Self {
14212                         contents,
14213                         result_ok: o.result_ok,
14214                 }
14215         }
14216 }
14217 impl Clone for CResult_CVec_u8ZIOErrorZ {
14218         fn clone(&self) -> Self {
14219                 if self.result_ok {
14220                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14221                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14222                         } }
14223                 } else {
14224                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14225                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14226                         } }
14227                 }
14228         }
14229 }
14230 #[no_mangle]
14231 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14232 /// but with all dynamically-allocated buffers duplicated in new buffers.
14233 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14234 #[repr(C)]
14235 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14236 /// This corresponds to std::vector in C++
14237 pub struct CVec_StrZ {
14238         /// The elements in the array.
14239         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14240         pub data: *mut crate::c_types::Str,
14241         /// The number of elements pointed to by `data`.
14242         pub datalen: usize
14243 }
14244 impl CVec_StrZ {
14245         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14246                 if self.datalen == 0 { return Vec::new(); }
14247                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14248                 self.data = core::ptr::null_mut();
14249                 self.datalen = 0;
14250                 ret
14251         }
14252         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14253                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14254         }
14255 }
14256 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14257         fn from(v: Vec<crate::c_types::Str>) -> Self {
14258                 let datalen = v.len();
14259                 let data = Box::into_raw(v.into_boxed_slice());
14260                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14261         }
14262 }
14263 #[no_mangle]
14264 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14265 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14266 impl Drop for CVec_StrZ {
14267         fn drop(&mut self) {
14268                 if self.datalen == 0 { return; }
14269                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14270         }
14271 }
14272 impl Clone for CVec_StrZ {
14273         fn clone(&self) -> Self {
14274                 let mut res = Vec::new();
14275                 if self.datalen == 0 { return Self::from(res); }
14276                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14277                 Self::from(res)
14278         }
14279 }
14280 #[repr(C)]
14281 /// The contents of CResult_CVec_StrZIOErrorZ
14282 pub union CResult_CVec_StrZIOErrorZPtr {
14283         /// A pointer to the contents in the success state.
14284         /// Reading from this pointer when `result_ok` is not set is undefined.
14285         pub result: *mut crate::c_types::derived::CVec_StrZ,
14286         /// A pointer to the contents in the error state.
14287         /// Reading from this pointer when `result_ok` is set is undefined.
14288         pub err: *mut crate::c_types::IOError,
14289 }
14290 #[repr(C)]
14291 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14292 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14294 pub struct CResult_CVec_StrZIOErrorZ {
14295         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14296         /// `err` or `result` depending on the state of `result_ok`.
14297         pub contents: CResult_CVec_StrZIOErrorZPtr,
14298         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14299         pub result_ok: bool,
14300 }
14301 #[no_mangle]
14302 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14303 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14304         CResult_CVec_StrZIOErrorZ {
14305                 contents: CResult_CVec_StrZIOErrorZPtr {
14306                         result: Box::into_raw(Box::new(o)),
14307                 },
14308                 result_ok: true,
14309         }
14310 }
14311 #[no_mangle]
14312 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14313 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14314         CResult_CVec_StrZIOErrorZ {
14315                 contents: CResult_CVec_StrZIOErrorZPtr {
14316                         err: Box::into_raw(Box::new(e)),
14317                 },
14318                 result_ok: false,
14319         }
14320 }
14321 /// Checks if the given object is currently in the success state
14322 #[no_mangle]
14323 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14324         o.result_ok
14325 }
14326 #[no_mangle]
14327 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14328 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14329 impl Drop for CResult_CVec_StrZIOErrorZ {
14330         fn drop(&mut self) {
14331                 if self.result_ok {
14332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14334                         }
14335                 } else {
14336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14338                         }
14339                 }
14340         }
14341 }
14342 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14343         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14344                 let contents = if o.result_ok {
14345                         let result = unsafe { o.contents.result };
14346                         unsafe { o.contents.result = core::ptr::null_mut() };
14347                         CResult_CVec_StrZIOErrorZPtr { result }
14348                 } else {
14349                         let err = unsafe { o.contents.err };
14350                         unsafe { o.contents.err = core::ptr::null_mut(); }
14351                         CResult_CVec_StrZIOErrorZPtr { err }
14352                 };
14353                 Self {
14354                         contents,
14355                         result_ok: o.result_ok,
14356                 }
14357         }
14358 }
14359 impl Clone for CResult_CVec_StrZIOErrorZ {
14360         fn clone(&self) -> Self {
14361                 if self.result_ok {
14362                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14363                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14364                         } }
14365                 } else {
14366                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14367                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14368                         } }
14369                 }
14370         }
14371 }
14372 #[no_mangle]
14373 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14374 /// but with all dynamically-allocated buffers duplicated in new buffers.
14375 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14376 #[repr(C)]
14377 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14378 /// This corresponds to std::vector in C++
14379 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14380         /// The elements in the array.
14381         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14382         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14383         /// The number of elements pointed to by `data`.
14384         pub datalen: usize
14385 }
14386 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14387         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14388                 if self.datalen == 0 { return Vec::new(); }
14389                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14390                 self.data = core::ptr::null_mut();
14391                 self.datalen = 0;
14392                 ret
14393         }
14394         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14395                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14396         }
14397 }
14398 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14399         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14400                 let datalen = v.len();
14401                 let data = Box::into_raw(v.into_boxed_slice());
14402                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14403         }
14404 }
14405 #[no_mangle]
14406 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14407 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14408 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14409         fn drop(&mut self) {
14410                 if self.datalen == 0 { return; }
14411                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14412         }
14413 }
14414 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14415         fn clone(&self) -> Self {
14416                 let mut res = Vec::new();
14417                 if self.datalen == 0 { return Self::from(res); }
14418                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14419                 Self::from(res)
14420         }
14421 }
14422 #[repr(C)]
14423 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14424 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14425         /// A pointer to the contents in the success state.
14426         /// Reading from this pointer when `result_ok` is not set is undefined.
14427         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
14428         /// A pointer to the contents in the error state.
14429         /// Reading from this pointer when `result_ok` is set is undefined.
14430         pub err: *mut crate::c_types::IOError,
14431 }
14432 #[repr(C)]
14433 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14434 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14436 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14437         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14438         /// `err` or `result` depending on the state of `result_ok`.
14439         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14440         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14441         pub result_ok: bool,
14442 }
14443 #[no_mangle]
14444 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14445 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14446         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14447                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14448                         result: Box::into_raw(Box::new(o)),
14449                 },
14450                 result_ok: true,
14451         }
14452 }
14453 #[no_mangle]
14454 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14455 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14456         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14457                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14458                         err: Box::into_raw(Box::new(e)),
14459                 },
14460                 result_ok: false,
14461         }
14462 }
14463 /// Checks if the given object is currently in the success state
14464 #[no_mangle]
14465 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14466         o.result_ok
14467 }
14468 #[no_mangle]
14469 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14470 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14471 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14472         fn drop(&mut self) {
14473                 if self.result_ok {
14474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14476                         }
14477                 } else {
14478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14480                         }
14481                 }
14482         }
14483 }
14484 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14485         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
14486                 let contents = if o.result_ok {
14487                         let result = unsafe { o.contents.result };
14488                         unsafe { o.contents.result = core::ptr::null_mut() };
14489                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14490                 } else {
14491                         let err = unsafe { o.contents.err };
14492                         unsafe { o.contents.err = core::ptr::null_mut(); }
14493                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14494                 };
14495                 Self {
14496                         contents,
14497                         result_ok: o.result_ok,
14498                 }
14499         }
14500 }
14501 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14502         fn clone(&self) -> Self {
14503                 if self.result_ok {
14504                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14505                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14506                         } }
14507                 } else {
14508                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14509                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14510                         } }
14511                 }
14512         }
14513 }
14514 #[no_mangle]
14515 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14516 /// but with all dynamically-allocated buffers duplicated in new buffers.
14517 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14518 #[repr(C)]
14519 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14520 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14521         /// A pointer to the contents in the success state.
14522         /// Reading from this pointer when `result_ok` is not set is undefined.
14523         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14524         /// A pointer to the contents in the error state.
14525         /// Reading from this pointer when `result_ok` is set is undefined.
14526         pub err: *mut crate::c_types::IOError,
14527 }
14528 #[repr(C)]
14529 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14530 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14532 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14533         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14534         /// `err` or `result` depending on the state of `result_ok`.
14535         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14536         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14537         pub result_ok: bool,
14538 }
14539 #[no_mangle]
14540 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14541 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14542         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14543                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14544                         result: Box::into_raw(Box::new(o)),
14545                 },
14546                 result_ok: true,
14547         }
14548 }
14549 #[no_mangle]
14550 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14551 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14552         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14553                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14554                         err: Box::into_raw(Box::new(e)),
14555                 },
14556                 result_ok: false,
14557         }
14558 }
14559 /// Checks if the given object is currently in the success state
14560 #[no_mangle]
14561 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14562         o.result_ok
14563 }
14564 #[no_mangle]
14565 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14566 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14567 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14568         fn drop(&mut self) {
14569                 if self.result_ok {
14570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14572                         }
14573                 } else {
14574                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14575                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14576                         }
14577                 }
14578         }
14579 }
14580 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14581         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14582                 let contents = if o.result_ok {
14583                         let result = unsafe { o.contents.result };
14584                         unsafe { o.contents.result = core::ptr::null_mut() };
14585                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14586                 } else {
14587                         let err = unsafe { o.contents.err };
14588                         unsafe { o.contents.err = core::ptr::null_mut(); }
14589                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14590                 };
14591                 Self {
14592                         contents,
14593                         result_ok: o.result_ok,
14594                 }
14595         }
14596 }
14597 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14598         fn clone(&self) -> Self {
14599                 if self.result_ok {
14600                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14601                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14602                         } }
14603                 } else {
14604                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14605                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14606                         } }
14607                 }
14608         }
14609 }
14610 #[no_mangle]
14611 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14612 /// but with all dynamically-allocated buffers duplicated in new buffers.
14613 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14614 #[repr(C)]
14615 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14616 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14617         /// A pointer to the contents in the success state.
14618         /// Reading from this pointer when `result_ok` is not set is undefined.
14619         pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14620         /// A pointer to the contents in the error state.
14621         /// Reading from this pointer when `result_ok` is set is undefined.
14622         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14623 }
14624 #[repr(C)]
14625 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14626 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14628 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14629         /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14630         /// `err` or `result` depending on the state of `result_ok`.
14631         pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14632         /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14633         pub result_ok: bool,
14634 }
14635 #[no_mangle]
14636 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14637 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14638         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14639                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14640                         result: Box::into_raw(Box::new(o)),
14641                 },
14642                 result_ok: true,
14643         }
14644 }
14645 #[no_mangle]
14646 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14647 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14648         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14649                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14650                         err: Box::into_raw(Box::new(e)),
14651                 },
14652                 result_ok: false,
14653         }
14654 }
14655 /// Checks if the given object is currently in the success state
14656 #[no_mangle]
14657 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14658         o.result_ok
14659 }
14660 #[no_mangle]
14661 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14662 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14663 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14664         fn drop(&mut self) {
14665                 if self.result_ok {
14666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14668                         }
14669                 } else {
14670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14672                         }
14673                 }
14674         }
14675 }
14676 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14677         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14678                 let contents = if o.result_ok {
14679                         let result = unsafe { o.contents.result };
14680                         unsafe { o.contents.result = core::ptr::null_mut() };
14681                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14682                 } else {
14683                         let err = unsafe { o.contents.err };
14684                         unsafe { o.contents.err = core::ptr::null_mut(); }
14685                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14686                 };
14687                 Self {
14688                         contents,
14689                         result_ok: o.result_ok,
14690                 }
14691         }
14692 }
14693 #[repr(C)]
14694 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14695 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14696         /// A pointer to the contents in the success state.
14697         /// Reading from this pointer when `result_ok` is not set is undefined.
14698         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14699         /// A pointer to the contents in the error state.
14700         /// Reading from this pointer when `result_ok` is set is undefined.
14701         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14702 }
14703 #[repr(C)]
14704 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14705 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14707 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14708         /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14709         /// `err` or `result` depending on the state of `result_ok`.
14710         pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14711         /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14712         pub result_ok: bool,
14713 }
14714 #[no_mangle]
14715 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14716 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14717         CResult_InvoiceRequestBolt12SemanticErrorZ {
14718                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14719                         result: Box::into_raw(Box::new(o)),
14720                 },
14721                 result_ok: true,
14722         }
14723 }
14724 #[no_mangle]
14725 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14726 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14727         CResult_InvoiceRequestBolt12SemanticErrorZ {
14728                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14729                         err: Box::into_raw(Box::new(e)),
14730                 },
14731                 result_ok: false,
14732         }
14733 }
14734 /// Checks if the given object is currently in the success state
14735 #[no_mangle]
14736 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
14737         o.result_ok
14738 }
14739 #[no_mangle]
14740 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
14741 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
14742 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
14743         fn drop(&mut self) {
14744                 if self.result_ok {
14745                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14746                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14747                         }
14748                 } else {
14749                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14750                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14751                         }
14752                 }
14753         }
14754 }
14755 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
14756         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14757                 let contents = if o.result_ok {
14758                         let result = unsafe { o.contents.result };
14759                         unsafe { o.contents.result = core::ptr::null_mut() };
14760                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
14761                 } else {
14762                         let err = unsafe { o.contents.err };
14763                         unsafe { o.contents.err = core::ptr::null_mut(); }
14764                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
14765                 };
14766                 Self {
14767                         contents,
14768                         result_ok: o.result_ok,
14769                 }
14770         }
14771 }
14772 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
14773         fn clone(&self) -> Self {
14774                 if self.result_ok {
14775                         Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14776                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
14777                         } }
14778                 } else {
14779                         Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14780                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14781                         } }
14782                 }
14783         }
14784 }
14785 #[no_mangle]
14786 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14787 /// but with all dynamically-allocated buffers duplicated in new buffers.
14788 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14789 #[repr(C)]
14790 #[derive(Clone)]
14791 /// An enum which can either contain a crate::c_types::SecretKey or not
14792 pub enum COption_SecretKeyZ {
14793         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
14794         Some(crate::c_types::SecretKey),
14795         /// When we're in this state, this COption_SecretKeyZ contains nothing
14796         None
14797 }
14798 impl COption_SecretKeyZ {
14799         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14800                 if let Self::None = self { false } else { true }
14801         }
14802         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14803                 !self.is_some()
14804         }
14805         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
14806                 if let Self::Some(v) = self { v } else { unreachable!() }
14807         }
14808 }
14809 #[no_mangle]
14810 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
14811 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
14812         COption_SecretKeyZ::Some(o)
14813 }
14814 #[no_mangle]
14815 /// Constructs a new COption_SecretKeyZ containing nothing
14816 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
14817         COption_SecretKeyZ::None
14818 }
14819 #[no_mangle]
14820 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
14821 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
14822 #[no_mangle]
14823 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
14824 /// but with all dynamically-allocated buffers duplicated in new buffers.
14825 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
14826 #[repr(C)]
14827 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
14828 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14829         /// A pointer to the contents in the success state.
14830         /// Reading from this pointer when `result_ok` is not set is undefined.
14831         pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
14832         /// A pointer to the contents in the error state.
14833         /// Reading from this pointer when `result_ok` is set is undefined.
14834         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14835 }
14836 #[repr(C)]
14837 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14838 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14840 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14841         /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14842         /// `err` or `result` depending on the state of `result_ok`.
14843         pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14844         /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14845         pub result_ok: bool,
14846 }
14847 #[no_mangle]
14848 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14849 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14850         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14851                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14852                         result: Box::into_raw(Box::new(o)),
14853                 },
14854                 result_ok: true,
14855         }
14856 }
14857 #[no_mangle]
14858 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14859 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14860         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14861                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14862                         err: Box::into_raw(Box::new(e)),
14863                 },
14864                 result_ok: false,
14865         }
14866 }
14867 /// Checks if the given object is currently in the success state
14868 #[no_mangle]
14869 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14870         o.result_ok
14871 }
14872 #[no_mangle]
14873 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
14874 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14875 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14876         fn drop(&mut self) {
14877                 if self.result_ok {
14878                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14879                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14880                         }
14881                 } else {
14882                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14883                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14884                         }
14885                 }
14886         }
14887 }
14888 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14889         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14890                 let contents = if o.result_ok {
14891                         let result = unsafe { o.contents.result };
14892                         unsafe { o.contents.result = core::ptr::null_mut() };
14893                         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14894                 } else {
14895                         let err = unsafe { o.contents.err };
14896                         unsafe { o.contents.err = core::ptr::null_mut(); }
14897                         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14898                 };
14899                 Self {
14900                         contents,
14901                         result_ok: o.result_ok,
14902                 }
14903         }
14904 }
14905 #[repr(C)]
14906 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
14907 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
14908         /// A pointer to the contents in the success state.
14909         /// Reading from this pointer when `result_ok` is not set is undefined.
14910         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
14911         /// Note that this value is always NULL, as there are no contents in the Err variant
14912         pub err: *mut core::ffi::c_void,
14913 }
14914 #[repr(C)]
14915 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
14916 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
14917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14918 pub struct CResult_VerifiedInvoiceRequestNoneZ {
14919         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
14920         /// `err` or `result` depending on the state of `result_ok`.
14921         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
14922         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
14923         pub result_ok: bool,
14924 }
14925 #[no_mangle]
14926 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
14927 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
14928         CResult_VerifiedInvoiceRequestNoneZ {
14929                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14930                         result: Box::into_raw(Box::new(o)),
14931                 },
14932                 result_ok: true,
14933         }
14934 }
14935 #[no_mangle]
14936 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
14937 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
14938         CResult_VerifiedInvoiceRequestNoneZ {
14939                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14940                         err: core::ptr::null_mut(),
14941                 },
14942                 result_ok: false,
14943         }
14944 }
14945 /// Checks if the given object is currently in the success state
14946 #[no_mangle]
14947 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
14948         o.result_ok
14949 }
14950 #[no_mangle]
14951 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
14952 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
14953 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
14954         fn drop(&mut self) {
14955                 if self.result_ok {
14956                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14957                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14958                         }
14959                 } else {
14960                 }
14961         }
14962 }
14963 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
14964         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
14965                 let contents = if o.result_ok {
14966                         let result = unsafe { o.contents.result };
14967                         unsafe { o.contents.result = core::ptr::null_mut() };
14968                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
14969                 } else {
14970                         let _ = unsafe { Box::from_raw(o.contents.err) };
14971                         o.contents.err = core::ptr::null_mut();
14972                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
14973                 };
14974                 Self {
14975                         contents,
14976                         result_ok: o.result_ok,
14977                 }
14978         }
14979 }
14980 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
14981         fn clone(&self) -> Self {
14982                 if self.result_ok {
14983                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14984                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14985                         } }
14986                 } else {
14987                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14988                                 err: core::ptr::null_mut()
14989                         } }
14990                 }
14991         }
14992 }
14993 #[no_mangle]
14994 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
14995 /// but with all dynamically-allocated buffers duplicated in new buffers.
14996 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
14997 #[repr(C)]
14998 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
14999 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15000         /// A pointer to the contents in the success state.
15001         /// Reading from this pointer when `result_ok` is not set is undefined.
15002         pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
15003         /// A pointer to the contents in the error state.
15004         /// Reading from this pointer when `result_ok` is set is undefined.
15005         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15006 }
15007 #[repr(C)]
15008 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15009 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15011 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15012         /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15013         /// `err` or `result` depending on the state of `result_ok`.
15014         pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15015         /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15016         pub result_ok: bool,
15017 }
15018 #[no_mangle]
15019 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15020 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15021         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15022                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15023                         result: Box::into_raw(Box::new(o)),
15024                 },
15025                 result_ok: true,
15026         }
15027 }
15028 #[no_mangle]
15029 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15030 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15031         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15032                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15033                         err: Box::into_raw(Box::new(e)),
15034                 },
15035                 result_ok: false,
15036         }
15037 }
15038 /// Checks if the given object is currently in the success state
15039 #[no_mangle]
15040 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15041         o.result_ok
15042 }
15043 #[no_mangle]
15044 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
15045 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15046 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15047         fn drop(&mut self) {
15048                 if self.result_ok {
15049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15051                         }
15052                 } else {
15053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15055                         }
15056                 }
15057         }
15058 }
15059 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15061                 let contents = if o.result_ok {
15062                         let result = unsafe { o.contents.result };
15063                         unsafe { o.contents.result = core::ptr::null_mut() };
15064                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15065                 } else {
15066                         let err = unsafe { o.contents.err };
15067                         unsafe { o.contents.err = core::ptr::null_mut(); }
15068                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15069                 };
15070                 Self {
15071                         contents,
15072                         result_ok: o.result_ok,
15073                 }
15074         }
15075 }
15076 #[repr(C)]
15077 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
15078 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15079         /// A pointer to the contents in the success state.
15080         /// Reading from this pointer when `result_ok` is not set is undefined.
15081         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
15082         /// A pointer to the contents in the error state.
15083         /// Reading from this pointer when `result_ok` is set is undefined.
15084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15085 }
15086 #[repr(C)]
15087 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
15088 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
15089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15090 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
15091         /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
15092         /// `err` or `result` depending on the state of `result_ok`.
15093         pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
15094         /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
15095         pub result_ok: bool,
15096 }
15097 #[no_mangle]
15098 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
15099 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15100         CResult_InvoiceRequestFieldsDecodeErrorZ {
15101                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15102                         result: Box::into_raw(Box::new(o)),
15103                 },
15104                 result_ok: true,
15105         }
15106 }
15107 #[no_mangle]
15108 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
15109 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15110         CResult_InvoiceRequestFieldsDecodeErrorZ {
15111                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15112                         err: Box::into_raw(Box::new(e)),
15113                 },
15114                 result_ok: false,
15115         }
15116 }
15117 /// Checks if the given object is currently in the success state
15118 #[no_mangle]
15119 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
15120         o.result_ok
15121 }
15122 #[no_mangle]
15123 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
15124 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
15125 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
15126         fn drop(&mut self) {
15127                 if self.result_ok {
15128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15130                         }
15131                 } else {
15132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15134                         }
15135                 }
15136         }
15137 }
15138 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
15139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
15140                 let contents = if o.result_ok {
15141                         let result = unsafe { o.contents.result };
15142                         unsafe { o.contents.result = core::ptr::null_mut() };
15143                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
15144                 } else {
15145                         let err = unsafe { o.contents.err };
15146                         unsafe { o.contents.err = core::ptr::null_mut(); }
15147                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
15148                 };
15149                 Self {
15150                         contents,
15151                         result_ok: o.result_ok,
15152                 }
15153         }
15154 }
15155 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
15156         fn clone(&self) -> Self {
15157                 if self.result_ok {
15158                         Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15159                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
15160                         } }
15161                 } else {
15162                         Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15164                         } }
15165                 }
15166         }
15167 }
15168 #[no_mangle]
15169 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15170 /// but with all dynamically-allocated buffers duplicated in new buffers.
15171 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15172 #[repr(C)]
15173 /// An enum which can either contain a  or not
15174 pub enum COption_NoneZ {
15175         /// When we're in this state, this COption_NoneZ contains a 
15176         Some,
15177         /// When we're in this state, this COption_NoneZ contains nothing
15178         None
15179 }
15180 impl COption_NoneZ {
15181         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15182                 if let Self::None = self { false } else { true }
15183         }
15184         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15185                 !self.is_some()
15186         }
15187 }
15188 #[no_mangle]
15189 /// Constructs a new COption_NoneZ containing a 
15190 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15191         COption_NoneZ::Some
15192 }
15193 #[no_mangle]
15194 /// Constructs a new COption_NoneZ containing nothing
15195 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15196         COption_NoneZ::None
15197 }
15198 #[no_mangle]
15199 /// Frees any resources associated with the , if we are in the Some state
15200 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15201 #[repr(C)]
15202 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15203 /// This corresponds to std::vector in C++
15204 pub struct CVec_WitnessZ {
15205         /// The elements in the array.
15206         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15207         pub data: *mut crate::c_types::Witness,
15208         /// The number of elements pointed to by `data`.
15209         pub datalen: usize
15210 }
15211 impl CVec_WitnessZ {
15212         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15213                 if self.datalen == 0 { return Vec::new(); }
15214                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15215                 self.data = core::ptr::null_mut();
15216                 self.datalen = 0;
15217                 ret
15218         }
15219         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15220                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15221         }
15222 }
15223 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15224         fn from(v: Vec<crate::c_types::Witness>) -> Self {
15225                 let datalen = v.len();
15226                 let data = Box::into_raw(v.into_boxed_slice());
15227                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15228         }
15229 }
15230 #[no_mangle]
15231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15232 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15233 impl Drop for CVec_WitnessZ {
15234         fn drop(&mut self) {
15235                 if self.datalen == 0 { return; }
15236                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15237         }
15238 }
15239 impl Clone for CVec_WitnessZ {
15240         fn clone(&self) -> Self {
15241                 let mut res = Vec::new();
15242                 if self.datalen == 0 { return Self::from(res); }
15243                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15244                 Self::from(res)
15245         }
15246 }
15247 #[repr(C)]
15248 #[derive(Clone)]
15249 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15250 pub enum COption_ECDSASignatureZ {
15251         /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15252         Some(crate::c_types::ECDSASignature),
15253         /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15254         None
15255 }
15256 impl COption_ECDSASignatureZ {
15257         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15258                 if let Self::None = self { false } else { true }
15259         }
15260         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15261                 !self.is_some()
15262         }
15263         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15264                 if let Self::Some(v) = self { v } else { unreachable!() }
15265         }
15266 }
15267 #[no_mangle]
15268 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15269 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15270         COption_ECDSASignatureZ::Some(o)
15271 }
15272 #[no_mangle]
15273 /// Constructs a new COption_ECDSASignatureZ containing nothing
15274 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15275         COption_ECDSASignatureZ::None
15276 }
15277 #[no_mangle]
15278 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15279 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15280 #[no_mangle]
15281 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15282 /// but with all dynamically-allocated buffers duplicated in new buffers.
15283 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15284 #[repr(C)]
15285 #[derive(Clone)]
15286 /// An enum which can either contain a i64 or not
15287 pub enum COption_i64Z {
15288         /// When we're in this state, this COption_i64Z contains a i64
15289         Some(i64),
15290         /// When we're in this state, this COption_i64Z contains nothing
15291         None
15292 }
15293 impl COption_i64Z {
15294         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15295                 if let Self::None = self { false } else { true }
15296         }
15297         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15298                 !self.is_some()
15299         }
15300         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15301                 if let Self::Some(v) = self { v } else { unreachable!() }
15302         }
15303 }
15304 #[no_mangle]
15305 /// Constructs a new COption_i64Z containing a i64
15306 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15307         COption_i64Z::Some(o)
15308 }
15309 #[no_mangle]
15310 /// Constructs a new COption_i64Z containing nothing
15311 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15312         COption_i64Z::None
15313 }
15314 #[no_mangle]
15315 /// Frees any resources associated with the i64, if we are in the Some state
15316 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15317 #[no_mangle]
15318 /// Creates a new COption_i64Z which has the same data as `orig`
15319 /// but with all dynamically-allocated buffers duplicated in new buffers.
15320 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15321 #[repr(C)]
15322 /// The contents of CResult_SocketAddressDecodeErrorZ
15323 pub union CResult_SocketAddressDecodeErrorZPtr {
15324         /// A pointer to the contents in the success state.
15325         /// Reading from this pointer when `result_ok` is not set is undefined.
15326         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15327         /// A pointer to the contents in the error state.
15328         /// Reading from this pointer when `result_ok` is set is undefined.
15329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15330 }
15331 #[repr(C)]
15332 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15333 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15335 pub struct CResult_SocketAddressDecodeErrorZ {
15336         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15337         /// `err` or `result` depending on the state of `result_ok`.
15338         pub contents: CResult_SocketAddressDecodeErrorZPtr,
15339         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15340         pub result_ok: bool,
15341 }
15342 #[no_mangle]
15343 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15344 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15345         CResult_SocketAddressDecodeErrorZ {
15346                 contents: CResult_SocketAddressDecodeErrorZPtr {
15347                         result: Box::into_raw(Box::new(o)),
15348                 },
15349                 result_ok: true,
15350         }
15351 }
15352 #[no_mangle]
15353 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15354 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15355         CResult_SocketAddressDecodeErrorZ {
15356                 contents: CResult_SocketAddressDecodeErrorZPtr {
15357                         err: Box::into_raw(Box::new(e)),
15358                 },
15359                 result_ok: false,
15360         }
15361 }
15362 /// Checks if the given object is currently in the success state
15363 #[no_mangle]
15364 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15365         o.result_ok
15366 }
15367 #[no_mangle]
15368 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15369 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15370 impl Drop for CResult_SocketAddressDecodeErrorZ {
15371         fn drop(&mut self) {
15372                 if self.result_ok {
15373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15375                         }
15376                 } else {
15377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15379                         }
15380                 }
15381         }
15382 }
15383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15385                 let contents = if o.result_ok {
15386                         let result = unsafe { o.contents.result };
15387                         unsafe { o.contents.result = core::ptr::null_mut() };
15388                         CResult_SocketAddressDecodeErrorZPtr { result }
15389                 } else {
15390                         let err = unsafe { o.contents.err };
15391                         unsafe { o.contents.err = core::ptr::null_mut(); }
15392                         CResult_SocketAddressDecodeErrorZPtr { err }
15393                 };
15394                 Self {
15395                         contents,
15396                         result_ok: o.result_ok,
15397                 }
15398         }
15399 }
15400 impl Clone for CResult_SocketAddressDecodeErrorZ {
15401         fn clone(&self) -> Self {
15402                 if self.result_ok {
15403                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15404                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15405                         } }
15406                 } else {
15407                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15409                         } }
15410                 }
15411         }
15412 }
15413 #[no_mangle]
15414 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15415 /// but with all dynamically-allocated buffers duplicated in new buffers.
15416 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15417 #[repr(C)]
15418 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15419 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15420         /// A pointer to the contents in the success state.
15421         /// Reading from this pointer when `result_ok` is not set is undefined.
15422         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15423         /// A pointer to the contents in the error state.
15424         /// Reading from this pointer when `result_ok` is set is undefined.
15425         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15426 }
15427 #[repr(C)]
15428 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15429 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15431 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15432         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15433         /// `err` or `result` depending on the state of `result_ok`.
15434         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15435         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15436         pub result_ok: bool,
15437 }
15438 #[no_mangle]
15439 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15440 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15441         CResult_SocketAddressSocketAddressParseErrorZ {
15442                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15443                         result: Box::into_raw(Box::new(o)),
15444                 },
15445                 result_ok: true,
15446         }
15447 }
15448 #[no_mangle]
15449 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15450 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15451         CResult_SocketAddressSocketAddressParseErrorZ {
15452                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15453                         err: Box::into_raw(Box::new(e)),
15454                 },
15455                 result_ok: false,
15456         }
15457 }
15458 /// Checks if the given object is currently in the success state
15459 #[no_mangle]
15460 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15461         o.result_ok
15462 }
15463 #[no_mangle]
15464 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15465 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15466 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15467         fn drop(&mut self) {
15468                 if self.result_ok {
15469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15471                         }
15472                 } else {
15473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15475                         }
15476                 }
15477         }
15478 }
15479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15481                 let contents = if o.result_ok {
15482                         let result = unsafe { o.contents.result };
15483                         unsafe { o.contents.result = core::ptr::null_mut() };
15484                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15485                 } else {
15486                         let err = unsafe { o.contents.err };
15487                         unsafe { o.contents.err = core::ptr::null_mut(); }
15488                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15489                 };
15490                 Self {
15491                         contents,
15492                         result_ok: o.result_ok,
15493                 }
15494         }
15495 }
15496 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15497         fn clone(&self) -> Self {
15498                 if self.result_ok {
15499                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15501                         } }
15502                 } else {
15503                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15505                         } }
15506                 }
15507         }
15508 }
15509 #[no_mangle]
15510 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15511 /// but with all dynamically-allocated buffers duplicated in new buffers.
15512 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15513 #[repr(C)]
15514 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15515 /// This corresponds to std::vector in C++
15516 pub struct CVec_UpdateAddHTLCZ {
15517         /// The elements in the array.
15518         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15519         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15520         /// The number of elements pointed to by `data`.
15521         pub datalen: usize
15522 }
15523 impl CVec_UpdateAddHTLCZ {
15524         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15525                 if self.datalen == 0 { return Vec::new(); }
15526                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15527                 self.data = core::ptr::null_mut();
15528                 self.datalen = 0;
15529                 ret
15530         }
15531         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15532                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15533         }
15534 }
15535 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15536         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15537                 let datalen = v.len();
15538                 let data = Box::into_raw(v.into_boxed_slice());
15539                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15540         }
15541 }
15542 #[no_mangle]
15543 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15544 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15545 impl Drop for CVec_UpdateAddHTLCZ {
15546         fn drop(&mut self) {
15547                 if self.datalen == 0 { return; }
15548                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15549         }
15550 }
15551 impl Clone for CVec_UpdateAddHTLCZ {
15552         fn clone(&self) -> Self {
15553                 let mut res = Vec::new();
15554                 if self.datalen == 0 { return Self::from(res); }
15555                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15556                 Self::from(res)
15557         }
15558 }
15559 #[repr(C)]
15560 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15561 /// This corresponds to std::vector in C++
15562 pub struct CVec_UpdateFulfillHTLCZ {
15563         /// The elements in the array.
15564         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15565         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15566         /// The number of elements pointed to by `data`.
15567         pub datalen: usize
15568 }
15569 impl CVec_UpdateFulfillHTLCZ {
15570         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15571                 if self.datalen == 0 { return Vec::new(); }
15572                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15573                 self.data = core::ptr::null_mut();
15574                 self.datalen = 0;
15575                 ret
15576         }
15577         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15578                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15579         }
15580 }
15581 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15582         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15583                 let datalen = v.len();
15584                 let data = Box::into_raw(v.into_boxed_slice());
15585                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15586         }
15587 }
15588 #[no_mangle]
15589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15590 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15591 impl Drop for CVec_UpdateFulfillHTLCZ {
15592         fn drop(&mut self) {
15593                 if self.datalen == 0 { return; }
15594                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15595         }
15596 }
15597 impl Clone for CVec_UpdateFulfillHTLCZ {
15598         fn clone(&self) -> Self {
15599                 let mut res = Vec::new();
15600                 if self.datalen == 0 { return Self::from(res); }
15601                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15602                 Self::from(res)
15603         }
15604 }
15605 #[repr(C)]
15606 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15607 /// This corresponds to std::vector in C++
15608 pub struct CVec_UpdateFailHTLCZ {
15609         /// The elements in the array.
15610         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15611         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15612         /// The number of elements pointed to by `data`.
15613         pub datalen: usize
15614 }
15615 impl CVec_UpdateFailHTLCZ {
15616         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15617                 if self.datalen == 0 { return Vec::new(); }
15618                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15619                 self.data = core::ptr::null_mut();
15620                 self.datalen = 0;
15621                 ret
15622         }
15623         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15624                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15625         }
15626 }
15627 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15628         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15629                 let datalen = v.len();
15630                 let data = Box::into_raw(v.into_boxed_slice());
15631                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15632         }
15633 }
15634 #[no_mangle]
15635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15636 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15637 impl Drop for CVec_UpdateFailHTLCZ {
15638         fn drop(&mut self) {
15639                 if self.datalen == 0 { return; }
15640                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15641         }
15642 }
15643 impl Clone for CVec_UpdateFailHTLCZ {
15644         fn clone(&self) -> Self {
15645                 let mut res = Vec::new();
15646                 if self.datalen == 0 { return Self::from(res); }
15647                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15648                 Self::from(res)
15649         }
15650 }
15651 #[repr(C)]
15652 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15653 /// This corresponds to std::vector in C++
15654 pub struct CVec_UpdateFailMalformedHTLCZ {
15655         /// The elements in the array.
15656         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15657         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15658         /// The number of elements pointed to by `data`.
15659         pub datalen: usize
15660 }
15661 impl CVec_UpdateFailMalformedHTLCZ {
15662         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15663                 if self.datalen == 0 { return Vec::new(); }
15664                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15665                 self.data = core::ptr::null_mut();
15666                 self.datalen = 0;
15667                 ret
15668         }
15669         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15670                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15671         }
15672 }
15673 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15674         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15675                 let datalen = v.len();
15676                 let data = Box::into_raw(v.into_boxed_slice());
15677                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15678         }
15679 }
15680 #[no_mangle]
15681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15682 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15683 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15684         fn drop(&mut self) {
15685                 if self.datalen == 0 { return; }
15686                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15687         }
15688 }
15689 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15690         fn clone(&self) -> Self {
15691                 let mut res = Vec::new();
15692                 if self.datalen == 0 { return Self::from(res); }
15693                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15694                 Self::from(res)
15695         }
15696 }
15697 #[repr(C)]
15698 /// The contents of CResult_AcceptChannelDecodeErrorZ
15699 pub union CResult_AcceptChannelDecodeErrorZPtr {
15700         /// A pointer to the contents in the success state.
15701         /// Reading from this pointer when `result_ok` is not set is undefined.
15702         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15703         /// A pointer to the contents in the error state.
15704         /// Reading from this pointer when `result_ok` is set is undefined.
15705         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15706 }
15707 #[repr(C)]
15708 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15709 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15711 pub struct CResult_AcceptChannelDecodeErrorZ {
15712         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15713         /// `err` or `result` depending on the state of `result_ok`.
15714         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15715         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15716         pub result_ok: bool,
15717 }
15718 #[no_mangle]
15719 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15720 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15721         CResult_AcceptChannelDecodeErrorZ {
15722                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15723                         result: Box::into_raw(Box::new(o)),
15724                 },
15725                 result_ok: true,
15726         }
15727 }
15728 #[no_mangle]
15729 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15730 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15731         CResult_AcceptChannelDecodeErrorZ {
15732                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15733                         err: Box::into_raw(Box::new(e)),
15734                 },
15735                 result_ok: false,
15736         }
15737 }
15738 /// Checks if the given object is currently in the success state
15739 #[no_mangle]
15740 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
15741         o.result_ok
15742 }
15743 #[no_mangle]
15744 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15745 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
15746 impl Drop for CResult_AcceptChannelDecodeErrorZ {
15747         fn drop(&mut self) {
15748                 if self.result_ok {
15749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15751                         }
15752                 } else {
15753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15755                         }
15756                 }
15757         }
15758 }
15759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
15760         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15761                 let contents = if o.result_ok {
15762                         let result = unsafe { o.contents.result };
15763                         unsafe { o.contents.result = core::ptr::null_mut() };
15764                         CResult_AcceptChannelDecodeErrorZPtr { result }
15765                 } else {
15766                         let err = unsafe { o.contents.err };
15767                         unsafe { o.contents.err = core::ptr::null_mut(); }
15768                         CResult_AcceptChannelDecodeErrorZPtr { err }
15769                 };
15770                 Self {
15771                         contents,
15772                         result_ok: o.result_ok,
15773                 }
15774         }
15775 }
15776 impl Clone for CResult_AcceptChannelDecodeErrorZ {
15777         fn clone(&self) -> Self {
15778                 if self.result_ok {
15779                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
15780                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
15781                         } }
15782                 } else {
15783                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
15784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15785                         } }
15786                 }
15787         }
15788 }
15789 #[no_mangle]
15790 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15791 /// but with all dynamically-allocated buffers duplicated in new buffers.
15792 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
15793 #[repr(C)]
15794 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
15795 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
15796         /// A pointer to the contents in the success state.
15797         /// Reading from this pointer when `result_ok` is not set is undefined.
15798         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
15799         /// A pointer to the contents in the error state.
15800         /// Reading from this pointer when `result_ok` is set is undefined.
15801         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15802 }
15803 #[repr(C)]
15804 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
15805 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15807 pub struct CResult_AcceptChannelV2DecodeErrorZ {
15808         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
15809         /// `err` or `result` depending on the state of `result_ok`.
15810         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
15811         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
15812         pub result_ok: bool,
15813 }
15814 #[no_mangle]
15815 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
15816 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
15817         CResult_AcceptChannelV2DecodeErrorZ {
15818                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15819                         result: Box::into_raw(Box::new(o)),
15820                 },
15821                 result_ok: true,
15822         }
15823 }
15824 #[no_mangle]
15825 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
15826 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
15827         CResult_AcceptChannelV2DecodeErrorZ {
15828                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15829                         err: Box::into_raw(Box::new(e)),
15830                 },
15831                 result_ok: false,
15832         }
15833 }
15834 /// Checks if the given object is currently in the success state
15835 #[no_mangle]
15836 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
15837         o.result_ok
15838 }
15839 #[no_mangle]
15840 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
15841 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
15842 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
15843         fn drop(&mut self) {
15844                 if self.result_ok {
15845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15847                         }
15848                 } else {
15849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15851                         }
15852                 }
15853         }
15854 }
15855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
15856         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15857                 let contents = if o.result_ok {
15858                         let result = unsafe { o.contents.result };
15859                         unsafe { o.contents.result = core::ptr::null_mut() };
15860                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
15861                 } else {
15862                         let err = unsafe { o.contents.err };
15863                         unsafe { o.contents.err = core::ptr::null_mut(); }
15864                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
15865                 };
15866                 Self {
15867                         contents,
15868                         result_ok: o.result_ok,
15869                 }
15870         }
15871 }
15872 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
15873         fn clone(&self) -> Self {
15874                 if self.result_ok {
15875                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15876                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
15877                         } }
15878                 } else {
15879                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15881                         } }
15882                 }
15883         }
15884 }
15885 #[no_mangle]
15886 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
15887 /// but with all dynamically-allocated buffers duplicated in new buffers.
15888 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
15889 #[repr(C)]
15890 /// The contents of CResult_StfuDecodeErrorZ
15891 pub union CResult_StfuDecodeErrorZPtr {
15892         /// A pointer to the contents in the success state.
15893         /// Reading from this pointer when `result_ok` is not set is undefined.
15894         pub result: *mut crate::lightning::ln::msgs::Stfu,
15895         /// A pointer to the contents in the error state.
15896         /// Reading from this pointer when `result_ok` is set is undefined.
15897         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15898 }
15899 #[repr(C)]
15900 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
15901 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
15902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15903 pub struct CResult_StfuDecodeErrorZ {
15904         /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
15905         /// `err` or `result` depending on the state of `result_ok`.
15906         pub contents: CResult_StfuDecodeErrorZPtr,
15907         /// Whether this CResult_StfuDecodeErrorZ represents a success state.
15908         pub result_ok: bool,
15909 }
15910 #[no_mangle]
15911 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
15912 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
15913         CResult_StfuDecodeErrorZ {
15914                 contents: CResult_StfuDecodeErrorZPtr {
15915                         result: Box::into_raw(Box::new(o)),
15916                 },
15917                 result_ok: true,
15918         }
15919 }
15920 #[no_mangle]
15921 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
15922 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
15923         CResult_StfuDecodeErrorZ {
15924                 contents: CResult_StfuDecodeErrorZPtr {
15925                         err: Box::into_raw(Box::new(e)),
15926                 },
15927                 result_ok: false,
15928         }
15929 }
15930 /// Checks if the given object is currently in the success state
15931 #[no_mangle]
15932 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
15933         o.result_ok
15934 }
15935 #[no_mangle]
15936 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
15937 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
15938 impl Drop for CResult_StfuDecodeErrorZ {
15939         fn drop(&mut self) {
15940                 if self.result_ok {
15941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15943                         }
15944                 } else {
15945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15947                         }
15948                 }
15949         }
15950 }
15951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
15952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
15953                 let contents = if o.result_ok {
15954                         let result = unsafe { o.contents.result };
15955                         unsafe { o.contents.result = core::ptr::null_mut() };
15956                         CResult_StfuDecodeErrorZPtr { result }
15957                 } else {
15958                         let err = unsafe { o.contents.err };
15959                         unsafe { o.contents.err = core::ptr::null_mut(); }
15960                         CResult_StfuDecodeErrorZPtr { err }
15961                 };
15962                 Self {
15963                         contents,
15964                         result_ok: o.result_ok,
15965                 }
15966         }
15967 }
15968 impl Clone for CResult_StfuDecodeErrorZ {
15969         fn clone(&self) -> Self {
15970                 if self.result_ok {
15971                         Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
15972                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
15973                         } }
15974                 } else {
15975                         Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
15976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15977                         } }
15978                 }
15979         }
15980 }
15981 #[no_mangle]
15982 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
15983 /// but with all dynamically-allocated buffers duplicated in new buffers.
15984 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
15985 #[repr(C)]
15986 /// The contents of CResult_SpliceDecodeErrorZ
15987 pub union CResult_SpliceDecodeErrorZPtr {
15988         /// A pointer to the contents in the success state.
15989         /// Reading from this pointer when `result_ok` is not set is undefined.
15990         pub result: *mut crate::lightning::ln::msgs::Splice,
15991         /// A pointer to the contents in the error state.
15992         /// Reading from this pointer when `result_ok` is set is undefined.
15993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15994 }
15995 #[repr(C)]
15996 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
15997 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
15998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15999 pub struct CResult_SpliceDecodeErrorZ {
16000         /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
16001         /// `err` or `result` depending on the state of `result_ok`.
16002         pub contents: CResult_SpliceDecodeErrorZPtr,
16003         /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
16004         pub result_ok: bool,
16005 }
16006 #[no_mangle]
16007 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
16008 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
16009         CResult_SpliceDecodeErrorZ {
16010                 contents: CResult_SpliceDecodeErrorZPtr {
16011                         result: Box::into_raw(Box::new(o)),
16012                 },
16013                 result_ok: true,
16014         }
16015 }
16016 #[no_mangle]
16017 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
16018 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
16019         CResult_SpliceDecodeErrorZ {
16020                 contents: CResult_SpliceDecodeErrorZPtr {
16021                         err: Box::into_raw(Box::new(e)),
16022                 },
16023                 result_ok: false,
16024         }
16025 }
16026 /// Checks if the given object is currently in the success state
16027 #[no_mangle]
16028 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
16029         o.result_ok
16030 }
16031 #[no_mangle]
16032 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
16033 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
16034 impl Drop for CResult_SpliceDecodeErrorZ {
16035         fn drop(&mut self) {
16036                 if self.result_ok {
16037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16039                         }
16040                 } else {
16041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16043                         }
16044                 }
16045         }
16046 }
16047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
16048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
16049                 let contents = if o.result_ok {
16050                         let result = unsafe { o.contents.result };
16051                         unsafe { o.contents.result = core::ptr::null_mut() };
16052                         CResult_SpliceDecodeErrorZPtr { result }
16053                 } else {
16054                         let err = unsafe { o.contents.err };
16055                         unsafe { o.contents.err = core::ptr::null_mut(); }
16056                         CResult_SpliceDecodeErrorZPtr { err }
16057                 };
16058                 Self {
16059                         contents,
16060                         result_ok: o.result_ok,
16061                 }
16062         }
16063 }
16064 impl Clone for CResult_SpliceDecodeErrorZ {
16065         fn clone(&self) -> Self {
16066                 if self.result_ok {
16067                         Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
16068                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
16069                         } }
16070                 } else {
16071                         Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
16072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16073                         } }
16074                 }
16075         }
16076 }
16077 #[no_mangle]
16078 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
16079 /// but with all dynamically-allocated buffers duplicated in new buffers.
16080 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
16081 #[repr(C)]
16082 /// The contents of CResult_SpliceAckDecodeErrorZ
16083 pub union CResult_SpliceAckDecodeErrorZPtr {
16084         /// A pointer to the contents in the success state.
16085         /// Reading from this pointer when `result_ok` is not set is undefined.
16086         pub result: *mut crate::lightning::ln::msgs::SpliceAck,
16087         /// A pointer to the contents in the error state.
16088         /// Reading from this pointer when `result_ok` is set is undefined.
16089         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16090 }
16091 #[repr(C)]
16092 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
16093 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
16094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16095 pub struct CResult_SpliceAckDecodeErrorZ {
16096         /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
16097         /// `err` or `result` depending on the state of `result_ok`.
16098         pub contents: CResult_SpliceAckDecodeErrorZPtr,
16099         /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
16100         pub result_ok: bool,
16101 }
16102 #[no_mangle]
16103 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
16104 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
16105         CResult_SpliceAckDecodeErrorZ {
16106                 contents: CResult_SpliceAckDecodeErrorZPtr {
16107                         result: Box::into_raw(Box::new(o)),
16108                 },
16109                 result_ok: true,
16110         }
16111 }
16112 #[no_mangle]
16113 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
16114 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
16115         CResult_SpliceAckDecodeErrorZ {
16116                 contents: CResult_SpliceAckDecodeErrorZPtr {
16117                         err: Box::into_raw(Box::new(e)),
16118                 },
16119                 result_ok: false,
16120         }
16121 }
16122 /// Checks if the given object is currently in the success state
16123 #[no_mangle]
16124 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
16125         o.result_ok
16126 }
16127 #[no_mangle]
16128 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
16129 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
16130 impl Drop for CResult_SpliceAckDecodeErrorZ {
16131         fn drop(&mut self) {
16132                 if self.result_ok {
16133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16135                         }
16136                 } else {
16137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16139                         }
16140                 }
16141         }
16142 }
16143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
16144         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
16145                 let contents = if o.result_ok {
16146                         let result = unsafe { o.contents.result };
16147                         unsafe { o.contents.result = core::ptr::null_mut() };
16148                         CResult_SpliceAckDecodeErrorZPtr { result }
16149                 } else {
16150                         let err = unsafe { o.contents.err };
16151                         unsafe { o.contents.err = core::ptr::null_mut(); }
16152                         CResult_SpliceAckDecodeErrorZPtr { err }
16153                 };
16154                 Self {
16155                         contents,
16156                         result_ok: o.result_ok,
16157                 }
16158         }
16159 }
16160 impl Clone for CResult_SpliceAckDecodeErrorZ {
16161         fn clone(&self) -> Self {
16162                 if self.result_ok {
16163                         Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16164                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16165                         } }
16166                 } else {
16167                         Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16168                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16169                         } }
16170                 }
16171         }
16172 }
16173 #[no_mangle]
16174 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16175 /// but with all dynamically-allocated buffers duplicated in new buffers.
16176 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16177 #[repr(C)]
16178 /// The contents of CResult_SpliceLockedDecodeErrorZ
16179 pub union CResult_SpliceLockedDecodeErrorZPtr {
16180         /// A pointer to the contents in the success state.
16181         /// Reading from this pointer when `result_ok` is not set is undefined.
16182         pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16183         /// A pointer to the contents in the error state.
16184         /// Reading from this pointer when `result_ok` is set is undefined.
16185         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16186 }
16187 #[repr(C)]
16188 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16189 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16191 pub struct CResult_SpliceLockedDecodeErrorZ {
16192         /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16193         /// `err` or `result` depending on the state of `result_ok`.
16194         pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16195         /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16196         pub result_ok: bool,
16197 }
16198 #[no_mangle]
16199 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16200 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16201         CResult_SpliceLockedDecodeErrorZ {
16202                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16203                         result: Box::into_raw(Box::new(o)),
16204                 },
16205                 result_ok: true,
16206         }
16207 }
16208 #[no_mangle]
16209 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16210 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16211         CResult_SpliceLockedDecodeErrorZ {
16212                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16213                         err: Box::into_raw(Box::new(e)),
16214                 },
16215                 result_ok: false,
16216         }
16217 }
16218 /// Checks if the given object is currently in the success state
16219 #[no_mangle]
16220 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16221         o.result_ok
16222 }
16223 #[no_mangle]
16224 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16225 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16226 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16227         fn drop(&mut self) {
16228                 if self.result_ok {
16229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16231                         }
16232                 } else {
16233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16235                         }
16236                 }
16237         }
16238 }
16239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16241                 let contents = if o.result_ok {
16242                         let result = unsafe { o.contents.result };
16243                         unsafe { o.contents.result = core::ptr::null_mut() };
16244                         CResult_SpliceLockedDecodeErrorZPtr { result }
16245                 } else {
16246                         let err = unsafe { o.contents.err };
16247                         unsafe { o.contents.err = core::ptr::null_mut(); }
16248                         CResult_SpliceLockedDecodeErrorZPtr { err }
16249                 };
16250                 Self {
16251                         contents,
16252                         result_ok: o.result_ok,
16253                 }
16254         }
16255 }
16256 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16257         fn clone(&self) -> Self {
16258                 if self.result_ok {
16259                         Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16260                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16261                         } }
16262                 } else {
16263                         Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16265                         } }
16266                 }
16267         }
16268 }
16269 #[no_mangle]
16270 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16271 /// but with all dynamically-allocated buffers duplicated in new buffers.
16272 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16273 #[repr(C)]
16274 /// The contents of CResult_TxAddInputDecodeErrorZ
16275 pub union CResult_TxAddInputDecodeErrorZPtr {
16276         /// A pointer to the contents in the success state.
16277         /// Reading from this pointer when `result_ok` is not set is undefined.
16278         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16279         /// A pointer to the contents in the error state.
16280         /// Reading from this pointer when `result_ok` is set is undefined.
16281         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16282 }
16283 #[repr(C)]
16284 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16285 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16287 pub struct CResult_TxAddInputDecodeErrorZ {
16288         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16289         /// `err` or `result` depending on the state of `result_ok`.
16290         pub contents: CResult_TxAddInputDecodeErrorZPtr,
16291         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16292         pub result_ok: bool,
16293 }
16294 #[no_mangle]
16295 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16296 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16297         CResult_TxAddInputDecodeErrorZ {
16298                 contents: CResult_TxAddInputDecodeErrorZPtr {
16299                         result: Box::into_raw(Box::new(o)),
16300                 },
16301                 result_ok: true,
16302         }
16303 }
16304 #[no_mangle]
16305 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16306 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16307         CResult_TxAddInputDecodeErrorZ {
16308                 contents: CResult_TxAddInputDecodeErrorZPtr {
16309                         err: Box::into_raw(Box::new(e)),
16310                 },
16311                 result_ok: false,
16312         }
16313 }
16314 /// Checks if the given object is currently in the success state
16315 #[no_mangle]
16316 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16317         o.result_ok
16318 }
16319 #[no_mangle]
16320 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16321 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16322 impl Drop for CResult_TxAddInputDecodeErrorZ {
16323         fn drop(&mut self) {
16324                 if self.result_ok {
16325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16327                         }
16328                 } else {
16329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16331                         }
16332                 }
16333         }
16334 }
16335 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16337                 let contents = if o.result_ok {
16338                         let result = unsafe { o.contents.result };
16339                         unsafe { o.contents.result = core::ptr::null_mut() };
16340                         CResult_TxAddInputDecodeErrorZPtr { result }
16341                 } else {
16342                         let err = unsafe { o.contents.err };
16343                         unsafe { o.contents.err = core::ptr::null_mut(); }
16344                         CResult_TxAddInputDecodeErrorZPtr { err }
16345                 };
16346                 Self {
16347                         contents,
16348                         result_ok: o.result_ok,
16349                 }
16350         }
16351 }
16352 impl Clone for CResult_TxAddInputDecodeErrorZ {
16353         fn clone(&self) -> Self {
16354                 if self.result_ok {
16355                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16356                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16357                         } }
16358                 } else {
16359                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16360                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16361                         } }
16362                 }
16363         }
16364 }
16365 #[no_mangle]
16366 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16367 /// but with all dynamically-allocated buffers duplicated in new buffers.
16368 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16369 #[repr(C)]
16370 /// The contents of CResult_TxAddOutputDecodeErrorZ
16371 pub union CResult_TxAddOutputDecodeErrorZPtr {
16372         /// A pointer to the contents in the success state.
16373         /// Reading from this pointer when `result_ok` is not set is undefined.
16374         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16375         /// A pointer to the contents in the error state.
16376         /// Reading from this pointer when `result_ok` is set is undefined.
16377         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16378 }
16379 #[repr(C)]
16380 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16381 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16383 pub struct CResult_TxAddOutputDecodeErrorZ {
16384         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16385         /// `err` or `result` depending on the state of `result_ok`.
16386         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16387         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16388         pub result_ok: bool,
16389 }
16390 #[no_mangle]
16391 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16392 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16393         CResult_TxAddOutputDecodeErrorZ {
16394                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16395                         result: Box::into_raw(Box::new(o)),
16396                 },
16397                 result_ok: true,
16398         }
16399 }
16400 #[no_mangle]
16401 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16402 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16403         CResult_TxAddOutputDecodeErrorZ {
16404                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16405                         err: Box::into_raw(Box::new(e)),
16406                 },
16407                 result_ok: false,
16408         }
16409 }
16410 /// Checks if the given object is currently in the success state
16411 #[no_mangle]
16412 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16413         o.result_ok
16414 }
16415 #[no_mangle]
16416 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16417 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16418 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16419         fn drop(&mut self) {
16420                 if self.result_ok {
16421                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16422                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16423                         }
16424                 } else {
16425                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16426                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16427                         }
16428                 }
16429         }
16430 }
16431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16432         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16433                 let contents = if o.result_ok {
16434                         let result = unsafe { o.contents.result };
16435                         unsafe { o.contents.result = core::ptr::null_mut() };
16436                         CResult_TxAddOutputDecodeErrorZPtr { result }
16437                 } else {
16438                         let err = unsafe { o.contents.err };
16439                         unsafe { o.contents.err = core::ptr::null_mut(); }
16440                         CResult_TxAddOutputDecodeErrorZPtr { err }
16441                 };
16442                 Self {
16443                         contents,
16444                         result_ok: o.result_ok,
16445                 }
16446         }
16447 }
16448 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16449         fn clone(&self) -> Self {
16450                 if self.result_ok {
16451                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16452                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16453                         } }
16454                 } else {
16455                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16456                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16457                         } }
16458                 }
16459         }
16460 }
16461 #[no_mangle]
16462 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16463 /// but with all dynamically-allocated buffers duplicated in new buffers.
16464 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16465 #[repr(C)]
16466 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16467 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16468         /// A pointer to the contents in the success state.
16469         /// Reading from this pointer when `result_ok` is not set is undefined.
16470         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16471         /// A pointer to the contents in the error state.
16472         /// Reading from this pointer when `result_ok` is set is undefined.
16473         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16474 }
16475 #[repr(C)]
16476 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16477 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16479 pub struct CResult_TxRemoveInputDecodeErrorZ {
16480         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16481         /// `err` or `result` depending on the state of `result_ok`.
16482         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16483         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16484         pub result_ok: bool,
16485 }
16486 #[no_mangle]
16487 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16488 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16489         CResult_TxRemoveInputDecodeErrorZ {
16490                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16491                         result: Box::into_raw(Box::new(o)),
16492                 },
16493                 result_ok: true,
16494         }
16495 }
16496 #[no_mangle]
16497 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16498 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16499         CResult_TxRemoveInputDecodeErrorZ {
16500                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16501                         err: Box::into_raw(Box::new(e)),
16502                 },
16503                 result_ok: false,
16504         }
16505 }
16506 /// Checks if the given object is currently in the success state
16507 #[no_mangle]
16508 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16509         o.result_ok
16510 }
16511 #[no_mangle]
16512 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16513 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16514 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16515         fn drop(&mut self) {
16516                 if self.result_ok {
16517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16519                         }
16520                 } else {
16521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16523                         }
16524                 }
16525         }
16526 }
16527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16529                 let contents = if o.result_ok {
16530                         let result = unsafe { o.contents.result };
16531                         unsafe { o.contents.result = core::ptr::null_mut() };
16532                         CResult_TxRemoveInputDecodeErrorZPtr { result }
16533                 } else {
16534                         let err = unsafe { o.contents.err };
16535                         unsafe { o.contents.err = core::ptr::null_mut(); }
16536                         CResult_TxRemoveInputDecodeErrorZPtr { err }
16537                 };
16538                 Self {
16539                         contents,
16540                         result_ok: o.result_ok,
16541                 }
16542         }
16543 }
16544 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16545         fn clone(&self) -> Self {
16546                 if self.result_ok {
16547                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16548                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16549                         } }
16550                 } else {
16551                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16552                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16553                         } }
16554                 }
16555         }
16556 }
16557 #[no_mangle]
16558 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16559 /// but with all dynamically-allocated buffers duplicated in new buffers.
16560 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16561 #[repr(C)]
16562 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16563 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16564         /// A pointer to the contents in the success state.
16565         /// Reading from this pointer when `result_ok` is not set is undefined.
16566         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16567         /// A pointer to the contents in the error state.
16568         /// Reading from this pointer when `result_ok` is set is undefined.
16569         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16570 }
16571 #[repr(C)]
16572 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16573 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16575 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16576         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16577         /// `err` or `result` depending on the state of `result_ok`.
16578         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16579         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16580         pub result_ok: bool,
16581 }
16582 #[no_mangle]
16583 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16584 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16585         CResult_TxRemoveOutputDecodeErrorZ {
16586                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16587                         result: Box::into_raw(Box::new(o)),
16588                 },
16589                 result_ok: true,
16590         }
16591 }
16592 #[no_mangle]
16593 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16594 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16595         CResult_TxRemoveOutputDecodeErrorZ {
16596                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16597                         err: Box::into_raw(Box::new(e)),
16598                 },
16599                 result_ok: false,
16600         }
16601 }
16602 /// Checks if the given object is currently in the success state
16603 #[no_mangle]
16604 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16605         o.result_ok
16606 }
16607 #[no_mangle]
16608 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16609 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16610 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16611         fn drop(&mut self) {
16612                 if self.result_ok {
16613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16615                         }
16616                 } else {
16617                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16618                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16619                         }
16620                 }
16621         }
16622 }
16623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16624         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16625                 let contents = if o.result_ok {
16626                         let result = unsafe { o.contents.result };
16627                         unsafe { o.contents.result = core::ptr::null_mut() };
16628                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
16629                 } else {
16630                         let err = unsafe { o.contents.err };
16631                         unsafe { o.contents.err = core::ptr::null_mut(); }
16632                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
16633                 };
16634                 Self {
16635                         contents,
16636                         result_ok: o.result_ok,
16637                 }
16638         }
16639 }
16640 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16641         fn clone(&self) -> Self {
16642                 if self.result_ok {
16643                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16644                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16645                         } }
16646                 } else {
16647                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16648                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16649                         } }
16650                 }
16651         }
16652 }
16653 #[no_mangle]
16654 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16655 /// but with all dynamically-allocated buffers duplicated in new buffers.
16656 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16657 #[repr(C)]
16658 /// The contents of CResult_TxCompleteDecodeErrorZ
16659 pub union CResult_TxCompleteDecodeErrorZPtr {
16660         /// A pointer to the contents in the success state.
16661         /// Reading from this pointer when `result_ok` is not set is undefined.
16662         pub result: *mut crate::lightning::ln::msgs::TxComplete,
16663         /// A pointer to the contents in the error state.
16664         /// Reading from this pointer when `result_ok` is set is undefined.
16665         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16666 }
16667 #[repr(C)]
16668 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16669 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16671 pub struct CResult_TxCompleteDecodeErrorZ {
16672         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16673         /// `err` or `result` depending on the state of `result_ok`.
16674         pub contents: CResult_TxCompleteDecodeErrorZPtr,
16675         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16676         pub result_ok: bool,
16677 }
16678 #[no_mangle]
16679 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16680 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16681         CResult_TxCompleteDecodeErrorZ {
16682                 contents: CResult_TxCompleteDecodeErrorZPtr {
16683                         result: Box::into_raw(Box::new(o)),
16684                 },
16685                 result_ok: true,
16686         }
16687 }
16688 #[no_mangle]
16689 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16690 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16691         CResult_TxCompleteDecodeErrorZ {
16692                 contents: CResult_TxCompleteDecodeErrorZPtr {
16693                         err: Box::into_raw(Box::new(e)),
16694                 },
16695                 result_ok: false,
16696         }
16697 }
16698 /// Checks if the given object is currently in the success state
16699 #[no_mangle]
16700 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16701         o.result_ok
16702 }
16703 #[no_mangle]
16704 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16705 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16706 impl Drop for CResult_TxCompleteDecodeErrorZ {
16707         fn drop(&mut self) {
16708                 if self.result_ok {
16709                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16710                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16711                         }
16712                 } else {
16713                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16714                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16715                         }
16716                 }
16717         }
16718 }
16719 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16720         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16721                 let contents = if o.result_ok {
16722                         let result = unsafe { o.contents.result };
16723                         unsafe { o.contents.result = core::ptr::null_mut() };
16724                         CResult_TxCompleteDecodeErrorZPtr { result }
16725                 } else {
16726                         let err = unsafe { o.contents.err };
16727                         unsafe { o.contents.err = core::ptr::null_mut(); }
16728                         CResult_TxCompleteDecodeErrorZPtr { err }
16729                 };
16730                 Self {
16731                         contents,
16732                         result_ok: o.result_ok,
16733                 }
16734         }
16735 }
16736 impl Clone for CResult_TxCompleteDecodeErrorZ {
16737         fn clone(&self) -> Self {
16738                 if self.result_ok {
16739                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
16740                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
16741                         } }
16742                 } else {
16743                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
16744                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16745                         } }
16746                 }
16747         }
16748 }
16749 #[no_mangle]
16750 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
16751 /// but with all dynamically-allocated buffers duplicated in new buffers.
16752 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
16753 #[repr(C)]
16754 /// The contents of CResult_TxSignaturesDecodeErrorZ
16755 pub union CResult_TxSignaturesDecodeErrorZPtr {
16756         /// A pointer to the contents in the success state.
16757         /// Reading from this pointer when `result_ok` is not set is undefined.
16758         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
16759         /// A pointer to the contents in the error state.
16760         /// Reading from this pointer when `result_ok` is set is undefined.
16761         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16762 }
16763 #[repr(C)]
16764 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
16765 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16767 pub struct CResult_TxSignaturesDecodeErrorZ {
16768         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
16769         /// `err` or `result` depending on the state of `result_ok`.
16770         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
16771         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
16772         pub result_ok: bool,
16773 }
16774 #[no_mangle]
16775 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
16776 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
16777         CResult_TxSignaturesDecodeErrorZ {
16778                 contents: CResult_TxSignaturesDecodeErrorZPtr {
16779                         result: Box::into_raw(Box::new(o)),
16780                 },
16781                 result_ok: true,
16782         }
16783 }
16784 #[no_mangle]
16785 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
16786 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
16787         CResult_TxSignaturesDecodeErrorZ {
16788                 contents: CResult_TxSignaturesDecodeErrorZPtr {
16789                         err: Box::into_raw(Box::new(e)),
16790                 },
16791                 result_ok: false,
16792         }
16793 }
16794 /// Checks if the given object is currently in the success state
16795 #[no_mangle]
16796 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
16797         o.result_ok
16798 }
16799 #[no_mangle]
16800 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
16801 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
16802 impl Drop for CResult_TxSignaturesDecodeErrorZ {
16803         fn drop(&mut self) {
16804                 if self.result_ok {
16805                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16806                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16807                         }
16808                 } else {
16809                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16810                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16811                         }
16812                 }
16813         }
16814 }
16815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
16816         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
16817                 let contents = if o.result_ok {
16818                         let result = unsafe { o.contents.result };
16819                         unsafe { o.contents.result = core::ptr::null_mut() };
16820                         CResult_TxSignaturesDecodeErrorZPtr { result }
16821                 } else {
16822                         let err = unsafe { o.contents.err };
16823                         unsafe { o.contents.err = core::ptr::null_mut(); }
16824                         CResult_TxSignaturesDecodeErrorZPtr { err }
16825                 };
16826                 Self {
16827                         contents,
16828                         result_ok: o.result_ok,
16829                 }
16830         }
16831 }
16832 impl Clone for CResult_TxSignaturesDecodeErrorZ {
16833         fn clone(&self) -> Self {
16834                 if self.result_ok {
16835                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
16836                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
16837                         } }
16838                 } else {
16839                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
16840                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16841                         } }
16842                 }
16843         }
16844 }
16845 #[no_mangle]
16846 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
16847 /// but with all dynamically-allocated buffers duplicated in new buffers.
16848 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
16849 #[repr(C)]
16850 /// The contents of CResult_TxInitRbfDecodeErrorZ
16851 pub union CResult_TxInitRbfDecodeErrorZPtr {
16852         /// A pointer to the contents in the success state.
16853         /// Reading from this pointer when `result_ok` is not set is undefined.
16854         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
16855         /// A pointer to the contents in the error state.
16856         /// Reading from this pointer when `result_ok` is set is undefined.
16857         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16858 }
16859 #[repr(C)]
16860 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
16861 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16863 pub struct CResult_TxInitRbfDecodeErrorZ {
16864         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
16865         /// `err` or `result` depending on the state of `result_ok`.
16866         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
16867         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
16868         pub result_ok: bool,
16869 }
16870 #[no_mangle]
16871 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
16872 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
16873         CResult_TxInitRbfDecodeErrorZ {
16874                 contents: CResult_TxInitRbfDecodeErrorZPtr {
16875                         result: Box::into_raw(Box::new(o)),
16876                 },
16877                 result_ok: true,
16878         }
16879 }
16880 #[no_mangle]
16881 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
16882 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
16883         CResult_TxInitRbfDecodeErrorZ {
16884                 contents: CResult_TxInitRbfDecodeErrorZPtr {
16885                         err: Box::into_raw(Box::new(e)),
16886                 },
16887                 result_ok: false,
16888         }
16889 }
16890 /// Checks if the given object is currently in the success state
16891 #[no_mangle]
16892 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
16893         o.result_ok
16894 }
16895 #[no_mangle]
16896 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
16897 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
16898 impl Drop for CResult_TxInitRbfDecodeErrorZ {
16899         fn drop(&mut self) {
16900                 if self.result_ok {
16901                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16902                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16903                         }
16904                 } else {
16905                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16906                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16907                         }
16908                 }
16909         }
16910 }
16911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
16912         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16913                 let contents = if o.result_ok {
16914                         let result = unsafe { o.contents.result };
16915                         unsafe { o.contents.result = core::ptr::null_mut() };
16916                         CResult_TxInitRbfDecodeErrorZPtr { result }
16917                 } else {
16918                         let err = unsafe { o.contents.err };
16919                         unsafe { o.contents.err = core::ptr::null_mut(); }
16920                         CResult_TxInitRbfDecodeErrorZPtr { err }
16921                 };
16922                 Self {
16923                         contents,
16924                         result_ok: o.result_ok,
16925                 }
16926         }
16927 }
16928 impl Clone for CResult_TxInitRbfDecodeErrorZ {
16929         fn clone(&self) -> Self {
16930                 if self.result_ok {
16931                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
16932                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
16933                         } }
16934                 } else {
16935                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
16936                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16937                         } }
16938                 }
16939         }
16940 }
16941 #[no_mangle]
16942 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
16943 /// but with all dynamically-allocated buffers duplicated in new buffers.
16944 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
16945 #[repr(C)]
16946 /// The contents of CResult_TxAckRbfDecodeErrorZ
16947 pub union CResult_TxAckRbfDecodeErrorZPtr {
16948         /// A pointer to the contents in the success state.
16949         /// Reading from this pointer when `result_ok` is not set is undefined.
16950         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
16951         /// A pointer to the contents in the error state.
16952         /// Reading from this pointer when `result_ok` is set is undefined.
16953         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16954 }
16955 #[repr(C)]
16956 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
16957 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16959 pub struct CResult_TxAckRbfDecodeErrorZ {
16960         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
16961         /// `err` or `result` depending on the state of `result_ok`.
16962         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
16963         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
16964         pub result_ok: bool,
16965 }
16966 #[no_mangle]
16967 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
16968 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
16969         CResult_TxAckRbfDecodeErrorZ {
16970                 contents: CResult_TxAckRbfDecodeErrorZPtr {
16971                         result: Box::into_raw(Box::new(o)),
16972                 },
16973                 result_ok: true,
16974         }
16975 }
16976 #[no_mangle]
16977 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
16978 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
16979         CResult_TxAckRbfDecodeErrorZ {
16980                 contents: CResult_TxAckRbfDecodeErrorZPtr {
16981                         err: Box::into_raw(Box::new(e)),
16982                 },
16983                 result_ok: false,
16984         }
16985 }
16986 /// Checks if the given object is currently in the success state
16987 #[no_mangle]
16988 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
16989         o.result_ok
16990 }
16991 #[no_mangle]
16992 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
16993 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
16994 impl Drop for CResult_TxAckRbfDecodeErrorZ {
16995         fn drop(&mut self) {
16996                 if self.result_ok {
16997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16999                         }
17000                 } else {
17001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17003                         }
17004                 }
17005         }
17006 }
17007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
17008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17009                 let contents = if o.result_ok {
17010                         let result = unsafe { o.contents.result };
17011                         unsafe { o.contents.result = core::ptr::null_mut() };
17012                         CResult_TxAckRbfDecodeErrorZPtr { result }
17013                 } else {
17014                         let err = unsafe { o.contents.err };
17015                         unsafe { o.contents.err = core::ptr::null_mut(); }
17016                         CResult_TxAckRbfDecodeErrorZPtr { err }
17017                 };
17018                 Self {
17019                         contents,
17020                         result_ok: o.result_ok,
17021                 }
17022         }
17023 }
17024 impl Clone for CResult_TxAckRbfDecodeErrorZ {
17025         fn clone(&self) -> Self {
17026                 if self.result_ok {
17027                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
17028                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
17029                         } }
17030                 } else {
17031                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
17032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17033                         } }
17034                 }
17035         }
17036 }
17037 #[no_mangle]
17038 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
17039 /// but with all dynamically-allocated buffers duplicated in new buffers.
17040 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
17041 #[repr(C)]
17042 /// The contents of CResult_TxAbortDecodeErrorZ
17043 pub union CResult_TxAbortDecodeErrorZPtr {
17044         /// A pointer to the contents in the success state.
17045         /// Reading from this pointer when `result_ok` is not set is undefined.
17046         pub result: *mut crate::lightning::ln::msgs::TxAbort,
17047         /// A pointer to the contents in the error state.
17048         /// Reading from this pointer when `result_ok` is set is undefined.
17049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17050 }
17051 #[repr(C)]
17052 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
17053 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
17054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17055 pub struct CResult_TxAbortDecodeErrorZ {
17056         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
17057         /// `err` or `result` depending on the state of `result_ok`.
17058         pub contents: CResult_TxAbortDecodeErrorZPtr,
17059         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
17060         pub result_ok: bool,
17061 }
17062 #[no_mangle]
17063 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
17064 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
17065         CResult_TxAbortDecodeErrorZ {
17066                 contents: CResult_TxAbortDecodeErrorZPtr {
17067                         result: Box::into_raw(Box::new(o)),
17068                 },
17069                 result_ok: true,
17070         }
17071 }
17072 #[no_mangle]
17073 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
17074 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
17075         CResult_TxAbortDecodeErrorZ {
17076                 contents: CResult_TxAbortDecodeErrorZPtr {
17077                         err: Box::into_raw(Box::new(e)),
17078                 },
17079                 result_ok: false,
17080         }
17081 }
17082 /// Checks if the given object is currently in the success state
17083 #[no_mangle]
17084 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
17085         o.result_ok
17086 }
17087 #[no_mangle]
17088 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
17089 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
17090 impl Drop for CResult_TxAbortDecodeErrorZ {
17091         fn drop(&mut self) {
17092                 if self.result_ok {
17093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17095                         }
17096                 } else {
17097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17099                         }
17100                 }
17101         }
17102 }
17103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
17104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
17105                 let contents = if o.result_ok {
17106                         let result = unsafe { o.contents.result };
17107                         unsafe { o.contents.result = core::ptr::null_mut() };
17108                         CResult_TxAbortDecodeErrorZPtr { result }
17109                 } else {
17110                         let err = unsafe { o.contents.err };
17111                         unsafe { o.contents.err = core::ptr::null_mut(); }
17112                         CResult_TxAbortDecodeErrorZPtr { err }
17113                 };
17114                 Self {
17115                         contents,
17116                         result_ok: o.result_ok,
17117                 }
17118         }
17119 }
17120 impl Clone for CResult_TxAbortDecodeErrorZ {
17121         fn clone(&self) -> Self {
17122                 if self.result_ok {
17123                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
17124                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
17125                         } }
17126                 } else {
17127                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
17128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17129                         } }
17130                 }
17131         }
17132 }
17133 #[no_mangle]
17134 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
17135 /// but with all dynamically-allocated buffers duplicated in new buffers.
17136 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
17137 #[repr(C)]
17138 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
17139 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
17140         /// A pointer to the contents in the success state.
17141         /// Reading from this pointer when `result_ok` is not set is undefined.
17142         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
17143         /// A pointer to the contents in the error state.
17144         /// Reading from this pointer when `result_ok` is set is undefined.
17145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17146 }
17147 #[repr(C)]
17148 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
17149 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17151 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
17152         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
17153         /// `err` or `result` depending on the state of `result_ok`.
17154         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
17155         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
17156         pub result_ok: bool,
17157 }
17158 #[no_mangle]
17159 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17161         CResult_AnnouncementSignaturesDecodeErrorZ {
17162                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17163                         result: Box::into_raw(Box::new(o)),
17164                 },
17165                 result_ok: true,
17166         }
17167 }
17168 #[no_mangle]
17169 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17170 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17171         CResult_AnnouncementSignaturesDecodeErrorZ {
17172                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17173                         err: Box::into_raw(Box::new(e)),
17174                 },
17175                 result_ok: false,
17176         }
17177 }
17178 /// Checks if the given object is currently in the success state
17179 #[no_mangle]
17180 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17181         o.result_ok
17182 }
17183 #[no_mangle]
17184 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17185 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17186 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17187         fn drop(&mut self) {
17188                 if self.result_ok {
17189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17191                         }
17192                 } else {
17193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17195                         }
17196                 }
17197         }
17198 }
17199 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17200         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17201                 let contents = if o.result_ok {
17202                         let result = unsafe { o.contents.result };
17203                         unsafe { o.contents.result = core::ptr::null_mut() };
17204                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17205                 } else {
17206                         let err = unsafe { o.contents.err };
17207                         unsafe { o.contents.err = core::ptr::null_mut(); }
17208                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17209                 };
17210                 Self {
17211                         contents,
17212                         result_ok: o.result_ok,
17213                 }
17214         }
17215 }
17216 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17217         fn clone(&self) -> Self {
17218                 if self.result_ok {
17219                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17220                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17221                         } }
17222                 } else {
17223                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17224                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17225                         } }
17226                 }
17227         }
17228 }
17229 #[no_mangle]
17230 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17231 /// but with all dynamically-allocated buffers duplicated in new buffers.
17232 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17233 #[repr(C)]
17234 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17235 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17236         /// A pointer to the contents in the success state.
17237         /// Reading from this pointer when `result_ok` is not set is undefined.
17238         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17239         /// A pointer to the contents in the error state.
17240         /// Reading from this pointer when `result_ok` is set is undefined.
17241         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17242 }
17243 #[repr(C)]
17244 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17245 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17247 pub struct CResult_ChannelReestablishDecodeErrorZ {
17248         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17249         /// `err` or `result` depending on the state of `result_ok`.
17250         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17251         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17252         pub result_ok: bool,
17253 }
17254 #[no_mangle]
17255 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17257         CResult_ChannelReestablishDecodeErrorZ {
17258                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17259                         result: Box::into_raw(Box::new(o)),
17260                 },
17261                 result_ok: true,
17262         }
17263 }
17264 #[no_mangle]
17265 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17266 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17267         CResult_ChannelReestablishDecodeErrorZ {
17268                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17269                         err: Box::into_raw(Box::new(e)),
17270                 },
17271                 result_ok: false,
17272         }
17273 }
17274 /// Checks if the given object is currently in the success state
17275 #[no_mangle]
17276 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17277         o.result_ok
17278 }
17279 #[no_mangle]
17280 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17281 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17282 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17283         fn drop(&mut self) {
17284                 if self.result_ok {
17285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17287                         }
17288                 } else {
17289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17291                         }
17292                 }
17293         }
17294 }
17295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17296         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17297                 let contents = if o.result_ok {
17298                         let result = unsafe { o.contents.result };
17299                         unsafe { o.contents.result = core::ptr::null_mut() };
17300                         CResult_ChannelReestablishDecodeErrorZPtr { result }
17301                 } else {
17302                         let err = unsafe { o.contents.err };
17303                         unsafe { o.contents.err = core::ptr::null_mut(); }
17304                         CResult_ChannelReestablishDecodeErrorZPtr { err }
17305                 };
17306                 Self {
17307                         contents,
17308                         result_ok: o.result_ok,
17309                 }
17310         }
17311 }
17312 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17313         fn clone(&self) -> Self {
17314                 if self.result_ok {
17315                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17316                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17317                         } }
17318                 } else {
17319                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17320                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17321                         } }
17322                 }
17323         }
17324 }
17325 #[no_mangle]
17326 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17327 /// but with all dynamically-allocated buffers duplicated in new buffers.
17328 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17329 #[repr(C)]
17330 /// The contents of CResult_ClosingSignedDecodeErrorZ
17331 pub union CResult_ClosingSignedDecodeErrorZPtr {
17332         /// A pointer to the contents in the success state.
17333         /// Reading from this pointer when `result_ok` is not set is undefined.
17334         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17335         /// A pointer to the contents in the error state.
17336         /// Reading from this pointer when `result_ok` is set is undefined.
17337         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17338 }
17339 #[repr(C)]
17340 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17341 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17343 pub struct CResult_ClosingSignedDecodeErrorZ {
17344         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17345         /// `err` or `result` depending on the state of `result_ok`.
17346         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17347         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17348         pub result_ok: bool,
17349 }
17350 #[no_mangle]
17351 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17353         CResult_ClosingSignedDecodeErrorZ {
17354                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17355                         result: Box::into_raw(Box::new(o)),
17356                 },
17357                 result_ok: true,
17358         }
17359 }
17360 #[no_mangle]
17361 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17362 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17363         CResult_ClosingSignedDecodeErrorZ {
17364                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17365                         err: Box::into_raw(Box::new(e)),
17366                 },
17367                 result_ok: false,
17368         }
17369 }
17370 /// Checks if the given object is currently in the success state
17371 #[no_mangle]
17372 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17373         o.result_ok
17374 }
17375 #[no_mangle]
17376 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17377 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17378 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17379         fn drop(&mut self) {
17380                 if self.result_ok {
17381                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17382                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17383                         }
17384                 } else {
17385                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17386                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17387                         }
17388                 }
17389         }
17390 }
17391 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17392         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17393                 let contents = if o.result_ok {
17394                         let result = unsafe { o.contents.result };
17395                         unsafe { o.contents.result = core::ptr::null_mut() };
17396                         CResult_ClosingSignedDecodeErrorZPtr { result }
17397                 } else {
17398                         let err = unsafe { o.contents.err };
17399                         unsafe { o.contents.err = core::ptr::null_mut(); }
17400                         CResult_ClosingSignedDecodeErrorZPtr { err }
17401                 };
17402                 Self {
17403                         contents,
17404                         result_ok: o.result_ok,
17405                 }
17406         }
17407 }
17408 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17409         fn clone(&self) -> Self {
17410                 if self.result_ok {
17411                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17412                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17413                         } }
17414                 } else {
17415                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17416                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17417                         } }
17418                 }
17419         }
17420 }
17421 #[no_mangle]
17422 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17423 /// but with all dynamically-allocated buffers duplicated in new buffers.
17424 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17425 #[repr(C)]
17426 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17427 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17428         /// A pointer to the contents in the success state.
17429         /// Reading from this pointer when `result_ok` is not set is undefined.
17430         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17431         /// A pointer to the contents in the error state.
17432         /// Reading from this pointer when `result_ok` is set is undefined.
17433         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17434 }
17435 #[repr(C)]
17436 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17437 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17438 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17439 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17440         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17441         /// `err` or `result` depending on the state of `result_ok`.
17442         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17443         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17444         pub result_ok: bool,
17445 }
17446 #[no_mangle]
17447 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17449         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17450                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17451                         result: Box::into_raw(Box::new(o)),
17452                 },
17453                 result_ok: true,
17454         }
17455 }
17456 #[no_mangle]
17457 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17458 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17459         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17460                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17461                         err: Box::into_raw(Box::new(e)),
17462                 },
17463                 result_ok: false,
17464         }
17465 }
17466 /// Checks if the given object is currently in the success state
17467 #[no_mangle]
17468 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17469         o.result_ok
17470 }
17471 #[no_mangle]
17472 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17473 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17474 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17475         fn drop(&mut self) {
17476                 if self.result_ok {
17477                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17478                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17479                         }
17480                 } else {
17481                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17482                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17483                         }
17484                 }
17485         }
17486 }
17487 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17488         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17489                 let contents = if o.result_ok {
17490                         let result = unsafe { o.contents.result };
17491                         unsafe { o.contents.result = core::ptr::null_mut() };
17492                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17493                 } else {
17494                         let err = unsafe { o.contents.err };
17495                         unsafe { o.contents.err = core::ptr::null_mut(); }
17496                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17497                 };
17498                 Self {
17499                         contents,
17500                         result_ok: o.result_ok,
17501                 }
17502         }
17503 }
17504 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17505         fn clone(&self) -> Self {
17506                 if self.result_ok {
17507                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17508                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17509                         } }
17510                 } else {
17511                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17512                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17513                         } }
17514                 }
17515         }
17516 }
17517 #[no_mangle]
17518 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17519 /// but with all dynamically-allocated buffers duplicated in new buffers.
17520 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17521 #[repr(C)]
17522 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17523 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17524         /// A pointer to the contents in the success state.
17525         /// Reading from this pointer when `result_ok` is not set is undefined.
17526         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17527         /// A pointer to the contents in the error state.
17528         /// Reading from this pointer when `result_ok` is set is undefined.
17529         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17530 }
17531 #[repr(C)]
17532 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17533 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17535 pub struct CResult_CommitmentSignedDecodeErrorZ {
17536         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17537         /// `err` or `result` depending on the state of `result_ok`.
17538         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17539         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17540         pub result_ok: bool,
17541 }
17542 #[no_mangle]
17543 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17545         CResult_CommitmentSignedDecodeErrorZ {
17546                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17547                         result: Box::into_raw(Box::new(o)),
17548                 },
17549                 result_ok: true,
17550         }
17551 }
17552 #[no_mangle]
17553 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17554 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17555         CResult_CommitmentSignedDecodeErrorZ {
17556                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17557                         err: Box::into_raw(Box::new(e)),
17558                 },
17559                 result_ok: false,
17560         }
17561 }
17562 /// Checks if the given object is currently in the success state
17563 #[no_mangle]
17564 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17565         o.result_ok
17566 }
17567 #[no_mangle]
17568 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17569 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17570 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17571         fn drop(&mut self) {
17572                 if self.result_ok {
17573                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17574                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17575                         }
17576                 } else {
17577                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17578                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17579                         }
17580                 }
17581         }
17582 }
17583 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17584         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17585                 let contents = if o.result_ok {
17586                         let result = unsafe { o.contents.result };
17587                         unsafe { o.contents.result = core::ptr::null_mut() };
17588                         CResult_CommitmentSignedDecodeErrorZPtr { result }
17589                 } else {
17590                         let err = unsafe { o.contents.err };
17591                         unsafe { o.contents.err = core::ptr::null_mut(); }
17592                         CResult_CommitmentSignedDecodeErrorZPtr { err }
17593                 };
17594                 Self {
17595                         contents,
17596                         result_ok: o.result_ok,
17597                 }
17598         }
17599 }
17600 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17601         fn clone(&self) -> Self {
17602                 if self.result_ok {
17603                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17604                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17605                         } }
17606                 } else {
17607                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17608                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17609                         } }
17610                 }
17611         }
17612 }
17613 #[no_mangle]
17614 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17615 /// but with all dynamically-allocated buffers duplicated in new buffers.
17616 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17617 #[repr(C)]
17618 /// The contents of CResult_FundingCreatedDecodeErrorZ
17619 pub union CResult_FundingCreatedDecodeErrorZPtr {
17620         /// A pointer to the contents in the success state.
17621         /// Reading from this pointer when `result_ok` is not set is undefined.
17622         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17623         /// A pointer to the contents in the error state.
17624         /// Reading from this pointer when `result_ok` is set is undefined.
17625         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17626 }
17627 #[repr(C)]
17628 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17629 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17631 pub struct CResult_FundingCreatedDecodeErrorZ {
17632         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17633         /// `err` or `result` depending on the state of `result_ok`.
17634         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17635         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17636         pub result_ok: bool,
17637 }
17638 #[no_mangle]
17639 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17641         CResult_FundingCreatedDecodeErrorZ {
17642                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17643                         result: Box::into_raw(Box::new(o)),
17644                 },
17645                 result_ok: true,
17646         }
17647 }
17648 #[no_mangle]
17649 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17650 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17651         CResult_FundingCreatedDecodeErrorZ {
17652                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17653                         err: Box::into_raw(Box::new(e)),
17654                 },
17655                 result_ok: false,
17656         }
17657 }
17658 /// Checks if the given object is currently in the success state
17659 #[no_mangle]
17660 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17661         o.result_ok
17662 }
17663 #[no_mangle]
17664 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17665 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17666 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17667         fn drop(&mut self) {
17668                 if self.result_ok {
17669                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17670                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17671                         }
17672                 } else {
17673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17675                         }
17676                 }
17677         }
17678 }
17679 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17680         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17681                 let contents = if o.result_ok {
17682                         let result = unsafe { o.contents.result };
17683                         unsafe { o.contents.result = core::ptr::null_mut() };
17684                         CResult_FundingCreatedDecodeErrorZPtr { result }
17685                 } else {
17686                         let err = unsafe { o.contents.err };
17687                         unsafe { o.contents.err = core::ptr::null_mut(); }
17688                         CResult_FundingCreatedDecodeErrorZPtr { err }
17689                 };
17690                 Self {
17691                         contents,
17692                         result_ok: o.result_ok,
17693                 }
17694         }
17695 }
17696 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17697         fn clone(&self) -> Self {
17698                 if self.result_ok {
17699                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17700                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17701                         } }
17702                 } else {
17703                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17704                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17705                         } }
17706                 }
17707         }
17708 }
17709 #[no_mangle]
17710 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17711 /// but with all dynamically-allocated buffers duplicated in new buffers.
17712 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17713 #[repr(C)]
17714 /// The contents of CResult_FundingSignedDecodeErrorZ
17715 pub union CResult_FundingSignedDecodeErrorZPtr {
17716         /// A pointer to the contents in the success state.
17717         /// Reading from this pointer when `result_ok` is not set is undefined.
17718         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17719         /// A pointer to the contents in the error state.
17720         /// Reading from this pointer when `result_ok` is set is undefined.
17721         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17722 }
17723 #[repr(C)]
17724 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17725 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17727 pub struct CResult_FundingSignedDecodeErrorZ {
17728         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17729         /// `err` or `result` depending on the state of `result_ok`.
17730         pub contents: CResult_FundingSignedDecodeErrorZPtr,
17731         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17732         pub result_ok: bool,
17733 }
17734 #[no_mangle]
17735 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17737         CResult_FundingSignedDecodeErrorZ {
17738                 contents: CResult_FundingSignedDecodeErrorZPtr {
17739                         result: Box::into_raw(Box::new(o)),
17740                 },
17741                 result_ok: true,
17742         }
17743 }
17744 #[no_mangle]
17745 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17746 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
17747         CResult_FundingSignedDecodeErrorZ {
17748                 contents: CResult_FundingSignedDecodeErrorZPtr {
17749                         err: Box::into_raw(Box::new(e)),
17750                 },
17751                 result_ok: false,
17752         }
17753 }
17754 /// Checks if the given object is currently in the success state
17755 #[no_mangle]
17756 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
17757         o.result_ok
17758 }
17759 #[no_mangle]
17760 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17761 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
17762 impl Drop for CResult_FundingSignedDecodeErrorZ {
17763         fn drop(&mut self) {
17764                 if self.result_ok {
17765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17767                         }
17768                 } else {
17769                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17770                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17771                         }
17772                 }
17773         }
17774 }
17775 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
17776         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17777                 let contents = if o.result_ok {
17778                         let result = unsafe { o.contents.result };
17779                         unsafe { o.contents.result = core::ptr::null_mut() };
17780                         CResult_FundingSignedDecodeErrorZPtr { result }
17781                 } else {
17782                         let err = unsafe { o.contents.err };
17783                         unsafe { o.contents.err = core::ptr::null_mut(); }
17784                         CResult_FundingSignedDecodeErrorZPtr { err }
17785                 };
17786                 Self {
17787                         contents,
17788                         result_ok: o.result_ok,
17789                 }
17790         }
17791 }
17792 impl Clone for CResult_FundingSignedDecodeErrorZ {
17793         fn clone(&self) -> Self {
17794                 if self.result_ok {
17795                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
17796                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
17797                         } }
17798                 } else {
17799                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
17800                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17801                         } }
17802                 }
17803         }
17804 }
17805 #[no_mangle]
17806 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17807 /// but with all dynamically-allocated buffers duplicated in new buffers.
17808 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
17809 #[repr(C)]
17810 /// The contents of CResult_ChannelReadyDecodeErrorZ
17811 pub union CResult_ChannelReadyDecodeErrorZPtr {
17812         /// A pointer to the contents in the success state.
17813         /// Reading from this pointer when `result_ok` is not set is undefined.
17814         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
17815         /// A pointer to the contents in the error state.
17816         /// Reading from this pointer when `result_ok` is set is undefined.
17817         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17818 }
17819 #[repr(C)]
17820 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
17821 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
17822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17823 pub struct CResult_ChannelReadyDecodeErrorZ {
17824         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
17825         /// `err` or `result` depending on the state of `result_ok`.
17826         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
17827         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
17828         pub result_ok: bool,
17829 }
17830 #[no_mangle]
17831 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17832 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
17833         CResult_ChannelReadyDecodeErrorZ {
17834                 contents: CResult_ChannelReadyDecodeErrorZPtr {
17835                         result: Box::into_raw(Box::new(o)),
17836                 },
17837                 result_ok: true,
17838         }
17839 }
17840 #[no_mangle]
17841 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17842 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
17843         CResult_ChannelReadyDecodeErrorZ {
17844                 contents: CResult_ChannelReadyDecodeErrorZPtr {
17845                         err: Box::into_raw(Box::new(e)),
17846                 },
17847                 result_ok: false,
17848         }
17849 }
17850 /// Checks if the given object is currently in the success state
17851 #[no_mangle]
17852 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
17853         o.result_ok
17854 }
17855 #[no_mangle]
17856 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17857 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
17858 impl Drop for CResult_ChannelReadyDecodeErrorZ {
17859         fn drop(&mut self) {
17860                 if self.result_ok {
17861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17863                         }
17864                 } else {
17865                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17866                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17867                         }
17868                 }
17869         }
17870 }
17871 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
17872         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
17873                 let contents = if o.result_ok {
17874                         let result = unsafe { o.contents.result };
17875                         unsafe { o.contents.result = core::ptr::null_mut() };
17876                         CResult_ChannelReadyDecodeErrorZPtr { result }
17877                 } else {
17878                         let err = unsafe { o.contents.err };
17879                         unsafe { o.contents.err = core::ptr::null_mut(); }
17880                         CResult_ChannelReadyDecodeErrorZPtr { err }
17881                 };
17882                 Self {
17883                         contents,
17884                         result_ok: o.result_ok,
17885                 }
17886         }
17887 }
17888 impl Clone for CResult_ChannelReadyDecodeErrorZ {
17889         fn clone(&self) -> Self {
17890                 if self.result_ok {
17891                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
17892                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
17893                         } }
17894                 } else {
17895                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
17896                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17897                         } }
17898                 }
17899         }
17900 }
17901 #[no_mangle]
17902 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17903 /// but with all dynamically-allocated buffers duplicated in new buffers.
17904 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
17905 #[repr(C)]
17906 /// The contents of CResult_InitDecodeErrorZ
17907 pub union CResult_InitDecodeErrorZPtr {
17908         /// A pointer to the contents in the success state.
17909         /// Reading from this pointer when `result_ok` is not set is undefined.
17910         pub result: *mut crate::lightning::ln::msgs::Init,
17911         /// A pointer to the contents in the error state.
17912         /// Reading from this pointer when `result_ok` is set is undefined.
17913         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17914 }
17915 #[repr(C)]
17916 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
17917 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
17918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17919 pub struct CResult_InitDecodeErrorZ {
17920         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
17921         /// `err` or `result` depending on the state of `result_ok`.
17922         pub contents: CResult_InitDecodeErrorZPtr,
17923         /// Whether this CResult_InitDecodeErrorZ represents a success state.
17924         pub result_ok: bool,
17925 }
17926 #[no_mangle]
17927 /// Creates a new CResult_InitDecodeErrorZ in the success state.
17928 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
17929         CResult_InitDecodeErrorZ {
17930                 contents: CResult_InitDecodeErrorZPtr {
17931                         result: Box::into_raw(Box::new(o)),
17932                 },
17933                 result_ok: true,
17934         }
17935 }
17936 #[no_mangle]
17937 /// Creates a new CResult_InitDecodeErrorZ in the error state.
17938 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
17939         CResult_InitDecodeErrorZ {
17940                 contents: CResult_InitDecodeErrorZPtr {
17941                         err: Box::into_raw(Box::new(e)),
17942                 },
17943                 result_ok: false,
17944         }
17945 }
17946 /// Checks if the given object is currently in the success state
17947 #[no_mangle]
17948 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
17949         o.result_ok
17950 }
17951 #[no_mangle]
17952 /// Frees any resources used by the CResult_InitDecodeErrorZ.
17953 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
17954 impl Drop for CResult_InitDecodeErrorZ {
17955         fn drop(&mut self) {
17956                 if self.result_ok {
17957                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17958                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17959                         }
17960                 } else {
17961                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17962                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17963                         }
17964                 }
17965         }
17966 }
17967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
17968         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
17969                 let contents = if o.result_ok {
17970                         let result = unsafe { o.contents.result };
17971                         unsafe { o.contents.result = core::ptr::null_mut() };
17972                         CResult_InitDecodeErrorZPtr { result }
17973                 } else {
17974                         let err = unsafe { o.contents.err };
17975                         unsafe { o.contents.err = core::ptr::null_mut(); }
17976                         CResult_InitDecodeErrorZPtr { err }
17977                 };
17978                 Self {
17979                         contents,
17980                         result_ok: o.result_ok,
17981                 }
17982         }
17983 }
17984 impl Clone for CResult_InitDecodeErrorZ {
17985         fn clone(&self) -> Self {
17986                 if self.result_ok {
17987                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
17988                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
17989                         } }
17990                 } else {
17991                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
17992                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17993                         } }
17994                 }
17995         }
17996 }
17997 #[no_mangle]
17998 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17999 /// but with all dynamically-allocated buffers duplicated in new buffers.
18000 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
18001 #[repr(C)]
18002 /// The contents of CResult_OpenChannelDecodeErrorZ
18003 pub union CResult_OpenChannelDecodeErrorZPtr {
18004         /// A pointer to the contents in the success state.
18005         /// Reading from this pointer when `result_ok` is not set is undefined.
18006         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
18007         /// A pointer to the contents in the error state.
18008         /// Reading from this pointer when `result_ok` is set is undefined.
18009         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18010 }
18011 #[repr(C)]
18012 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
18013 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
18014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18015 pub struct CResult_OpenChannelDecodeErrorZ {
18016         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
18017         /// `err` or `result` depending on the state of `result_ok`.
18018         pub contents: CResult_OpenChannelDecodeErrorZPtr,
18019         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
18020         pub result_ok: bool,
18021 }
18022 #[no_mangle]
18023 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
18024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
18025         CResult_OpenChannelDecodeErrorZ {
18026                 contents: CResult_OpenChannelDecodeErrorZPtr {
18027                         result: Box::into_raw(Box::new(o)),
18028                 },
18029                 result_ok: true,
18030         }
18031 }
18032 #[no_mangle]
18033 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
18034 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
18035         CResult_OpenChannelDecodeErrorZ {
18036                 contents: CResult_OpenChannelDecodeErrorZPtr {
18037                         err: Box::into_raw(Box::new(e)),
18038                 },
18039                 result_ok: false,
18040         }
18041 }
18042 /// Checks if the given object is currently in the success state
18043 #[no_mangle]
18044 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
18045         o.result_ok
18046 }
18047 #[no_mangle]
18048 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
18049 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
18050 impl Drop for CResult_OpenChannelDecodeErrorZ {
18051         fn drop(&mut self) {
18052                 if self.result_ok {
18053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18055                         }
18056                 } else {
18057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18059                         }
18060                 }
18061         }
18062 }
18063 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
18064         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
18065                 let contents = if o.result_ok {
18066                         let result = unsafe { o.contents.result };
18067                         unsafe { o.contents.result = core::ptr::null_mut() };
18068                         CResult_OpenChannelDecodeErrorZPtr { result }
18069                 } else {
18070                         let err = unsafe { o.contents.err };
18071                         unsafe { o.contents.err = core::ptr::null_mut(); }
18072                         CResult_OpenChannelDecodeErrorZPtr { err }
18073                 };
18074                 Self {
18075                         contents,
18076                         result_ok: o.result_ok,
18077                 }
18078         }
18079 }
18080 impl Clone for CResult_OpenChannelDecodeErrorZ {
18081         fn clone(&self) -> Self {
18082                 if self.result_ok {
18083                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
18084                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
18085                         } }
18086                 } else {
18087                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
18088                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18089                         } }
18090                 }
18091         }
18092 }
18093 #[no_mangle]
18094 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
18095 /// but with all dynamically-allocated buffers duplicated in new buffers.
18096 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
18097 #[repr(C)]
18098 /// The contents of CResult_OpenChannelV2DecodeErrorZ
18099 pub union CResult_OpenChannelV2DecodeErrorZPtr {
18100         /// A pointer to the contents in the success state.
18101         /// Reading from this pointer when `result_ok` is not set is undefined.
18102         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
18103         /// A pointer to the contents in the error state.
18104         /// Reading from this pointer when `result_ok` is set is undefined.
18105         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18106 }
18107 #[repr(C)]
18108 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
18109 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
18110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18111 pub struct CResult_OpenChannelV2DecodeErrorZ {
18112         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
18113         /// `err` or `result` depending on the state of `result_ok`.
18114         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
18115         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
18116         pub result_ok: bool,
18117 }
18118 #[no_mangle]
18119 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
18120 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
18121         CResult_OpenChannelV2DecodeErrorZ {
18122                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18123                         result: Box::into_raw(Box::new(o)),
18124                 },
18125                 result_ok: true,
18126         }
18127 }
18128 #[no_mangle]
18129 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
18130 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
18131         CResult_OpenChannelV2DecodeErrorZ {
18132                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18133                         err: Box::into_raw(Box::new(e)),
18134                 },
18135                 result_ok: false,
18136         }
18137 }
18138 /// Checks if the given object is currently in the success state
18139 #[no_mangle]
18140 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
18141         o.result_ok
18142 }
18143 #[no_mangle]
18144 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
18145 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
18146 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
18147         fn drop(&mut self) {
18148                 if self.result_ok {
18149                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18150                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18151                         }
18152                 } else {
18153                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18154                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18155                         }
18156                 }
18157         }
18158 }
18159 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
18160         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18161                 let contents = if o.result_ok {
18162                         let result = unsafe { o.contents.result };
18163                         unsafe { o.contents.result = core::ptr::null_mut() };
18164                         CResult_OpenChannelV2DecodeErrorZPtr { result }
18165                 } else {
18166                         let err = unsafe { o.contents.err };
18167                         unsafe { o.contents.err = core::ptr::null_mut(); }
18168                         CResult_OpenChannelV2DecodeErrorZPtr { err }
18169                 };
18170                 Self {
18171                         contents,
18172                         result_ok: o.result_ok,
18173                 }
18174         }
18175 }
18176 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18177         fn clone(&self) -> Self {
18178                 if self.result_ok {
18179                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18180                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18181                         } }
18182                 } else {
18183                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18184                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18185                         } }
18186                 }
18187         }
18188 }
18189 #[no_mangle]
18190 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18191 /// but with all dynamically-allocated buffers duplicated in new buffers.
18192 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18193 #[repr(C)]
18194 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18195 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18196         /// A pointer to the contents in the success state.
18197         /// Reading from this pointer when `result_ok` is not set is undefined.
18198         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18199         /// A pointer to the contents in the error state.
18200         /// Reading from this pointer when `result_ok` is set is undefined.
18201         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18202 }
18203 #[repr(C)]
18204 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18205 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18207 pub struct CResult_RevokeAndACKDecodeErrorZ {
18208         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18209         /// `err` or `result` depending on the state of `result_ok`.
18210         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18211         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18212         pub result_ok: bool,
18213 }
18214 #[no_mangle]
18215 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18216 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18217         CResult_RevokeAndACKDecodeErrorZ {
18218                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18219                         result: Box::into_raw(Box::new(o)),
18220                 },
18221                 result_ok: true,
18222         }
18223 }
18224 #[no_mangle]
18225 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18226 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18227         CResult_RevokeAndACKDecodeErrorZ {
18228                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18229                         err: Box::into_raw(Box::new(e)),
18230                 },
18231                 result_ok: false,
18232         }
18233 }
18234 /// Checks if the given object is currently in the success state
18235 #[no_mangle]
18236 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18237         o.result_ok
18238 }
18239 #[no_mangle]
18240 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18241 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18242 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18243         fn drop(&mut self) {
18244                 if self.result_ok {
18245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18247                         }
18248                 } else {
18249                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18250                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18251                         }
18252                 }
18253         }
18254 }
18255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18256         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18257                 let contents = if o.result_ok {
18258                         let result = unsafe { o.contents.result };
18259                         unsafe { o.contents.result = core::ptr::null_mut() };
18260                         CResult_RevokeAndACKDecodeErrorZPtr { result }
18261                 } else {
18262                         let err = unsafe { o.contents.err };
18263                         unsafe { o.contents.err = core::ptr::null_mut(); }
18264                         CResult_RevokeAndACKDecodeErrorZPtr { err }
18265                 };
18266                 Self {
18267                         contents,
18268                         result_ok: o.result_ok,
18269                 }
18270         }
18271 }
18272 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18273         fn clone(&self) -> Self {
18274                 if self.result_ok {
18275                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18276                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18277                         } }
18278                 } else {
18279                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18280                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18281                         } }
18282                 }
18283         }
18284 }
18285 #[no_mangle]
18286 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18287 /// but with all dynamically-allocated buffers duplicated in new buffers.
18288 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18289 #[repr(C)]
18290 /// The contents of CResult_ShutdownDecodeErrorZ
18291 pub union CResult_ShutdownDecodeErrorZPtr {
18292         /// A pointer to the contents in the success state.
18293         /// Reading from this pointer when `result_ok` is not set is undefined.
18294         pub result: *mut crate::lightning::ln::msgs::Shutdown,
18295         /// A pointer to the contents in the error state.
18296         /// Reading from this pointer when `result_ok` is set is undefined.
18297         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18298 }
18299 #[repr(C)]
18300 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18301 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18303 pub struct CResult_ShutdownDecodeErrorZ {
18304         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18305         /// `err` or `result` depending on the state of `result_ok`.
18306         pub contents: CResult_ShutdownDecodeErrorZPtr,
18307         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18308         pub result_ok: bool,
18309 }
18310 #[no_mangle]
18311 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18312 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18313         CResult_ShutdownDecodeErrorZ {
18314                 contents: CResult_ShutdownDecodeErrorZPtr {
18315                         result: Box::into_raw(Box::new(o)),
18316                 },
18317                 result_ok: true,
18318         }
18319 }
18320 #[no_mangle]
18321 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18322 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18323         CResult_ShutdownDecodeErrorZ {
18324                 contents: CResult_ShutdownDecodeErrorZPtr {
18325                         err: Box::into_raw(Box::new(e)),
18326                 },
18327                 result_ok: false,
18328         }
18329 }
18330 /// Checks if the given object is currently in the success state
18331 #[no_mangle]
18332 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18333         o.result_ok
18334 }
18335 #[no_mangle]
18336 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18337 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18338 impl Drop for CResult_ShutdownDecodeErrorZ {
18339         fn drop(&mut self) {
18340                 if self.result_ok {
18341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18343                         }
18344                 } else {
18345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18347                         }
18348                 }
18349         }
18350 }
18351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18353                 let contents = if o.result_ok {
18354                         let result = unsafe { o.contents.result };
18355                         unsafe { o.contents.result = core::ptr::null_mut() };
18356                         CResult_ShutdownDecodeErrorZPtr { result }
18357                 } else {
18358                         let err = unsafe { o.contents.err };
18359                         unsafe { o.contents.err = core::ptr::null_mut(); }
18360                         CResult_ShutdownDecodeErrorZPtr { err }
18361                 };
18362                 Self {
18363                         contents,
18364                         result_ok: o.result_ok,
18365                 }
18366         }
18367 }
18368 impl Clone for CResult_ShutdownDecodeErrorZ {
18369         fn clone(&self) -> Self {
18370                 if self.result_ok {
18371                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18372                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18373                         } }
18374                 } else {
18375                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18377                         } }
18378                 }
18379         }
18380 }
18381 #[no_mangle]
18382 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18383 /// but with all dynamically-allocated buffers duplicated in new buffers.
18384 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18385 #[repr(C)]
18386 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18387 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18388         /// A pointer to the contents in the success state.
18389         /// Reading from this pointer when `result_ok` is not set is undefined.
18390         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18391         /// A pointer to the contents in the error state.
18392         /// Reading from this pointer when `result_ok` is set is undefined.
18393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18394 }
18395 #[repr(C)]
18396 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18397 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18399 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18400         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18401         /// `err` or `result` depending on the state of `result_ok`.
18402         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18403         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18404         pub result_ok: bool,
18405 }
18406 #[no_mangle]
18407 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18408 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18409         CResult_UpdateFailHTLCDecodeErrorZ {
18410                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18411                         result: Box::into_raw(Box::new(o)),
18412                 },
18413                 result_ok: true,
18414         }
18415 }
18416 #[no_mangle]
18417 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18418 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18419         CResult_UpdateFailHTLCDecodeErrorZ {
18420                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18421                         err: Box::into_raw(Box::new(e)),
18422                 },
18423                 result_ok: false,
18424         }
18425 }
18426 /// Checks if the given object is currently in the success state
18427 #[no_mangle]
18428 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18429         o.result_ok
18430 }
18431 #[no_mangle]
18432 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18433 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18434 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18435         fn drop(&mut self) {
18436                 if self.result_ok {
18437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18439                         }
18440                 } else {
18441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18443                         }
18444                 }
18445         }
18446 }
18447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18449                 let contents = if o.result_ok {
18450                         let result = unsafe { o.contents.result };
18451                         unsafe { o.contents.result = core::ptr::null_mut() };
18452                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18453                 } else {
18454                         let err = unsafe { o.contents.err };
18455                         unsafe { o.contents.err = core::ptr::null_mut(); }
18456                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18457                 };
18458                 Self {
18459                         contents,
18460                         result_ok: o.result_ok,
18461                 }
18462         }
18463 }
18464 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18465         fn clone(&self) -> Self {
18466                 if self.result_ok {
18467                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18468                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18469                         } }
18470                 } else {
18471                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18473                         } }
18474                 }
18475         }
18476 }
18477 #[no_mangle]
18478 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18479 /// but with all dynamically-allocated buffers duplicated in new buffers.
18480 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18481 #[repr(C)]
18482 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18483 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18484         /// A pointer to the contents in the success state.
18485         /// Reading from this pointer when `result_ok` is not set is undefined.
18486         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18487         /// A pointer to the contents in the error state.
18488         /// Reading from this pointer when `result_ok` is set is undefined.
18489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18490 }
18491 #[repr(C)]
18492 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18493 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18495 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18496         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18497         /// `err` or `result` depending on the state of `result_ok`.
18498         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18499         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18500         pub result_ok: bool,
18501 }
18502 #[no_mangle]
18503 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18504 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18505         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18506                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18507                         result: Box::into_raw(Box::new(o)),
18508                 },
18509                 result_ok: true,
18510         }
18511 }
18512 #[no_mangle]
18513 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18514 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18515         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18516                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18517                         err: Box::into_raw(Box::new(e)),
18518                 },
18519                 result_ok: false,
18520         }
18521 }
18522 /// Checks if the given object is currently in the success state
18523 #[no_mangle]
18524 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18525         o.result_ok
18526 }
18527 #[no_mangle]
18528 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18529 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18530 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18531         fn drop(&mut self) {
18532                 if self.result_ok {
18533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18535                         }
18536                 } else {
18537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18539                         }
18540                 }
18541         }
18542 }
18543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18545                 let contents = if o.result_ok {
18546                         let result = unsafe { o.contents.result };
18547                         unsafe { o.contents.result = core::ptr::null_mut() };
18548                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18549                 } else {
18550                         let err = unsafe { o.contents.err };
18551                         unsafe { o.contents.err = core::ptr::null_mut(); }
18552                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18553                 };
18554                 Self {
18555                         contents,
18556                         result_ok: o.result_ok,
18557                 }
18558         }
18559 }
18560 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18561         fn clone(&self) -> Self {
18562                 if self.result_ok {
18563                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18565                         } }
18566                 } else {
18567                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18569                         } }
18570                 }
18571         }
18572 }
18573 #[no_mangle]
18574 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18575 /// but with all dynamically-allocated buffers duplicated in new buffers.
18576 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18577 #[repr(C)]
18578 /// The contents of CResult_UpdateFeeDecodeErrorZ
18579 pub union CResult_UpdateFeeDecodeErrorZPtr {
18580         /// A pointer to the contents in the success state.
18581         /// Reading from this pointer when `result_ok` is not set is undefined.
18582         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18583         /// A pointer to the contents in the error state.
18584         /// Reading from this pointer when `result_ok` is set is undefined.
18585         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18586 }
18587 #[repr(C)]
18588 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18589 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18591 pub struct CResult_UpdateFeeDecodeErrorZ {
18592         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18593         /// `err` or `result` depending on the state of `result_ok`.
18594         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18595         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18596         pub result_ok: bool,
18597 }
18598 #[no_mangle]
18599 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18600 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18601         CResult_UpdateFeeDecodeErrorZ {
18602                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18603                         result: Box::into_raw(Box::new(o)),
18604                 },
18605                 result_ok: true,
18606         }
18607 }
18608 #[no_mangle]
18609 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18610 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18611         CResult_UpdateFeeDecodeErrorZ {
18612                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18613                         err: Box::into_raw(Box::new(e)),
18614                 },
18615                 result_ok: false,
18616         }
18617 }
18618 /// Checks if the given object is currently in the success state
18619 #[no_mangle]
18620 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18621         o.result_ok
18622 }
18623 #[no_mangle]
18624 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18625 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18626 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18627         fn drop(&mut self) {
18628                 if self.result_ok {
18629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18631                         }
18632                 } else {
18633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18635                         }
18636                 }
18637         }
18638 }
18639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18640         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18641                 let contents = if o.result_ok {
18642                         let result = unsafe { o.contents.result };
18643                         unsafe { o.contents.result = core::ptr::null_mut() };
18644                         CResult_UpdateFeeDecodeErrorZPtr { result }
18645                 } else {
18646                         let err = unsafe { o.contents.err };
18647                         unsafe { o.contents.err = core::ptr::null_mut(); }
18648                         CResult_UpdateFeeDecodeErrorZPtr { err }
18649                 };
18650                 Self {
18651                         contents,
18652                         result_ok: o.result_ok,
18653                 }
18654         }
18655 }
18656 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18657         fn clone(&self) -> Self {
18658                 if self.result_ok {
18659                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18660                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18661                         } }
18662                 } else {
18663                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18664                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18665                         } }
18666                 }
18667         }
18668 }
18669 #[no_mangle]
18670 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18671 /// but with all dynamically-allocated buffers duplicated in new buffers.
18672 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18673 #[repr(C)]
18674 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18675 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18676         /// A pointer to the contents in the success state.
18677         /// Reading from this pointer when `result_ok` is not set is undefined.
18678         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18679         /// A pointer to the contents in the error state.
18680         /// Reading from this pointer when `result_ok` is set is undefined.
18681         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18682 }
18683 #[repr(C)]
18684 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18685 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18687 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18688         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18689         /// `err` or `result` depending on the state of `result_ok`.
18690         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18691         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18692         pub result_ok: bool,
18693 }
18694 #[no_mangle]
18695 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18696 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18697         CResult_UpdateFulfillHTLCDecodeErrorZ {
18698                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18699                         result: Box::into_raw(Box::new(o)),
18700                 },
18701                 result_ok: true,
18702         }
18703 }
18704 #[no_mangle]
18705 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18706 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18707         CResult_UpdateFulfillHTLCDecodeErrorZ {
18708                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18709                         err: Box::into_raw(Box::new(e)),
18710                 },
18711                 result_ok: false,
18712         }
18713 }
18714 /// Checks if the given object is currently in the success state
18715 #[no_mangle]
18716 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18717         o.result_ok
18718 }
18719 #[no_mangle]
18720 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18721 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18722 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18723         fn drop(&mut self) {
18724                 if self.result_ok {
18725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18727                         }
18728                 } else {
18729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18731                         }
18732                 }
18733         }
18734 }
18735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18737                 let contents = if o.result_ok {
18738                         let result = unsafe { o.contents.result };
18739                         unsafe { o.contents.result = core::ptr::null_mut() };
18740                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
18741                 } else {
18742                         let err = unsafe { o.contents.err };
18743                         unsafe { o.contents.err = core::ptr::null_mut(); }
18744                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
18745                 };
18746                 Self {
18747                         contents,
18748                         result_ok: o.result_ok,
18749                 }
18750         }
18751 }
18752 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
18753         fn clone(&self) -> Self {
18754                 if self.result_ok {
18755                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18756                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
18757                         } }
18758                 } else {
18759                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18760                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18761                         } }
18762                 }
18763         }
18764 }
18765 #[no_mangle]
18766 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18767 /// but with all dynamically-allocated buffers duplicated in new buffers.
18768 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
18769 #[repr(C)]
18770 /// The contents of CResult_OnionPacketDecodeErrorZ
18771 pub union CResult_OnionPacketDecodeErrorZPtr {
18772         /// A pointer to the contents in the success state.
18773         /// Reading from this pointer when `result_ok` is not set is undefined.
18774         pub result: *mut crate::lightning::ln::msgs::OnionPacket,
18775         /// A pointer to the contents in the error state.
18776         /// Reading from this pointer when `result_ok` is set is undefined.
18777         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18778 }
18779 #[repr(C)]
18780 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
18781 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
18782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18783 pub struct CResult_OnionPacketDecodeErrorZ {
18784         /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
18785         /// `err` or `result` depending on the state of `result_ok`.
18786         pub contents: CResult_OnionPacketDecodeErrorZPtr,
18787         /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
18788         pub result_ok: bool,
18789 }
18790 #[no_mangle]
18791 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
18792 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
18793         CResult_OnionPacketDecodeErrorZ {
18794                 contents: CResult_OnionPacketDecodeErrorZPtr {
18795                         result: Box::into_raw(Box::new(o)),
18796                 },
18797                 result_ok: true,
18798         }
18799 }
18800 #[no_mangle]
18801 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
18802 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
18803         CResult_OnionPacketDecodeErrorZ {
18804                 contents: CResult_OnionPacketDecodeErrorZPtr {
18805                         err: Box::into_raw(Box::new(e)),
18806                 },
18807                 result_ok: false,
18808         }
18809 }
18810 /// Checks if the given object is currently in the success state
18811 #[no_mangle]
18812 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
18813         o.result_ok
18814 }
18815 #[no_mangle]
18816 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
18817 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
18818 impl Drop for CResult_OnionPacketDecodeErrorZ {
18819         fn drop(&mut self) {
18820                 if self.result_ok {
18821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18823                         }
18824                 } else {
18825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18827                         }
18828                 }
18829         }
18830 }
18831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
18832         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
18833                 let contents = if o.result_ok {
18834                         let result = unsafe { o.contents.result };
18835                         unsafe { o.contents.result = core::ptr::null_mut() };
18836                         CResult_OnionPacketDecodeErrorZPtr { result }
18837                 } else {
18838                         let err = unsafe { o.contents.err };
18839                         unsafe { o.contents.err = core::ptr::null_mut(); }
18840                         CResult_OnionPacketDecodeErrorZPtr { err }
18841                 };
18842                 Self {
18843                         contents,
18844                         result_ok: o.result_ok,
18845                 }
18846         }
18847 }
18848 impl Clone for CResult_OnionPacketDecodeErrorZ {
18849         fn clone(&self) -> Self {
18850                 if self.result_ok {
18851                         Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
18852                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
18853                         } }
18854                 } else {
18855                         Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
18856                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18857                         } }
18858                 }
18859         }
18860 }
18861 #[no_mangle]
18862 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
18863 /// but with all dynamically-allocated buffers duplicated in new buffers.
18864 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
18865 #[repr(C)]
18866 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
18867 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
18868         /// A pointer to the contents in the success state.
18869         /// Reading from this pointer when `result_ok` is not set is undefined.
18870         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
18871         /// A pointer to the contents in the error state.
18872         /// Reading from this pointer when `result_ok` is set is undefined.
18873         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18874 }
18875 #[repr(C)]
18876 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
18877 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18879 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
18880         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
18881         /// `err` or `result` depending on the state of `result_ok`.
18882         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
18883         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
18884         pub result_ok: bool,
18885 }
18886 #[no_mangle]
18887 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18888 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
18889         CResult_UpdateAddHTLCDecodeErrorZ {
18890                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18891                         result: Box::into_raw(Box::new(o)),
18892                 },
18893                 result_ok: true,
18894         }
18895 }
18896 #[no_mangle]
18897 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18898 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
18899         CResult_UpdateAddHTLCDecodeErrorZ {
18900                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18901                         err: Box::into_raw(Box::new(e)),
18902                 },
18903                 result_ok: false,
18904         }
18905 }
18906 /// Checks if the given object is currently in the success state
18907 #[no_mangle]
18908 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
18909         o.result_ok
18910 }
18911 #[no_mangle]
18912 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18913 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
18914 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
18915         fn drop(&mut self) {
18916                 if self.result_ok {
18917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18919                         }
18920                 } else {
18921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18923                         }
18924                 }
18925         }
18926 }
18927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
18928         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18929                 let contents = if o.result_ok {
18930                         let result = unsafe { o.contents.result };
18931                         unsafe { o.contents.result = core::ptr::null_mut() };
18932                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
18933                 } else {
18934                         let err = unsafe { o.contents.err };
18935                         unsafe { o.contents.err = core::ptr::null_mut(); }
18936                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
18937                 };
18938                 Self {
18939                         contents,
18940                         result_ok: o.result_ok,
18941                 }
18942         }
18943 }
18944 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
18945         fn clone(&self) -> Self {
18946                 if self.result_ok {
18947                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18948                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
18949                         } }
18950                 } else {
18951                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18952                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18953                         } }
18954                 }
18955         }
18956 }
18957 #[no_mangle]
18958 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18959 /// but with all dynamically-allocated buffers duplicated in new buffers.
18960 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
18961 #[repr(C)]
18962 /// The contents of CResult_OnionMessageDecodeErrorZ
18963 pub union CResult_OnionMessageDecodeErrorZPtr {
18964         /// A pointer to the contents in the success state.
18965         /// Reading from this pointer when `result_ok` is not set is undefined.
18966         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
18967         /// A pointer to the contents in the error state.
18968         /// Reading from this pointer when `result_ok` is set is undefined.
18969         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18970 }
18971 #[repr(C)]
18972 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
18973 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18975 pub struct CResult_OnionMessageDecodeErrorZ {
18976         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
18977         /// `err` or `result` depending on the state of `result_ok`.
18978         pub contents: CResult_OnionMessageDecodeErrorZPtr,
18979         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
18980         pub result_ok: bool,
18981 }
18982 #[no_mangle]
18983 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18984 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
18985         CResult_OnionMessageDecodeErrorZ {
18986                 contents: CResult_OnionMessageDecodeErrorZPtr {
18987                         result: Box::into_raw(Box::new(o)),
18988                 },
18989                 result_ok: true,
18990         }
18991 }
18992 #[no_mangle]
18993 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18994 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
18995         CResult_OnionMessageDecodeErrorZ {
18996                 contents: CResult_OnionMessageDecodeErrorZPtr {
18997                         err: Box::into_raw(Box::new(e)),
18998                 },
18999                 result_ok: false,
19000         }
19001 }
19002 /// Checks if the given object is currently in the success state
19003 #[no_mangle]
19004 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
19005         o.result_ok
19006 }
19007 #[no_mangle]
19008 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
19009 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
19010 impl Drop for CResult_OnionMessageDecodeErrorZ {
19011         fn drop(&mut self) {
19012                 if self.result_ok {
19013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19015                         }
19016                 } else {
19017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19019                         }
19020                 }
19021         }
19022 }
19023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
19024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19025                 let contents = if o.result_ok {
19026                         let result = unsafe { o.contents.result };
19027                         unsafe { o.contents.result = core::ptr::null_mut() };
19028                         CResult_OnionMessageDecodeErrorZPtr { result }
19029                 } else {
19030                         let err = unsafe { o.contents.err };
19031                         unsafe { o.contents.err = core::ptr::null_mut(); }
19032                         CResult_OnionMessageDecodeErrorZPtr { err }
19033                 };
19034                 Self {
19035                         contents,
19036                         result_ok: o.result_ok,
19037                 }
19038         }
19039 }
19040 impl Clone for CResult_OnionMessageDecodeErrorZ {
19041         fn clone(&self) -> Self {
19042                 if self.result_ok {
19043                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
19044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
19045                         } }
19046                 } else {
19047                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
19048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19049                         } }
19050                 }
19051         }
19052 }
19053 #[no_mangle]
19054 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
19055 /// but with all dynamically-allocated buffers duplicated in new buffers.
19056 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
19057 #[repr(C)]
19058 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
19059 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
19060         /// A pointer to the contents in the success state.
19061         /// Reading from this pointer when `result_ok` is not set is undefined.
19062         pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
19063         /// A pointer to the contents in the error state.
19064         /// Reading from this pointer when `result_ok` is set is undefined.
19065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19066 }
19067 #[repr(C)]
19068 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
19069 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
19070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19071 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
19072         /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
19073         /// `err` or `result` depending on the state of `result_ok`.
19074         pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
19075         /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
19076         pub result_ok: bool,
19077 }
19078 #[no_mangle]
19079 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
19080 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
19081         CResult_FinalOnionHopDataDecodeErrorZ {
19082                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19083                         result: Box::into_raw(Box::new(o)),
19084                 },
19085                 result_ok: true,
19086         }
19087 }
19088 #[no_mangle]
19089 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
19090 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
19091         CResult_FinalOnionHopDataDecodeErrorZ {
19092                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19093                         err: Box::into_raw(Box::new(e)),
19094                 },
19095                 result_ok: false,
19096         }
19097 }
19098 /// Checks if the given object is currently in the success state
19099 #[no_mangle]
19100 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
19101         o.result_ok
19102 }
19103 #[no_mangle]
19104 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
19105 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
19106 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
19107         fn drop(&mut self) {
19108                 if self.result_ok {
19109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19111                         }
19112                 } else {
19113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19115                         }
19116                 }
19117         }
19118 }
19119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
19120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
19121                 let contents = if o.result_ok {
19122                         let result = unsafe { o.contents.result };
19123                         unsafe { o.contents.result = core::ptr::null_mut() };
19124                         CResult_FinalOnionHopDataDecodeErrorZPtr { result }
19125                 } else {
19126                         let err = unsafe { o.contents.err };
19127                         unsafe { o.contents.err = core::ptr::null_mut(); }
19128                         CResult_FinalOnionHopDataDecodeErrorZPtr { err }
19129                 };
19130                 Self {
19131                         contents,
19132                         result_ok: o.result_ok,
19133                 }
19134         }
19135 }
19136 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
19137         fn clone(&self) -> Self {
19138                 if self.result_ok {
19139                         Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19140                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
19141                         } }
19142                 } else {
19143                         Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19145                         } }
19146                 }
19147         }
19148 }
19149 #[no_mangle]
19150 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
19151 /// but with all dynamically-allocated buffers duplicated in new buffers.
19152 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
19153 #[repr(C)]
19154 /// The contents of CResult_PingDecodeErrorZ
19155 pub union CResult_PingDecodeErrorZPtr {
19156         /// A pointer to the contents in the success state.
19157         /// Reading from this pointer when `result_ok` is not set is undefined.
19158         pub result: *mut crate::lightning::ln::msgs::Ping,
19159         /// A pointer to the contents in the error state.
19160         /// Reading from this pointer when `result_ok` is set is undefined.
19161         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19162 }
19163 #[repr(C)]
19164 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19165 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19167 pub struct CResult_PingDecodeErrorZ {
19168         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19169         /// `err` or `result` depending on the state of `result_ok`.
19170         pub contents: CResult_PingDecodeErrorZPtr,
19171         /// Whether this CResult_PingDecodeErrorZ represents a success state.
19172         pub result_ok: bool,
19173 }
19174 #[no_mangle]
19175 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19176 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19177         CResult_PingDecodeErrorZ {
19178                 contents: CResult_PingDecodeErrorZPtr {
19179                         result: Box::into_raw(Box::new(o)),
19180                 },
19181                 result_ok: true,
19182         }
19183 }
19184 #[no_mangle]
19185 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19186 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19187         CResult_PingDecodeErrorZ {
19188                 contents: CResult_PingDecodeErrorZPtr {
19189                         err: Box::into_raw(Box::new(e)),
19190                 },
19191                 result_ok: false,
19192         }
19193 }
19194 /// Checks if the given object is currently in the success state
19195 #[no_mangle]
19196 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19197         o.result_ok
19198 }
19199 #[no_mangle]
19200 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19201 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19202 impl Drop for CResult_PingDecodeErrorZ {
19203         fn drop(&mut self) {
19204                 if self.result_ok {
19205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19207                         }
19208                 } else {
19209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19211                         }
19212                 }
19213         }
19214 }
19215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19217                 let contents = if o.result_ok {
19218                         let result = unsafe { o.contents.result };
19219                         unsafe { o.contents.result = core::ptr::null_mut() };
19220                         CResult_PingDecodeErrorZPtr { result }
19221                 } else {
19222                         let err = unsafe { o.contents.err };
19223                         unsafe { o.contents.err = core::ptr::null_mut(); }
19224                         CResult_PingDecodeErrorZPtr { err }
19225                 };
19226                 Self {
19227                         contents,
19228                         result_ok: o.result_ok,
19229                 }
19230         }
19231 }
19232 impl Clone for CResult_PingDecodeErrorZ {
19233         fn clone(&self) -> Self {
19234                 if self.result_ok {
19235                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19236                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19237                         } }
19238                 } else {
19239                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19240                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19241                         } }
19242                 }
19243         }
19244 }
19245 #[no_mangle]
19246 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19247 /// but with all dynamically-allocated buffers duplicated in new buffers.
19248 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19249 #[repr(C)]
19250 /// The contents of CResult_PongDecodeErrorZ
19251 pub union CResult_PongDecodeErrorZPtr {
19252         /// A pointer to the contents in the success state.
19253         /// Reading from this pointer when `result_ok` is not set is undefined.
19254         pub result: *mut crate::lightning::ln::msgs::Pong,
19255         /// A pointer to the contents in the error state.
19256         /// Reading from this pointer when `result_ok` is set is undefined.
19257         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19258 }
19259 #[repr(C)]
19260 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19261 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19263 pub struct CResult_PongDecodeErrorZ {
19264         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19265         /// `err` or `result` depending on the state of `result_ok`.
19266         pub contents: CResult_PongDecodeErrorZPtr,
19267         /// Whether this CResult_PongDecodeErrorZ represents a success state.
19268         pub result_ok: bool,
19269 }
19270 #[no_mangle]
19271 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19272 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19273         CResult_PongDecodeErrorZ {
19274                 contents: CResult_PongDecodeErrorZPtr {
19275                         result: Box::into_raw(Box::new(o)),
19276                 },
19277                 result_ok: true,
19278         }
19279 }
19280 #[no_mangle]
19281 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19282 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19283         CResult_PongDecodeErrorZ {
19284                 contents: CResult_PongDecodeErrorZPtr {
19285                         err: Box::into_raw(Box::new(e)),
19286                 },
19287                 result_ok: false,
19288         }
19289 }
19290 /// Checks if the given object is currently in the success state
19291 #[no_mangle]
19292 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19293         o.result_ok
19294 }
19295 #[no_mangle]
19296 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19297 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19298 impl Drop for CResult_PongDecodeErrorZ {
19299         fn drop(&mut self) {
19300                 if self.result_ok {
19301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19303                         }
19304                 } else {
19305                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19306                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19307                         }
19308                 }
19309         }
19310 }
19311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19312         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19313                 let contents = if o.result_ok {
19314                         let result = unsafe { o.contents.result };
19315                         unsafe { o.contents.result = core::ptr::null_mut() };
19316                         CResult_PongDecodeErrorZPtr { result }
19317                 } else {
19318                         let err = unsafe { o.contents.err };
19319                         unsafe { o.contents.err = core::ptr::null_mut(); }
19320                         CResult_PongDecodeErrorZPtr { err }
19321                 };
19322                 Self {
19323                         contents,
19324                         result_ok: o.result_ok,
19325                 }
19326         }
19327 }
19328 impl Clone for CResult_PongDecodeErrorZ {
19329         fn clone(&self) -> Self {
19330                 if self.result_ok {
19331                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19332                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19333                         } }
19334                 } else {
19335                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19336                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19337                         } }
19338                 }
19339         }
19340 }
19341 #[no_mangle]
19342 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19343 /// but with all dynamically-allocated buffers duplicated in new buffers.
19344 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19345 #[repr(C)]
19346 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19347 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19348         /// A pointer to the contents in the success state.
19349         /// Reading from this pointer when `result_ok` is not set is undefined.
19350         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19351         /// A pointer to the contents in the error state.
19352         /// Reading from this pointer when `result_ok` is set is undefined.
19353         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19354 }
19355 #[repr(C)]
19356 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19357 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19359 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19360         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19361         /// `err` or `result` depending on the state of `result_ok`.
19362         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19363         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19364         pub result_ok: bool,
19365 }
19366 #[no_mangle]
19367 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19368 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19369         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19370                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19371                         result: Box::into_raw(Box::new(o)),
19372                 },
19373                 result_ok: true,
19374         }
19375 }
19376 #[no_mangle]
19377 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19378 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19379         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19380                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19381                         err: Box::into_raw(Box::new(e)),
19382                 },
19383                 result_ok: false,
19384         }
19385 }
19386 /// Checks if the given object is currently in the success state
19387 #[no_mangle]
19388 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19389         o.result_ok
19390 }
19391 #[no_mangle]
19392 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19393 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19394 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19395         fn drop(&mut self) {
19396                 if self.result_ok {
19397                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19398                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19399                         }
19400                 } else {
19401                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19402                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19403                         }
19404                 }
19405         }
19406 }
19407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19408         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19409                 let contents = if o.result_ok {
19410                         let result = unsafe { o.contents.result };
19411                         unsafe { o.contents.result = core::ptr::null_mut() };
19412                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19413                 } else {
19414                         let err = unsafe { o.contents.err };
19415                         unsafe { o.contents.err = core::ptr::null_mut(); }
19416                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19417                 };
19418                 Self {
19419                         contents,
19420                         result_ok: o.result_ok,
19421                 }
19422         }
19423 }
19424 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19425         fn clone(&self) -> Self {
19426                 if self.result_ok {
19427                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19428                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19429                         } }
19430                 } else {
19431                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19432                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19433                         } }
19434                 }
19435         }
19436 }
19437 #[no_mangle]
19438 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19439 /// but with all dynamically-allocated buffers duplicated in new buffers.
19440 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19441 #[repr(C)]
19442 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19443 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19444         /// A pointer to the contents in the success state.
19445         /// Reading from this pointer when `result_ok` is not set is undefined.
19446         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19447         /// A pointer to the contents in the error state.
19448         /// Reading from this pointer when `result_ok` is set is undefined.
19449         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19450 }
19451 #[repr(C)]
19452 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19453 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19455 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19456         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19457         /// `err` or `result` depending on the state of `result_ok`.
19458         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19459         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19460         pub result_ok: bool,
19461 }
19462 #[no_mangle]
19463 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19464 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19465         CResult_ChannelAnnouncementDecodeErrorZ {
19466                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19467                         result: Box::into_raw(Box::new(o)),
19468                 },
19469                 result_ok: true,
19470         }
19471 }
19472 #[no_mangle]
19473 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19474 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19475         CResult_ChannelAnnouncementDecodeErrorZ {
19476                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19477                         err: Box::into_raw(Box::new(e)),
19478                 },
19479                 result_ok: false,
19480         }
19481 }
19482 /// Checks if the given object is currently in the success state
19483 #[no_mangle]
19484 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19485         o.result_ok
19486 }
19487 #[no_mangle]
19488 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19489 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19490 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19491         fn drop(&mut self) {
19492                 if self.result_ok {
19493                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19494                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19495                         }
19496                 } else {
19497                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19498                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19499                         }
19500                 }
19501         }
19502 }
19503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19504         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19505                 let contents = if o.result_ok {
19506                         let result = unsafe { o.contents.result };
19507                         unsafe { o.contents.result = core::ptr::null_mut() };
19508                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19509                 } else {
19510                         let err = unsafe { o.contents.err };
19511                         unsafe { o.contents.err = core::ptr::null_mut(); }
19512                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19513                 };
19514                 Self {
19515                         contents,
19516                         result_ok: o.result_ok,
19517                 }
19518         }
19519 }
19520 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19521         fn clone(&self) -> Self {
19522                 if self.result_ok {
19523                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19524                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19525                         } }
19526                 } else {
19527                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19528                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19529                         } }
19530                 }
19531         }
19532 }
19533 #[no_mangle]
19534 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19535 /// but with all dynamically-allocated buffers duplicated in new buffers.
19536 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19537 #[repr(C)]
19538 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19539 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19540         /// A pointer to the contents in the success state.
19541         /// Reading from this pointer when `result_ok` is not set is undefined.
19542         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19543         /// A pointer to the contents in the error state.
19544         /// Reading from this pointer when `result_ok` is set is undefined.
19545         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19546 }
19547 #[repr(C)]
19548 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19549 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19551 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19552         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19553         /// `err` or `result` depending on the state of `result_ok`.
19554         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19555         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19556         pub result_ok: bool,
19557 }
19558 #[no_mangle]
19559 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19560 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19561         CResult_UnsignedChannelUpdateDecodeErrorZ {
19562                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19563                         result: Box::into_raw(Box::new(o)),
19564                 },
19565                 result_ok: true,
19566         }
19567 }
19568 #[no_mangle]
19569 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19570 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19571         CResult_UnsignedChannelUpdateDecodeErrorZ {
19572                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19573                         err: Box::into_raw(Box::new(e)),
19574                 },
19575                 result_ok: false,
19576         }
19577 }
19578 /// Checks if the given object is currently in the success state
19579 #[no_mangle]
19580 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19581         o.result_ok
19582 }
19583 #[no_mangle]
19584 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19585 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19586 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19587         fn drop(&mut self) {
19588                 if self.result_ok {
19589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19591                         }
19592                 } else {
19593                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19594                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19595                         }
19596                 }
19597         }
19598 }
19599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19600         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19601                 let contents = if o.result_ok {
19602                         let result = unsafe { o.contents.result };
19603                         unsafe { o.contents.result = core::ptr::null_mut() };
19604                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19605                 } else {
19606                         let err = unsafe { o.contents.err };
19607                         unsafe { o.contents.err = core::ptr::null_mut(); }
19608                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19609                 };
19610                 Self {
19611                         contents,
19612                         result_ok: o.result_ok,
19613                 }
19614         }
19615 }
19616 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19617         fn clone(&self) -> Self {
19618                 if self.result_ok {
19619                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19620                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19621                         } }
19622                 } else {
19623                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19624                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19625                         } }
19626                 }
19627         }
19628 }
19629 #[no_mangle]
19630 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19631 /// but with all dynamically-allocated buffers duplicated in new buffers.
19632 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19633 #[repr(C)]
19634 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19635 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19636         /// A pointer to the contents in the success state.
19637         /// Reading from this pointer when `result_ok` is not set is undefined.
19638         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19639         /// A pointer to the contents in the error state.
19640         /// Reading from this pointer when `result_ok` is set is undefined.
19641         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19642 }
19643 #[repr(C)]
19644 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19645 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19647 pub struct CResult_ChannelUpdateDecodeErrorZ {
19648         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19649         /// `err` or `result` depending on the state of `result_ok`.
19650         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19651         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19652         pub result_ok: bool,
19653 }
19654 #[no_mangle]
19655 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19656 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19657         CResult_ChannelUpdateDecodeErrorZ {
19658                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19659                         result: Box::into_raw(Box::new(o)),
19660                 },
19661                 result_ok: true,
19662         }
19663 }
19664 #[no_mangle]
19665 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19666 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19667         CResult_ChannelUpdateDecodeErrorZ {
19668                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19669                         err: Box::into_raw(Box::new(e)),
19670                 },
19671                 result_ok: false,
19672         }
19673 }
19674 /// Checks if the given object is currently in the success state
19675 #[no_mangle]
19676 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19677         o.result_ok
19678 }
19679 #[no_mangle]
19680 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19681 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19682 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19683         fn drop(&mut self) {
19684                 if self.result_ok {
19685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19687                         }
19688                 } else {
19689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19691                         }
19692                 }
19693         }
19694 }
19695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19696         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19697                 let contents = if o.result_ok {
19698                         let result = unsafe { o.contents.result };
19699                         unsafe { o.contents.result = core::ptr::null_mut() };
19700                         CResult_ChannelUpdateDecodeErrorZPtr { result }
19701                 } else {
19702                         let err = unsafe { o.contents.err };
19703                         unsafe { o.contents.err = core::ptr::null_mut(); }
19704                         CResult_ChannelUpdateDecodeErrorZPtr { err }
19705                 };
19706                 Self {
19707                         contents,
19708                         result_ok: o.result_ok,
19709                 }
19710         }
19711 }
19712 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19713         fn clone(&self) -> Self {
19714                 if self.result_ok {
19715                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19716                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19717                         } }
19718                 } else {
19719                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19720                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19721                         } }
19722                 }
19723         }
19724 }
19725 #[no_mangle]
19726 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19727 /// but with all dynamically-allocated buffers duplicated in new buffers.
19728 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19729 #[repr(C)]
19730 /// The contents of CResult_ErrorMessageDecodeErrorZ
19731 pub union CResult_ErrorMessageDecodeErrorZPtr {
19732         /// A pointer to the contents in the success state.
19733         /// Reading from this pointer when `result_ok` is not set is undefined.
19734         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19735         /// A pointer to the contents in the error state.
19736         /// Reading from this pointer when `result_ok` is set is undefined.
19737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19738 }
19739 #[repr(C)]
19740 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
19741 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19743 pub struct CResult_ErrorMessageDecodeErrorZ {
19744         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
19745         /// `err` or `result` depending on the state of `result_ok`.
19746         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
19747         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
19748         pub result_ok: bool,
19749 }
19750 #[no_mangle]
19751 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
19753         CResult_ErrorMessageDecodeErrorZ {
19754                 contents: CResult_ErrorMessageDecodeErrorZPtr {
19755                         result: Box::into_raw(Box::new(o)),
19756                 },
19757                 result_ok: true,
19758         }
19759 }
19760 #[no_mangle]
19761 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19762 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
19763         CResult_ErrorMessageDecodeErrorZ {
19764                 contents: CResult_ErrorMessageDecodeErrorZPtr {
19765                         err: Box::into_raw(Box::new(e)),
19766                 },
19767                 result_ok: false,
19768         }
19769 }
19770 /// Checks if the given object is currently in the success state
19771 #[no_mangle]
19772 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
19773         o.result_ok
19774 }
19775 #[no_mangle]
19776 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19777 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
19778 impl Drop for CResult_ErrorMessageDecodeErrorZ {
19779         fn drop(&mut self) {
19780                 if self.result_ok {
19781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19783                         }
19784                 } else {
19785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19787                         }
19788                 }
19789         }
19790 }
19791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
19792         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19793                 let contents = if o.result_ok {
19794                         let result = unsafe { o.contents.result };
19795                         unsafe { o.contents.result = core::ptr::null_mut() };
19796                         CResult_ErrorMessageDecodeErrorZPtr { result }
19797                 } else {
19798                         let err = unsafe { o.contents.err };
19799                         unsafe { o.contents.err = core::ptr::null_mut(); }
19800                         CResult_ErrorMessageDecodeErrorZPtr { err }
19801                 };
19802                 Self {
19803                         contents,
19804                         result_ok: o.result_ok,
19805                 }
19806         }
19807 }
19808 impl Clone for CResult_ErrorMessageDecodeErrorZ {
19809         fn clone(&self) -> Self {
19810                 if self.result_ok {
19811                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
19812                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
19813                         } }
19814                 } else {
19815                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
19816                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19817                         } }
19818                 }
19819         }
19820 }
19821 #[no_mangle]
19822 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19823 /// but with all dynamically-allocated buffers duplicated in new buffers.
19824 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
19825 #[repr(C)]
19826 /// The contents of CResult_WarningMessageDecodeErrorZ
19827 pub union CResult_WarningMessageDecodeErrorZPtr {
19828         /// A pointer to the contents in the success state.
19829         /// Reading from this pointer when `result_ok` is not set is undefined.
19830         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
19831         /// A pointer to the contents in the error state.
19832         /// Reading from this pointer when `result_ok` is set is undefined.
19833         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19834 }
19835 #[repr(C)]
19836 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
19837 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19839 pub struct CResult_WarningMessageDecodeErrorZ {
19840         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
19841         /// `err` or `result` depending on the state of `result_ok`.
19842         pub contents: CResult_WarningMessageDecodeErrorZPtr,
19843         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
19844         pub result_ok: bool,
19845 }
19846 #[no_mangle]
19847 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19848 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
19849         CResult_WarningMessageDecodeErrorZ {
19850                 contents: CResult_WarningMessageDecodeErrorZPtr {
19851                         result: Box::into_raw(Box::new(o)),
19852                 },
19853                 result_ok: true,
19854         }
19855 }
19856 #[no_mangle]
19857 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19858 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
19859         CResult_WarningMessageDecodeErrorZ {
19860                 contents: CResult_WarningMessageDecodeErrorZPtr {
19861                         err: Box::into_raw(Box::new(e)),
19862                 },
19863                 result_ok: false,
19864         }
19865 }
19866 /// Checks if the given object is currently in the success state
19867 #[no_mangle]
19868 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
19869         o.result_ok
19870 }
19871 #[no_mangle]
19872 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19873 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
19874 impl Drop for CResult_WarningMessageDecodeErrorZ {
19875         fn drop(&mut self) {
19876                 if self.result_ok {
19877                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19878                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19879                         }
19880                 } else {
19881                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19882                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19883                         }
19884                 }
19885         }
19886 }
19887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
19888         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19889                 let contents = if o.result_ok {
19890                         let result = unsafe { o.contents.result };
19891                         unsafe { o.contents.result = core::ptr::null_mut() };
19892                         CResult_WarningMessageDecodeErrorZPtr { result }
19893                 } else {
19894                         let err = unsafe { o.contents.err };
19895                         unsafe { o.contents.err = core::ptr::null_mut(); }
19896                         CResult_WarningMessageDecodeErrorZPtr { err }
19897                 };
19898                 Self {
19899                         contents,
19900                         result_ok: o.result_ok,
19901                 }
19902         }
19903 }
19904 impl Clone for CResult_WarningMessageDecodeErrorZ {
19905         fn clone(&self) -> Self {
19906                 if self.result_ok {
19907                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
19908                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
19909                         } }
19910                 } else {
19911                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
19912                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19913                         } }
19914                 }
19915         }
19916 }
19917 #[no_mangle]
19918 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19919 /// but with all dynamically-allocated buffers duplicated in new buffers.
19920 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
19921 #[repr(C)]
19922 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
19923 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19924         /// A pointer to the contents in the success state.
19925         /// Reading from this pointer when `result_ok` is not set is undefined.
19926         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
19927         /// A pointer to the contents in the error state.
19928         /// Reading from this pointer when `result_ok` is set is undefined.
19929         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19930 }
19931 #[repr(C)]
19932 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19933 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19935 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19936         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
19937         /// `err` or `result` depending on the state of `result_ok`.
19938         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
19939         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
19940         pub result_ok: bool,
19941 }
19942 #[no_mangle]
19943 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19944 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19945         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19946                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19947                         result: Box::into_raw(Box::new(o)),
19948                 },
19949                 result_ok: true,
19950         }
19951 }
19952 #[no_mangle]
19953 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19954 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19955         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19956                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19957                         err: Box::into_raw(Box::new(e)),
19958                 },
19959                 result_ok: false,
19960         }
19961 }
19962 /// Checks if the given object is currently in the success state
19963 #[no_mangle]
19964 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
19965         o.result_ok
19966 }
19967 #[no_mangle]
19968 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19969 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
19970 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19971         fn drop(&mut self) {
19972                 if self.result_ok {
19973                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19974                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19975                         }
19976                 } else {
19977                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19978                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19979                         }
19980                 }
19981         }
19982 }
19983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19984         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19985                 let contents = if o.result_ok {
19986                         let result = unsafe { o.contents.result };
19987                         unsafe { o.contents.result = core::ptr::null_mut() };
19988                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
19989                 } else {
19990                         let err = unsafe { o.contents.err };
19991                         unsafe { o.contents.err = core::ptr::null_mut(); }
19992                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
19993                 };
19994                 Self {
19995                         contents,
19996                         result_ok: o.result_ok,
19997                 }
19998         }
19999 }
20000 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20001         fn clone(&self) -> Self {
20002                 if self.result_ok {
20003                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20004                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20005                         } }
20006                 } else {
20007                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20008                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20009                         } }
20010                 }
20011         }
20012 }
20013 #[no_mangle]
20014 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
20015 /// but with all dynamically-allocated buffers duplicated in new buffers.
20016 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20017 #[repr(C)]
20018 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
20019 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
20020         /// A pointer to the contents in the success state.
20021         /// Reading from this pointer when `result_ok` is not set is undefined.
20022         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
20023         /// A pointer to the contents in the error state.
20024         /// Reading from this pointer when `result_ok` is set is undefined.
20025         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20026 }
20027 #[repr(C)]
20028 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20029 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20031 pub struct CResult_NodeAnnouncementDecodeErrorZ {
20032         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
20033         /// `err` or `result` depending on the state of `result_ok`.
20034         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
20035         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
20036         pub result_ok: bool,
20037 }
20038 #[no_mangle]
20039 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
20040 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
20041         CResult_NodeAnnouncementDecodeErrorZ {
20042                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20043                         result: Box::into_raw(Box::new(o)),
20044                 },
20045                 result_ok: true,
20046         }
20047 }
20048 #[no_mangle]
20049 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
20050 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
20051         CResult_NodeAnnouncementDecodeErrorZ {
20052                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20053                         err: Box::into_raw(Box::new(e)),
20054                 },
20055                 result_ok: false,
20056         }
20057 }
20058 /// Checks if the given object is currently in the success state
20059 #[no_mangle]
20060 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
20061         o.result_ok
20062 }
20063 #[no_mangle]
20064 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
20065 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
20066 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
20067         fn drop(&mut self) {
20068                 if self.result_ok {
20069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20071                         }
20072                 } else {
20073                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20074                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20075                         }
20076                 }
20077         }
20078 }
20079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
20080         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20081                 let contents = if o.result_ok {
20082                         let result = unsafe { o.contents.result };
20083                         unsafe { o.contents.result = core::ptr::null_mut() };
20084                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
20085                 } else {
20086                         let err = unsafe { o.contents.err };
20087                         unsafe { o.contents.err = core::ptr::null_mut(); }
20088                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
20089                 };
20090                 Self {
20091                         contents,
20092                         result_ok: o.result_ok,
20093                 }
20094         }
20095 }
20096 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
20097         fn clone(&self) -> Self {
20098                 if self.result_ok {
20099                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20100                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20101                         } }
20102                 } else {
20103                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20104                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20105                         } }
20106                 }
20107         }
20108 }
20109 #[no_mangle]
20110 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
20111 /// but with all dynamically-allocated buffers duplicated in new buffers.
20112 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20113 #[repr(C)]
20114 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
20115 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
20116         /// A pointer to the contents in the success state.
20117         /// Reading from this pointer when `result_ok` is not set is undefined.
20118         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
20119         /// A pointer to the contents in the error state.
20120         /// Reading from this pointer when `result_ok` is set is undefined.
20121         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20122 }
20123 #[repr(C)]
20124 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
20125 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
20126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20127 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
20128         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
20129         /// `err` or `result` depending on the state of `result_ok`.
20130         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
20131         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
20132         pub result_ok: bool,
20133 }
20134 #[no_mangle]
20135 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
20136 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20137         CResult_QueryShortChannelIdsDecodeErrorZ {
20138                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20139                         result: Box::into_raw(Box::new(o)),
20140                 },
20141                 result_ok: true,
20142         }
20143 }
20144 #[no_mangle]
20145 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
20146 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20147         CResult_QueryShortChannelIdsDecodeErrorZ {
20148                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20149                         err: Box::into_raw(Box::new(e)),
20150                 },
20151                 result_ok: false,
20152         }
20153 }
20154 /// Checks if the given object is currently in the success state
20155 #[no_mangle]
20156 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
20157         o.result_ok
20158 }
20159 #[no_mangle]
20160 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20161 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20162 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20163         fn drop(&mut self) {
20164                 if self.result_ok {
20165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20167                         }
20168                 } else {
20169                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20170                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20171                         }
20172                 }
20173         }
20174 }
20175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20176         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20177                 let contents = if o.result_ok {
20178                         let result = unsafe { o.contents.result };
20179                         unsafe { o.contents.result = core::ptr::null_mut() };
20180                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20181                 } else {
20182                         let err = unsafe { o.contents.err };
20183                         unsafe { o.contents.err = core::ptr::null_mut(); }
20184                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20185                 };
20186                 Self {
20187                         contents,
20188                         result_ok: o.result_ok,
20189                 }
20190         }
20191 }
20192 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20193         fn clone(&self) -> Self {
20194                 if self.result_ok {
20195                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20196                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20197                         } }
20198                 } else {
20199                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20200                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20201                         } }
20202                 }
20203         }
20204 }
20205 #[no_mangle]
20206 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20207 /// but with all dynamically-allocated buffers duplicated in new buffers.
20208 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20209 #[repr(C)]
20210 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20211 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20212         /// A pointer to the contents in the success state.
20213         /// Reading from this pointer when `result_ok` is not set is undefined.
20214         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20215         /// A pointer to the contents in the error state.
20216         /// Reading from this pointer when `result_ok` is set is undefined.
20217         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20218 }
20219 #[repr(C)]
20220 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20221 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20223 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20224         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20225         /// `err` or `result` depending on the state of `result_ok`.
20226         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20227         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20228         pub result_ok: bool,
20229 }
20230 #[no_mangle]
20231 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20232 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20233         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20234                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20235                         result: Box::into_raw(Box::new(o)),
20236                 },
20237                 result_ok: true,
20238         }
20239 }
20240 #[no_mangle]
20241 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20242 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20243         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20244                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20245                         err: Box::into_raw(Box::new(e)),
20246                 },
20247                 result_ok: false,
20248         }
20249 }
20250 /// Checks if the given object is currently in the success state
20251 #[no_mangle]
20252 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20253         o.result_ok
20254 }
20255 #[no_mangle]
20256 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20257 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20258 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20259         fn drop(&mut self) {
20260                 if self.result_ok {
20261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20263                         }
20264                 } else {
20265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20267                         }
20268                 }
20269         }
20270 }
20271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20273                 let contents = if o.result_ok {
20274                         let result = unsafe { o.contents.result };
20275                         unsafe { o.contents.result = core::ptr::null_mut() };
20276                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20277                 } else {
20278                         let err = unsafe { o.contents.err };
20279                         unsafe { o.contents.err = core::ptr::null_mut(); }
20280                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20281                 };
20282                 Self {
20283                         contents,
20284                         result_ok: o.result_ok,
20285                 }
20286         }
20287 }
20288 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20289         fn clone(&self) -> Self {
20290                 if self.result_ok {
20291                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20292                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20293                         } }
20294                 } else {
20295                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20297                         } }
20298                 }
20299         }
20300 }
20301 #[no_mangle]
20302 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20303 /// but with all dynamically-allocated buffers duplicated in new buffers.
20304 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20305 #[repr(C)]
20306 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20307 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20308         /// A pointer to the contents in the success state.
20309         /// Reading from this pointer when `result_ok` is not set is undefined.
20310         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20311         /// A pointer to the contents in the error state.
20312         /// Reading from this pointer when `result_ok` is set is undefined.
20313         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20314 }
20315 #[repr(C)]
20316 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20317 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20319 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20320         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20321         /// `err` or `result` depending on the state of `result_ok`.
20322         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20323         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20324         pub result_ok: bool,
20325 }
20326 #[no_mangle]
20327 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20328 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20329         CResult_QueryChannelRangeDecodeErrorZ {
20330                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20331                         result: Box::into_raw(Box::new(o)),
20332                 },
20333                 result_ok: true,
20334         }
20335 }
20336 #[no_mangle]
20337 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20338 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20339         CResult_QueryChannelRangeDecodeErrorZ {
20340                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20341                         err: Box::into_raw(Box::new(e)),
20342                 },
20343                 result_ok: false,
20344         }
20345 }
20346 /// Checks if the given object is currently in the success state
20347 #[no_mangle]
20348 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20349         o.result_ok
20350 }
20351 #[no_mangle]
20352 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20353 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20354 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20355         fn drop(&mut self) {
20356                 if self.result_ok {
20357                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20358                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20359                         }
20360                 } else {
20361                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20362                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20363                         }
20364                 }
20365         }
20366 }
20367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20368         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20369                 let contents = if o.result_ok {
20370                         let result = unsafe { o.contents.result };
20371                         unsafe { o.contents.result = core::ptr::null_mut() };
20372                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
20373                 } else {
20374                         let err = unsafe { o.contents.err };
20375                         unsafe { o.contents.err = core::ptr::null_mut(); }
20376                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
20377                 };
20378                 Self {
20379                         contents,
20380                         result_ok: o.result_ok,
20381                 }
20382         }
20383 }
20384 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20385         fn clone(&self) -> Self {
20386                 if self.result_ok {
20387                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20388                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20389                         } }
20390                 } else {
20391                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20392                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20393                         } }
20394                 }
20395         }
20396 }
20397 #[no_mangle]
20398 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20399 /// but with all dynamically-allocated buffers duplicated in new buffers.
20400 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20401 #[repr(C)]
20402 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20403 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20404         /// A pointer to the contents in the success state.
20405         /// Reading from this pointer when `result_ok` is not set is undefined.
20406         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20407         /// A pointer to the contents in the error state.
20408         /// Reading from this pointer when `result_ok` is set is undefined.
20409         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20410 }
20411 #[repr(C)]
20412 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20413 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20415 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20416         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20417         /// `err` or `result` depending on the state of `result_ok`.
20418         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20419         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20420         pub result_ok: bool,
20421 }
20422 #[no_mangle]
20423 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20424 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20425         CResult_ReplyChannelRangeDecodeErrorZ {
20426                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20427                         result: Box::into_raw(Box::new(o)),
20428                 },
20429                 result_ok: true,
20430         }
20431 }
20432 #[no_mangle]
20433 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20434 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20435         CResult_ReplyChannelRangeDecodeErrorZ {
20436                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20437                         err: Box::into_raw(Box::new(e)),
20438                 },
20439                 result_ok: false,
20440         }
20441 }
20442 /// Checks if the given object is currently in the success state
20443 #[no_mangle]
20444 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20445         o.result_ok
20446 }
20447 #[no_mangle]
20448 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20449 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20450 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20451         fn drop(&mut self) {
20452                 if self.result_ok {
20453                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20454                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20455                         }
20456                 } else {
20457                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20458                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20459                         }
20460                 }
20461         }
20462 }
20463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20464         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20465                 let contents = if o.result_ok {
20466                         let result = unsafe { o.contents.result };
20467                         unsafe { o.contents.result = core::ptr::null_mut() };
20468                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20469                 } else {
20470                         let err = unsafe { o.contents.err };
20471                         unsafe { o.contents.err = core::ptr::null_mut(); }
20472                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20473                 };
20474                 Self {
20475                         contents,
20476                         result_ok: o.result_ok,
20477                 }
20478         }
20479 }
20480 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20481         fn clone(&self) -> Self {
20482                 if self.result_ok {
20483                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20484                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20485                         } }
20486                 } else {
20487                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20488                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20489                         } }
20490                 }
20491         }
20492 }
20493 #[no_mangle]
20494 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20495 /// but with all dynamically-allocated buffers duplicated in new buffers.
20496 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20497 #[repr(C)]
20498 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20499 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20500         /// A pointer to the contents in the success state.
20501         /// Reading from this pointer when `result_ok` is not set is undefined.
20502         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20503         /// A pointer to the contents in the error state.
20504         /// Reading from this pointer when `result_ok` is set is undefined.
20505         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20506 }
20507 #[repr(C)]
20508 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20509 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20511 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20512         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20513         /// `err` or `result` depending on the state of `result_ok`.
20514         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20515         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20516         pub result_ok: bool,
20517 }
20518 #[no_mangle]
20519 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20520 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20521         CResult_GossipTimestampFilterDecodeErrorZ {
20522                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20523                         result: Box::into_raw(Box::new(o)),
20524                 },
20525                 result_ok: true,
20526         }
20527 }
20528 #[no_mangle]
20529 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20530 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20531         CResult_GossipTimestampFilterDecodeErrorZ {
20532                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20533                         err: Box::into_raw(Box::new(e)),
20534                 },
20535                 result_ok: false,
20536         }
20537 }
20538 /// Checks if the given object is currently in the success state
20539 #[no_mangle]
20540 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20541         o.result_ok
20542 }
20543 #[no_mangle]
20544 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20545 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20546 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20547         fn drop(&mut self) {
20548                 if self.result_ok {
20549                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20550                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20551                         }
20552                 } else {
20553                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20554                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20555                         }
20556                 }
20557         }
20558 }
20559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20560         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20561                 let contents = if o.result_ok {
20562                         let result = unsafe { o.contents.result };
20563                         unsafe { o.contents.result = core::ptr::null_mut() };
20564                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20565                 } else {
20566                         let err = unsafe { o.contents.err };
20567                         unsafe { o.contents.err = core::ptr::null_mut(); }
20568                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20569                 };
20570                 Self {
20571                         contents,
20572                         result_ok: o.result_ok,
20573                 }
20574         }
20575 }
20576 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20577         fn clone(&self) -> Self {
20578                 if self.result_ok {
20579                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20580                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20581                         } }
20582                 } else {
20583                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20584                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20585                         } }
20586                 }
20587         }
20588 }
20589 #[no_mangle]
20590 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20591 /// but with all dynamically-allocated buffers duplicated in new buffers.
20592 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20593 #[repr(C)]
20594 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20595 /// This corresponds to std::vector in C++
20596 pub struct CVec_PhantomRouteHintsZ {
20597         /// The elements in the array.
20598         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20599         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20600         /// The number of elements pointed to by `data`.
20601         pub datalen: usize
20602 }
20603 impl CVec_PhantomRouteHintsZ {
20604         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20605                 if self.datalen == 0 { return Vec::new(); }
20606                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20607                 self.data = core::ptr::null_mut();
20608                 self.datalen = 0;
20609                 ret
20610         }
20611         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20612                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20613         }
20614 }
20615 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20616         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20617                 let datalen = v.len();
20618                 let data = Box::into_raw(v.into_boxed_slice());
20619                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20620         }
20621 }
20622 #[no_mangle]
20623 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20624 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20625 impl Drop for CVec_PhantomRouteHintsZ {
20626         fn drop(&mut self) {
20627                 if self.datalen == 0 { return; }
20628                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20629         }
20630 }
20631 impl Clone for CVec_PhantomRouteHintsZ {
20632         fn clone(&self) -> Self {
20633                 let mut res = Vec::new();
20634                 if self.datalen == 0 { return Self::from(res); }
20635                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20636                 Self::from(res)
20637         }
20638 }
20639 #[repr(C)]
20640 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20641 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20642         /// A pointer to the contents in the success state.
20643         /// Reading from this pointer when `result_ok` is not set is undefined.
20644         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20645         /// A pointer to the contents in the error state.
20646         /// Reading from this pointer when `result_ok` is set is undefined.
20647         pub err: *mut crate::lightning_invoice::SignOrCreationError,
20648 }
20649 #[repr(C)]
20650 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20651 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20653 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20654         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20655         /// `err` or `result` depending on the state of `result_ok`.
20656         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20657         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20658         pub result_ok: bool,
20659 }
20660 #[no_mangle]
20661 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20662 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20663         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20664                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20665                         result: Box::into_raw(Box::new(o)),
20666                 },
20667                 result_ok: true,
20668         }
20669 }
20670 #[no_mangle]
20671 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20672 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20673         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20674                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20675                         err: Box::into_raw(Box::new(e)),
20676                 },
20677                 result_ok: false,
20678         }
20679 }
20680 /// Checks if the given object is currently in the success state
20681 #[no_mangle]
20682 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20683         o.result_ok
20684 }
20685 #[no_mangle]
20686 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20687 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20688 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20689         fn drop(&mut self) {
20690                 if self.result_ok {
20691                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20692                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20693                         }
20694                 } else {
20695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20697                         }
20698                 }
20699         }
20700 }
20701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20703                 let contents = if o.result_ok {
20704                         let result = unsafe { o.contents.result };
20705                         unsafe { o.contents.result = core::ptr::null_mut() };
20706                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20707                 } else {
20708                         let err = unsafe { o.contents.err };
20709                         unsafe { o.contents.err = core::ptr::null_mut(); }
20710                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20711                 };
20712                 Self {
20713                         contents,
20714                         result_ok: o.result_ok,
20715                 }
20716         }
20717 }
20718 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20719         fn clone(&self) -> Self {
20720                 if self.result_ok {
20721                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20722                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20723                         } }
20724                 } else {
20725                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20726                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20727                         } }
20728                 }
20729         }
20730 }
20731 #[no_mangle]
20732 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20733 /// but with all dynamically-allocated buffers duplicated in new buffers.
20734 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20735 #[repr(C)]
20736 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
20737 /// This corresponds to std::vector in C++
20738 pub struct CVec_FutureZ {
20739         /// The elements in the array.
20740         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20741         pub data: *mut crate::lightning::util::wakers::Future,
20742         /// The number of elements pointed to by `data`.
20743         pub datalen: usize
20744 }
20745 impl CVec_FutureZ {
20746         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
20747                 if self.datalen == 0 { return Vec::new(); }
20748                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20749                 self.data = core::ptr::null_mut();
20750                 self.datalen = 0;
20751                 ret
20752         }
20753         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
20754                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20755         }
20756 }
20757 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
20758         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
20759                 let datalen = v.len();
20760                 let data = Box::into_raw(v.into_boxed_slice());
20761                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20762         }
20763 }
20764 #[no_mangle]
20765 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20766 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
20767 impl Drop for CVec_FutureZ {
20768         fn drop(&mut self) {
20769                 if self.datalen == 0 { return; }
20770                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20771         }
20772 }
20773 #[repr(C)]
20774 /// The contents of CResult_OffersMessageDecodeErrorZ
20775 pub union CResult_OffersMessageDecodeErrorZPtr {
20776         /// A pointer to the contents in the success state.
20777         /// Reading from this pointer when `result_ok` is not set is undefined.
20778         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
20779         /// A pointer to the contents in the error state.
20780         /// Reading from this pointer when `result_ok` is set is undefined.
20781         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20782 }
20783 #[repr(C)]
20784 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
20785 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20787 pub struct CResult_OffersMessageDecodeErrorZ {
20788         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
20789         /// `err` or `result` depending on the state of `result_ok`.
20790         pub contents: CResult_OffersMessageDecodeErrorZPtr,
20791         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
20792         pub result_ok: bool,
20793 }
20794 #[no_mangle]
20795 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
20796 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
20797         CResult_OffersMessageDecodeErrorZ {
20798                 contents: CResult_OffersMessageDecodeErrorZPtr {
20799                         result: Box::into_raw(Box::new(o)),
20800                 },
20801                 result_ok: true,
20802         }
20803 }
20804 #[no_mangle]
20805 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
20806 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
20807         CResult_OffersMessageDecodeErrorZ {
20808                 contents: CResult_OffersMessageDecodeErrorZPtr {
20809                         err: Box::into_raw(Box::new(e)),
20810                 },
20811                 result_ok: false,
20812         }
20813 }
20814 /// Checks if the given object is currently in the success state
20815 #[no_mangle]
20816 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
20817         o.result_ok
20818 }
20819 #[no_mangle]
20820 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
20821 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
20822 impl Drop for CResult_OffersMessageDecodeErrorZ {
20823         fn drop(&mut self) {
20824                 if self.result_ok {
20825                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20826                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20827                         }
20828                 } else {
20829                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20830                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20831                         }
20832                 }
20833         }
20834 }
20835 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
20836         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20837                 let contents = if o.result_ok {
20838                         let result = unsafe { o.contents.result };
20839                         unsafe { o.contents.result = core::ptr::null_mut() };
20840                         CResult_OffersMessageDecodeErrorZPtr { result }
20841                 } else {
20842                         let err = unsafe { o.contents.err };
20843                         unsafe { o.contents.err = core::ptr::null_mut(); }
20844                         CResult_OffersMessageDecodeErrorZPtr { err }
20845                 };
20846                 Self {
20847                         contents,
20848                         result_ok: o.result_ok,
20849                 }
20850         }
20851 }
20852 impl Clone for CResult_OffersMessageDecodeErrorZ {
20853         fn clone(&self) -> Self {
20854                 if self.result_ok {
20855                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
20856                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
20857                         } }
20858                 } else {
20859                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
20860                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20861                         } }
20862                 }
20863         }
20864 }
20865 #[no_mangle]
20866 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
20867 /// but with all dynamically-allocated buffers duplicated in new buffers.
20868 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
20869 #[repr(C)]
20870 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
20871 pub enum COption_HTLCClaimZ {
20872         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
20873         Some(crate::lightning::ln::chan_utils::HTLCClaim),
20874         /// When we're in this state, this COption_HTLCClaimZ contains nothing
20875         None
20876 }
20877 impl COption_HTLCClaimZ {
20878         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20879                 if let Self::None = self { false } else { true }
20880         }
20881         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20882                 !self.is_some()
20883         }
20884         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
20885                 if let Self::Some(v) = self { v } else { unreachable!() }
20886         }
20887 }
20888 #[no_mangle]
20889 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
20890 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
20891         COption_HTLCClaimZ::Some(o)
20892 }
20893 #[no_mangle]
20894 /// Constructs a new COption_HTLCClaimZ containing nothing
20895 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
20896         COption_HTLCClaimZ::None
20897 }
20898 #[no_mangle]
20899 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
20900 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
20901 #[repr(C)]
20902 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
20903 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20904         /// A pointer to the contents in the success state.
20905         /// Reading from this pointer when `result_ok` is not set is undefined.
20906         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
20907         /// A pointer to the contents in the error state.
20908         /// Reading from this pointer when `result_ok` is set is undefined.
20909         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20910 }
20911 #[repr(C)]
20912 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
20913 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
20914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20915 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20916         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
20917         /// `err` or `result` depending on the state of `result_ok`.
20918         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
20919         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
20920         pub result_ok: bool,
20921 }
20922 #[no_mangle]
20923 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
20924 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20925         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20926                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20927                         result: Box::into_raw(Box::new(o)),
20928                 },
20929                 result_ok: true,
20930         }
20931 }
20932 #[no_mangle]
20933 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
20934 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20935         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20936                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20937                         err: Box::into_raw(Box::new(e)),
20938                 },
20939                 result_ok: false,
20940         }
20941 }
20942 /// Checks if the given object is currently in the success state
20943 #[no_mangle]
20944 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
20945         o.result_ok
20946 }
20947 #[no_mangle]
20948 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
20949 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
20950 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20951         fn drop(&mut self) {
20952                 if self.result_ok {
20953                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20954                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20955                         }
20956                 } else {
20957                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20958                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20959                         }
20960                 }
20961         }
20962 }
20963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20964         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
20965                 let contents = if o.result_ok {
20966                         let result = unsafe { o.contents.result };
20967                         unsafe { o.contents.result = core::ptr::null_mut() };
20968                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
20969                 } else {
20970                         let err = unsafe { o.contents.err };
20971                         unsafe { o.contents.err = core::ptr::null_mut(); }
20972                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
20973                 };
20974                 Self {
20975                         contents,
20976                         result_ok: o.result_ok,
20977                 }
20978         }
20979 }
20980 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20981         fn clone(&self) -> Self {
20982                 if self.result_ok {
20983                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20984                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
20985                         } }
20986                 } else {
20987                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20988                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20989                         } }
20990                 }
20991         }
20992 }
20993 #[no_mangle]
20994 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
20995 /// but with all dynamically-allocated buffers duplicated in new buffers.
20996 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
20997 #[repr(C)]
20998 /// The contents of CResult_TxCreationKeysDecodeErrorZ
20999 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21000         /// A pointer to the contents in the success state.
21001         /// Reading from this pointer when `result_ok` is not set is undefined.
21002         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21003         /// A pointer to the contents in the error state.
21004         /// Reading from this pointer when `result_ok` is set is undefined.
21005         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21006 }
21007 #[repr(C)]
21008 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21009 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21011 pub struct CResult_TxCreationKeysDecodeErrorZ {
21012         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21013         /// `err` or `result` depending on the state of `result_ok`.
21014         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21015         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21016         pub result_ok: bool,
21017 }
21018 #[no_mangle]
21019 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21020 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21021         CResult_TxCreationKeysDecodeErrorZ {
21022                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21023                         result: Box::into_raw(Box::new(o)),
21024                 },
21025                 result_ok: true,
21026         }
21027 }
21028 #[no_mangle]
21029 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21030 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21031         CResult_TxCreationKeysDecodeErrorZ {
21032                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21033                         err: Box::into_raw(Box::new(e)),
21034                 },
21035                 result_ok: false,
21036         }
21037 }
21038 /// Checks if the given object is currently in the success state
21039 #[no_mangle]
21040 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21041         o.result_ok
21042 }
21043 #[no_mangle]
21044 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21045 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21046 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21047         fn drop(&mut self) {
21048                 if self.result_ok {
21049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21051                         }
21052                 } else {
21053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21055                         }
21056                 }
21057         }
21058 }
21059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21061                 let contents = if o.result_ok {
21062                         let result = unsafe { o.contents.result };
21063                         unsafe { o.contents.result = core::ptr::null_mut() };
21064                         CResult_TxCreationKeysDecodeErrorZPtr { result }
21065                 } else {
21066                         let err = unsafe { o.contents.err };
21067                         unsafe { o.contents.err = core::ptr::null_mut(); }
21068                         CResult_TxCreationKeysDecodeErrorZPtr { err }
21069                 };
21070                 Self {
21071                         contents,
21072                         result_ok: o.result_ok,
21073                 }
21074         }
21075 }
21076 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21077         fn clone(&self) -> Self {
21078                 if self.result_ok {
21079                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21080                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21081                         } }
21082                 } else {
21083                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21085                         } }
21086                 }
21087         }
21088 }
21089 #[no_mangle]
21090 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21091 /// but with all dynamically-allocated buffers duplicated in new buffers.
21092 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21093 #[repr(C)]
21094 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21095 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
21096         /// A pointer to the contents in the success state.
21097         /// Reading from this pointer when `result_ok` is not set is undefined.
21098         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
21099         /// A pointer to the contents in the error state.
21100         /// Reading from this pointer when `result_ok` is set is undefined.
21101         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21102 }
21103 #[repr(C)]
21104 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21105 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21107 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
21108         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21109         /// `err` or `result` depending on the state of `result_ok`.
21110         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21111         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21112         pub result_ok: bool,
21113 }
21114 #[no_mangle]
21115 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21116 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21117         CResult_ChannelPublicKeysDecodeErrorZ {
21118                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21119                         result: Box::into_raw(Box::new(o)),
21120                 },
21121                 result_ok: true,
21122         }
21123 }
21124 #[no_mangle]
21125 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21126 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21127         CResult_ChannelPublicKeysDecodeErrorZ {
21128                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21129                         err: Box::into_raw(Box::new(e)),
21130                 },
21131                 result_ok: false,
21132         }
21133 }
21134 /// Checks if the given object is currently in the success state
21135 #[no_mangle]
21136 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21137         o.result_ok
21138 }
21139 #[no_mangle]
21140 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21141 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21142 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
21143         fn drop(&mut self) {
21144                 if self.result_ok {
21145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21147                         }
21148                 } else {
21149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21151                         }
21152                 }
21153         }
21154 }
21155 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21156         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21157                 let contents = if o.result_ok {
21158                         let result = unsafe { o.contents.result };
21159                         unsafe { o.contents.result = core::ptr::null_mut() };
21160                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
21161                 } else {
21162                         let err = unsafe { o.contents.err };
21163                         unsafe { o.contents.err = core::ptr::null_mut(); }
21164                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21165                 };
21166                 Self {
21167                         contents,
21168                         result_ok: o.result_ok,
21169                 }
21170         }
21171 }
21172 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21173         fn clone(&self) -> Self {
21174                 if self.result_ok {
21175                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21176                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21177                         } }
21178                 } else {
21179                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21180                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21181                         } }
21182                 }
21183         }
21184 }
21185 #[no_mangle]
21186 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21187 /// but with all dynamically-allocated buffers duplicated in new buffers.
21188 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
21189 #[repr(C)]
21190 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
21191 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21192         /// A pointer to the contents in the success state.
21193         /// Reading from this pointer when `result_ok` is not set is undefined.
21194         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
21195         /// A pointer to the contents in the error state.
21196         /// Reading from this pointer when `result_ok` is set is undefined.
21197         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21198 }
21199 #[repr(C)]
21200 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
21201 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
21202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21203 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
21204         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
21205         /// `err` or `result` depending on the state of `result_ok`.
21206         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
21207         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
21208         pub result_ok: bool,
21209 }
21210 #[no_mangle]
21211 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
21212 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21213         CResult_HTLCOutputInCommitmentDecodeErrorZ {
21214                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21215                         result: Box::into_raw(Box::new(o)),
21216                 },
21217                 result_ok: true,
21218         }
21219 }
21220 #[no_mangle]
21221 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
21222 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21223         CResult_HTLCOutputInCommitmentDecodeErrorZ {
21224                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21225                         err: Box::into_raw(Box::new(e)),
21226                 },
21227                 result_ok: false,
21228         }
21229 }
21230 /// Checks if the given object is currently in the success state
21231 #[no_mangle]
21232 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
21233         o.result_ok
21234 }
21235 #[no_mangle]
21236 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
21237 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
21238 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21239         fn drop(&mut self) {
21240                 if self.result_ok {
21241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21243                         }
21244                 } else {
21245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21247                         }
21248                 }
21249         }
21250 }
21251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21252         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
21253                 let contents = if o.result_ok {
21254                         let result = unsafe { o.contents.result };
21255                         unsafe { o.contents.result = core::ptr::null_mut() };
21256                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
21257                 } else {
21258                         let err = unsafe { o.contents.err };
21259                         unsafe { o.contents.err = core::ptr::null_mut(); }
21260                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
21261                 };
21262                 Self {
21263                         contents,
21264                         result_ok: o.result_ok,
21265                 }
21266         }
21267 }
21268 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21269         fn clone(&self) -> Self {
21270                 if self.result_ok {
21271                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21272                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
21273                         } }
21274                 } else {
21275                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21276                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21277                         } }
21278                 }
21279         }
21280 }
21281 #[no_mangle]
21282 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
21283 /// but with all dynamically-allocated buffers duplicated in new buffers.
21284 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
21285 #[repr(C)]
21286 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
21287 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21288         /// A pointer to the contents in the success state.
21289         /// Reading from this pointer when `result_ok` is not set is undefined.
21290         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
21291         /// A pointer to the contents in the error state.
21292         /// Reading from this pointer when `result_ok` is set is undefined.
21293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21294 }
21295 #[repr(C)]
21296 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21297 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21299 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21300         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
21301         /// `err` or `result` depending on the state of `result_ok`.
21302         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
21303         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
21304         pub result_ok: bool,
21305 }
21306 #[no_mangle]
21307 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
21308 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21309         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21310                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21311                         result: Box::into_raw(Box::new(o)),
21312                 },
21313                 result_ok: true,
21314         }
21315 }
21316 #[no_mangle]
21317 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
21318 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21319         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21320                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21321                         err: Box::into_raw(Box::new(e)),
21322                 },
21323                 result_ok: false,
21324         }
21325 }
21326 /// Checks if the given object is currently in the success state
21327 #[no_mangle]
21328 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
21329         o.result_ok
21330 }
21331 #[no_mangle]
21332 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
21333 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
21334 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21335         fn drop(&mut self) {
21336                 if self.result_ok {
21337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21339                         }
21340                 } else {
21341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21343                         }
21344                 }
21345         }
21346 }
21347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21349                 let contents = if o.result_ok {
21350                         let result = unsafe { o.contents.result };
21351                         unsafe { o.contents.result = core::ptr::null_mut() };
21352                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
21353                 } else {
21354                         let err = unsafe { o.contents.err };
21355                         unsafe { o.contents.err = core::ptr::null_mut(); }
21356                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
21357                 };
21358                 Self {
21359                         contents,
21360                         result_ok: o.result_ok,
21361                 }
21362         }
21363 }
21364 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21365         fn clone(&self) -> Self {
21366                 if self.result_ok {
21367                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21368                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21369                         } }
21370                 } else {
21371                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21373                         } }
21374                 }
21375         }
21376 }
21377 #[no_mangle]
21378 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21379 /// but with all dynamically-allocated buffers duplicated in new buffers.
21380 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21381 #[repr(C)]
21382 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
21383 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
21384         /// A pointer to the contents in the success state.
21385         /// Reading from this pointer when `result_ok` is not set is undefined.
21386         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
21387         /// A pointer to the contents in the error state.
21388         /// Reading from this pointer when `result_ok` is set is undefined.
21389         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21390 }
21391 #[repr(C)]
21392 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21393 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21395 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
21396         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
21397         /// `err` or `result` depending on the state of `result_ok`.
21398         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
21399         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
21400         pub result_ok: bool,
21401 }
21402 #[no_mangle]
21403 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
21404 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21405         CResult_ChannelTransactionParametersDecodeErrorZ {
21406                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21407                         result: Box::into_raw(Box::new(o)),
21408                 },
21409                 result_ok: true,
21410         }
21411 }
21412 #[no_mangle]
21413 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
21414 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21415         CResult_ChannelTransactionParametersDecodeErrorZ {
21416                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21417                         err: Box::into_raw(Box::new(e)),
21418                 },
21419                 result_ok: false,
21420         }
21421 }
21422 /// Checks if the given object is currently in the success state
21423 #[no_mangle]
21424 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
21425         o.result_ok
21426 }
21427 #[no_mangle]
21428 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
21429 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
21430 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
21431         fn drop(&mut self) {
21432                 if self.result_ok {
21433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21435                         }
21436                 } else {
21437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21439                         }
21440                 }
21441         }
21442 }
21443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
21444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21445                 let contents = if o.result_ok {
21446                         let result = unsafe { o.contents.result };
21447                         unsafe { o.contents.result = core::ptr::null_mut() };
21448                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
21449                 } else {
21450                         let err = unsafe { o.contents.err };
21451                         unsafe { o.contents.err = core::ptr::null_mut(); }
21452                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
21453                 };
21454                 Self {
21455                         contents,
21456                         result_ok: o.result_ok,
21457                 }
21458         }
21459 }
21460 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
21461         fn clone(&self) -> Self {
21462                 if self.result_ok {
21463                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21464                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21465                         } }
21466                 } else {
21467                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21468                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21469                         } }
21470                 }
21471         }
21472 }
21473 #[no_mangle]
21474 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21475 /// but with all dynamically-allocated buffers duplicated in new buffers.
21476 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21477 #[repr(C)]
21478 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
21479 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21480         /// A pointer to the contents in the success state.
21481         /// Reading from this pointer when `result_ok` is not set is undefined.
21482         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
21483         /// A pointer to the contents in the error state.
21484         /// Reading from this pointer when `result_ok` is set is undefined.
21485         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21486 }
21487 #[repr(C)]
21488 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21489 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21491 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
21492         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
21493         /// `err` or `result` depending on the state of `result_ok`.
21494         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
21495         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
21496         pub result_ok: bool,
21497 }
21498 #[no_mangle]
21499 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
21500 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21501         CResult_HolderCommitmentTransactionDecodeErrorZ {
21502                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21503                         result: Box::into_raw(Box::new(o)),
21504                 },
21505                 result_ok: true,
21506         }
21507 }
21508 #[no_mangle]
21509 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
21510 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21511         CResult_HolderCommitmentTransactionDecodeErrorZ {
21512                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21513                         err: Box::into_raw(Box::new(e)),
21514                 },
21515                 result_ok: false,
21516         }
21517 }
21518 /// Checks if the given object is currently in the success state
21519 #[no_mangle]
21520 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
21521         o.result_ok
21522 }
21523 #[no_mangle]
21524 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
21525 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
21526 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
21527         fn drop(&mut self) {
21528                 if self.result_ok {
21529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21531                         }
21532                 } else {
21533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21535                         }
21536                 }
21537         }
21538 }
21539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
21540         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21541                 let contents = if o.result_ok {
21542                         let result = unsafe { o.contents.result };
21543                         unsafe { o.contents.result = core::ptr::null_mut() };
21544                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
21545                 } else {
21546                         let err = unsafe { o.contents.err };
21547                         unsafe { o.contents.err = core::ptr::null_mut(); }
21548                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
21549                 };
21550                 Self {
21551                         contents,
21552                         result_ok: o.result_ok,
21553                 }
21554         }
21555 }
21556 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
21557         fn clone(&self) -> Self {
21558                 if self.result_ok {
21559                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21560                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21561                         } }
21562                 } else {
21563                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21564                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21565                         } }
21566                 }
21567         }
21568 }
21569 #[no_mangle]
21570 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21571 /// but with all dynamically-allocated buffers duplicated in new buffers.
21572 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21573 #[repr(C)]
21574 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
21575 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21576         /// A pointer to the contents in the success state.
21577         /// Reading from this pointer when `result_ok` is not set is undefined.
21578         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
21579         /// A pointer to the contents in the error state.
21580         /// Reading from this pointer when `result_ok` is set is undefined.
21581         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21582 }
21583 #[repr(C)]
21584 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21585 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21587 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
21588         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
21589         /// `err` or `result` depending on the state of `result_ok`.
21590         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
21591         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
21592         pub result_ok: bool,
21593 }
21594 #[no_mangle]
21595 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
21596 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21597         CResult_BuiltCommitmentTransactionDecodeErrorZ {
21598                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21599                         result: Box::into_raw(Box::new(o)),
21600                 },
21601                 result_ok: true,
21602         }
21603 }
21604 #[no_mangle]
21605 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
21606 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21607         CResult_BuiltCommitmentTransactionDecodeErrorZ {
21608                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21609                         err: Box::into_raw(Box::new(e)),
21610                 },
21611                 result_ok: false,
21612         }
21613 }
21614 /// Checks if the given object is currently in the success state
21615 #[no_mangle]
21616 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
21617         o.result_ok
21618 }
21619 #[no_mangle]
21620 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
21621 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
21622 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21623         fn drop(&mut self) {
21624                 if self.result_ok {
21625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21627                         }
21628                 } else {
21629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21631                         }
21632                 }
21633         }
21634 }
21635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21637                 let contents = if o.result_ok {
21638                         let result = unsafe { o.contents.result };
21639                         unsafe { o.contents.result = core::ptr::null_mut() };
21640                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
21641                 } else {
21642                         let err = unsafe { o.contents.err };
21643                         unsafe { o.contents.err = core::ptr::null_mut(); }
21644                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
21645                 };
21646                 Self {
21647                         contents,
21648                         result_ok: o.result_ok,
21649                 }
21650         }
21651 }
21652 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21653         fn clone(&self) -> Self {
21654                 if self.result_ok {
21655                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21656                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21657                         } }
21658                 } else {
21659                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21661                         } }
21662                 }
21663         }
21664 }
21665 #[no_mangle]
21666 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21667 /// but with all dynamically-allocated buffers duplicated in new buffers.
21668 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21669 #[repr(C)]
21670 /// The contents of CResult_TrustedClosingTransactionNoneZ
21671 pub union CResult_TrustedClosingTransactionNoneZPtr {
21672         /// A pointer to the contents in the success state.
21673         /// Reading from this pointer when `result_ok` is not set is undefined.
21674         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
21675         /// Note that this value is always NULL, as there are no contents in the Err variant
21676         pub err: *mut core::ffi::c_void,
21677 }
21678 #[repr(C)]
21679 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
21680 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
21681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21682 pub struct CResult_TrustedClosingTransactionNoneZ {
21683         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
21684         /// `err` or `result` depending on the state of `result_ok`.
21685         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
21686         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
21687         pub result_ok: bool,
21688 }
21689 #[no_mangle]
21690 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
21691 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
21692         CResult_TrustedClosingTransactionNoneZ {
21693                 contents: CResult_TrustedClosingTransactionNoneZPtr {
21694                         result: Box::into_raw(Box::new(o)),
21695                 },
21696                 result_ok: true,
21697         }
21698 }
21699 #[no_mangle]
21700 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
21701 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
21702         CResult_TrustedClosingTransactionNoneZ {
21703                 contents: CResult_TrustedClosingTransactionNoneZPtr {
21704                         err: core::ptr::null_mut(),
21705                 },
21706                 result_ok: false,
21707         }
21708 }
21709 /// Checks if the given object is currently in the success state
21710 #[no_mangle]
21711 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
21712         o.result_ok
21713 }
21714 #[no_mangle]
21715 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
21716 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
21717 impl Drop for CResult_TrustedClosingTransactionNoneZ {
21718         fn drop(&mut self) {
21719                 if self.result_ok {
21720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21722                         }
21723                 } else {
21724                 }
21725         }
21726 }
21727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
21728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
21729                 let contents = if o.result_ok {
21730                         let result = unsafe { o.contents.result };
21731                         unsafe { o.contents.result = core::ptr::null_mut() };
21732                         CResult_TrustedClosingTransactionNoneZPtr { result }
21733                 } else {
21734                         let _ = unsafe { Box::from_raw(o.contents.err) };
21735                         o.contents.err = core::ptr::null_mut();
21736                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
21737                 };
21738                 Self {
21739                         contents,
21740                         result_ok: o.result_ok,
21741                 }
21742         }
21743 }
21744 #[repr(C)]
21745 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
21746 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
21747         /// A pointer to the contents in the success state.
21748         /// Reading from this pointer when `result_ok` is not set is undefined.
21749         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
21750         /// A pointer to the contents in the error state.
21751         /// Reading from this pointer when `result_ok` is set is undefined.
21752         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21753 }
21754 #[repr(C)]
21755 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21756 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21758 pub struct CResult_CommitmentTransactionDecodeErrorZ {
21759         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
21760         /// `err` or `result` depending on the state of `result_ok`.
21761         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
21762         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
21763         pub result_ok: bool,
21764 }
21765 #[no_mangle]
21766 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
21767 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
21768         CResult_CommitmentTransactionDecodeErrorZ {
21769                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21770                         result: Box::into_raw(Box::new(o)),
21771                 },
21772                 result_ok: true,
21773         }
21774 }
21775 #[no_mangle]
21776 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
21777 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
21778         CResult_CommitmentTransactionDecodeErrorZ {
21779                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21780                         err: Box::into_raw(Box::new(e)),
21781                 },
21782                 result_ok: false,
21783         }
21784 }
21785 /// Checks if the given object is currently in the success state
21786 #[no_mangle]
21787 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
21788         o.result_ok
21789 }
21790 #[no_mangle]
21791 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
21792 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
21793 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
21794         fn drop(&mut self) {
21795                 if self.result_ok {
21796                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21797                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21798                         }
21799                 } else {
21800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21802                         }
21803                 }
21804         }
21805 }
21806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
21807         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21808                 let contents = if o.result_ok {
21809                         let result = unsafe { o.contents.result };
21810                         unsafe { o.contents.result = core::ptr::null_mut() };
21811                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
21812                 } else {
21813                         let err = unsafe { o.contents.err };
21814                         unsafe { o.contents.err = core::ptr::null_mut(); }
21815                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
21816                 };
21817                 Self {
21818                         contents,
21819                         result_ok: o.result_ok,
21820                 }
21821         }
21822 }
21823 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
21824         fn clone(&self) -> Self {
21825                 if self.result_ok {
21826                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21827                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21828                         } }
21829                 } else {
21830                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21831                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21832                         } }
21833                 }
21834         }
21835 }
21836 #[no_mangle]
21837 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
21838 /// but with all dynamically-allocated buffers duplicated in new buffers.
21839 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21840 #[repr(C)]
21841 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
21842 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
21843         /// A pointer to the contents in the success state.
21844         /// Reading from this pointer when `result_ok` is not set is undefined.
21845         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
21846         /// Note that this value is always NULL, as there are no contents in the Err variant
21847         pub err: *mut core::ffi::c_void,
21848 }
21849 #[repr(C)]
21850 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
21851 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
21852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21853 pub struct CResult_TrustedCommitmentTransactionNoneZ {
21854         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
21855         /// `err` or `result` depending on the state of `result_ok`.
21856         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
21857         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
21858         pub result_ok: bool,
21859 }
21860 #[no_mangle]
21861 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
21862 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
21863         CResult_TrustedCommitmentTransactionNoneZ {
21864                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
21865                         result: Box::into_raw(Box::new(o)),
21866                 },
21867                 result_ok: true,
21868         }
21869 }
21870 #[no_mangle]
21871 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
21872 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
21873         CResult_TrustedCommitmentTransactionNoneZ {
21874                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
21875                         err: core::ptr::null_mut(),
21876                 },
21877                 result_ok: false,
21878         }
21879 }
21880 /// Checks if the given object is currently in the success state
21881 #[no_mangle]
21882 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
21883         o.result_ok
21884 }
21885 #[no_mangle]
21886 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
21887 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
21888 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
21889         fn drop(&mut self) {
21890                 if self.result_ok {
21891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21893                         }
21894                 } else {
21895                 }
21896         }
21897 }
21898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
21899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
21900                 let contents = if o.result_ok {
21901                         let result = unsafe { o.contents.result };
21902                         unsafe { o.contents.result = core::ptr::null_mut() };
21903                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
21904                 } else {
21905                         let _ = unsafe { Box::from_raw(o.contents.err) };
21906                         o.contents.err = core::ptr::null_mut();
21907                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
21908                 };
21909                 Self {
21910                         contents,
21911                         result_ok: o.result_ok,
21912                 }
21913         }
21914 }
21915 #[repr(C)]
21916 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
21917 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
21918         /// A pointer to the contents in the success state.
21919         /// Reading from this pointer when `result_ok` is not set is undefined.
21920         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
21921         /// Note that this value is always NULL, as there are no contents in the Err variant
21922         pub err: *mut core::ffi::c_void,
21923 }
21924 #[repr(C)]
21925 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
21926 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
21927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21928 pub struct CResult_CVec_ECDSASignatureZNoneZ {
21929         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
21930         /// `err` or `result` depending on the state of `result_ok`.
21931         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
21932         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
21933         pub result_ok: bool,
21934 }
21935 #[no_mangle]
21936 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
21937 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
21938         CResult_CVec_ECDSASignatureZNoneZ {
21939                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21940                         result: Box::into_raw(Box::new(o)),
21941                 },
21942                 result_ok: true,
21943         }
21944 }
21945 #[no_mangle]
21946 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
21947 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
21948         CResult_CVec_ECDSASignatureZNoneZ {
21949                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21950                         err: core::ptr::null_mut(),
21951                 },
21952                 result_ok: false,
21953         }
21954 }
21955 /// Checks if the given object is currently in the success state
21956 #[no_mangle]
21957 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
21958         o.result_ok
21959 }
21960 #[no_mangle]
21961 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
21962 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
21963 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
21964         fn drop(&mut self) {
21965                 if self.result_ok {
21966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21968                         }
21969                 } else {
21970                 }
21971         }
21972 }
21973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
21974         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
21975                 let contents = if o.result_ok {
21976                         let result = unsafe { o.contents.result };
21977                         unsafe { o.contents.result = core::ptr::null_mut() };
21978                         CResult_CVec_ECDSASignatureZNoneZPtr { result }
21979                 } else {
21980                         let _ = unsafe { Box::from_raw(o.contents.err) };
21981                         o.contents.err = core::ptr::null_mut();
21982                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
21983                 };
21984                 Self {
21985                         contents,
21986                         result_ok: o.result_ok,
21987                 }
21988         }
21989 }
21990 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
21991         fn clone(&self) -> Self {
21992                 if self.result_ok {
21993                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21994                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
21995                         } }
21996                 } else {
21997                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21998                                 err: core::ptr::null_mut()
21999                         } }
22000                 }
22001         }
22002 }
22003 #[no_mangle]
22004 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22005 /// but with all dynamically-allocated buffers duplicated in new buffers.
22006 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22007 #[repr(C)]
22008 #[derive(Clone)]
22009 /// An enum which can either contain a usize or not
22010 pub enum COption_usizeZ {
22011         /// When we're in this state, this COption_usizeZ contains a usize
22012         Some(usize),
22013         /// When we're in this state, this COption_usizeZ contains nothing
22014         None
22015 }
22016 impl COption_usizeZ {
22017         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22018                 if let Self::None = self { false } else { true }
22019         }
22020         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22021                 !self.is_some()
22022         }
22023         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22024                 if let Self::Some(v) = self { v } else { unreachable!() }
22025         }
22026 }
22027 #[no_mangle]
22028 /// Constructs a new COption_usizeZ containing a usize
22029 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22030         COption_usizeZ::Some(o)
22031 }
22032 #[no_mangle]
22033 /// Constructs a new COption_usizeZ containing nothing
22034 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22035         COption_usizeZ::None
22036 }
22037 #[no_mangle]
22038 /// Frees any resources associated with the usize, if we are in the Some state
22039 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22040 #[no_mangle]
22041 /// Creates a new COption_usizeZ which has the same data as `orig`
22042 /// but with all dynamically-allocated buffers duplicated in new buffers.
22043 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22044 #[repr(C)]
22045 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22046 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22047         /// A pointer to the contents in the success state.
22048         /// Reading from this pointer when `result_ok` is not set is undefined.
22049         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22050         /// A pointer to the contents in the error state.
22051         /// Reading from this pointer when `result_ok` is set is undefined.
22052         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22053 }
22054 #[repr(C)]
22055 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22056 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22058 pub struct CResult_ShutdownScriptDecodeErrorZ {
22059         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22060         /// `err` or `result` depending on the state of `result_ok`.
22061         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22062         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22063         pub result_ok: bool,
22064 }
22065 #[no_mangle]
22066 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22067 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22068         CResult_ShutdownScriptDecodeErrorZ {
22069                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22070                         result: Box::into_raw(Box::new(o)),
22071                 },
22072                 result_ok: true,
22073         }
22074 }
22075 #[no_mangle]
22076 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22077 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22078         CResult_ShutdownScriptDecodeErrorZ {
22079                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22080                         err: Box::into_raw(Box::new(e)),
22081                 },
22082                 result_ok: false,
22083         }
22084 }
22085 /// Checks if the given object is currently in the success state
22086 #[no_mangle]
22087 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22088         o.result_ok
22089 }
22090 #[no_mangle]
22091 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22092 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22093 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22094         fn drop(&mut self) {
22095                 if self.result_ok {
22096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22098                         }
22099                 } else {
22100                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22101                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22102                         }
22103                 }
22104         }
22105 }
22106 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22107         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22108                 let contents = if o.result_ok {
22109                         let result = unsafe { o.contents.result };
22110                         unsafe { o.contents.result = core::ptr::null_mut() };
22111                         CResult_ShutdownScriptDecodeErrorZPtr { result }
22112                 } else {
22113                         let err = unsafe { o.contents.err };
22114                         unsafe { o.contents.err = core::ptr::null_mut(); }
22115                         CResult_ShutdownScriptDecodeErrorZPtr { err }
22116                 };
22117                 Self {
22118                         contents,
22119                         result_ok: o.result_ok,
22120                 }
22121         }
22122 }
22123 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22124         fn clone(&self) -> Self {
22125                 if self.result_ok {
22126                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22127                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22128                         } }
22129                 } else {
22130                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22131                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22132                         } }
22133                 }
22134         }
22135 }
22136 #[no_mangle]
22137 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22138 /// but with all dynamically-allocated buffers duplicated in new buffers.
22139 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22140 #[repr(C)]
22141 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22142 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22143         /// A pointer to the contents in the success state.
22144         /// Reading from this pointer when `result_ok` is not set is undefined.
22145         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22146         /// A pointer to the contents in the error state.
22147         /// Reading from this pointer when `result_ok` is set is undefined.
22148         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22149 }
22150 #[repr(C)]
22151 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22152 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22154 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22155         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22156         /// `err` or `result` depending on the state of `result_ok`.
22157         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22158         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22159         pub result_ok: bool,
22160 }
22161 #[no_mangle]
22162 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22163 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22164         CResult_ShutdownScriptInvalidShutdownScriptZ {
22165                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22166                         result: Box::into_raw(Box::new(o)),
22167                 },
22168                 result_ok: true,
22169         }
22170 }
22171 #[no_mangle]
22172 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22173 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22174         CResult_ShutdownScriptInvalidShutdownScriptZ {
22175                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22176                         err: Box::into_raw(Box::new(e)),
22177                 },
22178                 result_ok: false,
22179         }
22180 }
22181 /// Checks if the given object is currently in the success state
22182 #[no_mangle]
22183 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22184         o.result_ok
22185 }
22186 #[no_mangle]
22187 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22188 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22189 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
22190         fn drop(&mut self) {
22191                 if self.result_ok {
22192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22194                         }
22195                 } else {
22196                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22197                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22198                         }
22199                 }
22200         }
22201 }
22202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
22203         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
22204                 let contents = if o.result_ok {
22205                         let result = unsafe { o.contents.result };
22206                         unsafe { o.contents.result = core::ptr::null_mut() };
22207                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
22208                 } else {
22209                         let err = unsafe { o.contents.err };
22210                         unsafe { o.contents.err = core::ptr::null_mut(); }
22211                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
22212                 };
22213                 Self {
22214                         contents,
22215                         result_ok: o.result_ok,
22216                 }
22217         }
22218 }
22219 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
22220         fn clone(&self) -> Self {
22221                 if self.result_ok {
22222                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22223                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22224                         } }
22225                 } else {
22226                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22227                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
22228                         } }
22229                 }
22230         }
22231 }
22232 #[no_mangle]
22233 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
22234 /// but with all dynamically-allocated buffers duplicated in new buffers.
22235 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
22236 #[repr(C)]
22237 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
22238 /// This corresponds to std::vector in C++
22239 pub struct CVec_TransactionZ {
22240         /// The elements in the array.
22241         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22242         pub data: *mut crate::c_types::Transaction,
22243         /// The number of elements pointed to by `data`.
22244         pub datalen: usize
22245 }
22246 impl CVec_TransactionZ {
22247         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
22248                 if self.datalen == 0 { return Vec::new(); }
22249                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22250                 self.data = core::ptr::null_mut();
22251                 self.datalen = 0;
22252                 ret
22253         }
22254         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
22255                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22256         }
22257 }
22258 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
22259         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
22260                 let datalen = v.len();
22261                 let data = Box::into_raw(v.into_boxed_slice());
22262                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22263         }
22264 }
22265 #[no_mangle]
22266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22267 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
22268 impl Drop for CVec_TransactionZ {
22269         fn drop(&mut self) {
22270                 if self.datalen == 0 { return; }
22271                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22272         }
22273 }
22274 impl Clone for CVec_TransactionZ {
22275         fn clone(&self) -> Self {
22276                 let mut res = Vec::new();
22277                 if self.datalen == 0 { return Self::from(res); }
22278                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22279                 Self::from(res)
22280         }
22281 }
22282 #[repr(C)]
22283 /// The contents of CResult_PaymentPurposeDecodeErrorZ
22284 pub union CResult_PaymentPurposeDecodeErrorZPtr {
22285         /// A pointer to the contents in the success state.
22286         /// Reading from this pointer when `result_ok` is not set is undefined.
22287         pub result: *mut crate::lightning::events::PaymentPurpose,
22288         /// A pointer to the contents in the error state.
22289         /// Reading from this pointer when `result_ok` is set is undefined.
22290         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22291 }
22292 #[repr(C)]
22293 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
22294 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
22295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22296 pub struct CResult_PaymentPurposeDecodeErrorZ {
22297         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
22298         /// `err` or `result` depending on the state of `result_ok`.
22299         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
22300         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
22301         pub result_ok: bool,
22302 }
22303 #[no_mangle]
22304 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
22305 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
22306         CResult_PaymentPurposeDecodeErrorZ {
22307                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22308                         result: Box::into_raw(Box::new(o)),
22309                 },
22310                 result_ok: true,
22311         }
22312 }
22313 #[no_mangle]
22314 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
22315 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
22316         CResult_PaymentPurposeDecodeErrorZ {
22317                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22318                         err: Box::into_raw(Box::new(e)),
22319                 },
22320                 result_ok: false,
22321         }
22322 }
22323 /// Checks if the given object is currently in the success state
22324 #[no_mangle]
22325 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
22326         o.result_ok
22327 }
22328 #[no_mangle]
22329 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
22330 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
22331 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
22332         fn drop(&mut self) {
22333                 if self.result_ok {
22334                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22335                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22336                         }
22337                 } else {
22338                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22339                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22340                         }
22341                 }
22342         }
22343 }
22344 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
22345         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
22346                 let contents = if o.result_ok {
22347                         let result = unsafe { o.contents.result };
22348                         unsafe { o.contents.result = core::ptr::null_mut() };
22349                         CResult_PaymentPurposeDecodeErrorZPtr { result }
22350                 } else {
22351                         let err = unsafe { o.contents.err };
22352                         unsafe { o.contents.err = core::ptr::null_mut(); }
22353                         CResult_PaymentPurposeDecodeErrorZPtr { err }
22354                 };
22355                 Self {
22356                         contents,
22357                         result_ok: o.result_ok,
22358                 }
22359         }
22360 }
22361 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
22362         fn clone(&self) -> Self {
22363                 if self.result_ok {
22364                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22365                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
22366                         } }
22367                 } else {
22368                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22369                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22370                         } }
22371                 }
22372         }
22373 }
22374 #[no_mangle]
22375 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
22376 /// but with all dynamically-allocated buffers duplicated in new buffers.
22377 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
22378 #[repr(C)]
22379 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
22380 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
22381         /// A pointer to the contents in the success state.
22382         /// Reading from this pointer when `result_ok` is not set is undefined.
22383         pub result: *mut crate::lightning::events::ClaimedHTLC,
22384         /// A pointer to the contents in the error state.
22385         /// Reading from this pointer when `result_ok` is set is undefined.
22386         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22387 }
22388 #[repr(C)]
22389 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
22390 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
22391 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22392 pub struct CResult_ClaimedHTLCDecodeErrorZ {
22393         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
22394         /// `err` or `result` depending on the state of `result_ok`.
22395         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
22396         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
22397         pub result_ok: bool,
22398 }
22399 #[no_mangle]
22400 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
22401 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
22402         CResult_ClaimedHTLCDecodeErrorZ {
22403                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22404                         result: Box::into_raw(Box::new(o)),
22405                 },
22406                 result_ok: true,
22407         }
22408 }
22409 #[no_mangle]
22410 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
22411 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
22412         CResult_ClaimedHTLCDecodeErrorZ {
22413                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22414                         err: Box::into_raw(Box::new(e)),
22415                 },
22416                 result_ok: false,
22417         }
22418 }
22419 /// Checks if the given object is currently in the success state
22420 #[no_mangle]
22421 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
22422         o.result_ok
22423 }
22424 #[no_mangle]
22425 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
22426 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
22427 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
22428         fn drop(&mut self) {
22429                 if self.result_ok {
22430                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22431                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22432                         }
22433                 } else {
22434                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22435                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22436                         }
22437                 }
22438         }
22439 }
22440 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
22441         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
22442                 let contents = if o.result_ok {
22443                         let result = unsafe { o.contents.result };
22444                         unsafe { o.contents.result = core::ptr::null_mut() };
22445                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
22446                 } else {
22447                         let err = unsafe { o.contents.err };
22448                         unsafe { o.contents.err = core::ptr::null_mut(); }
22449                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
22450                 };
22451                 Self {
22452                         contents,
22453                         result_ok: o.result_ok,
22454                 }
22455         }
22456 }
22457 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
22458         fn clone(&self) -> Self {
22459                 if self.result_ok {
22460                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22461                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
22462                         } }
22463                 } else {
22464                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22465                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22466                         } }
22467                 }
22468         }
22469 }
22470 #[no_mangle]
22471 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
22472 /// but with all dynamically-allocated buffers duplicated in new buffers.
22473 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
22474 #[repr(C)]
22475 #[derive(Clone)]
22476 /// An enum which can either contain a crate::lightning::events::PathFailure or not
22477 pub enum COption_PathFailureZ {
22478         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
22479         Some(crate::lightning::events::PathFailure),
22480         /// When we're in this state, this COption_PathFailureZ contains nothing
22481         None
22482 }
22483 impl COption_PathFailureZ {
22484         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22485                 if let Self::None = self { false } else { true }
22486         }
22487         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22488                 !self.is_some()
22489         }
22490         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
22491                 if let Self::Some(v) = self { v } else { unreachable!() }
22492         }
22493 }
22494 #[no_mangle]
22495 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
22496 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
22497         COption_PathFailureZ::Some(o)
22498 }
22499 #[no_mangle]
22500 /// Constructs a new COption_PathFailureZ containing nothing
22501 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
22502         COption_PathFailureZ::None
22503 }
22504 #[no_mangle]
22505 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
22506 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
22507 #[no_mangle]
22508 /// Creates a new COption_PathFailureZ which has the same data as `orig`
22509 /// but with all dynamically-allocated buffers duplicated in new buffers.
22510 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
22511 #[repr(C)]
22512 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
22513 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
22514         /// A pointer to the contents in the success state.
22515         /// Reading from this pointer when `result_ok` is not set is undefined.
22516         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
22517         /// A pointer to the contents in the error state.
22518         /// Reading from this pointer when `result_ok` is set is undefined.
22519         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22520 }
22521 #[repr(C)]
22522 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
22523 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22525 pub struct CResult_COption_PathFailureZDecodeErrorZ {
22526         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
22527         /// `err` or `result` depending on the state of `result_ok`.
22528         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
22529         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
22530         pub result_ok: bool,
22531 }
22532 #[no_mangle]
22533 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
22534 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
22535         CResult_COption_PathFailureZDecodeErrorZ {
22536                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22537                         result: Box::into_raw(Box::new(o)),
22538                 },
22539                 result_ok: true,
22540         }
22541 }
22542 #[no_mangle]
22543 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
22544 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
22545         CResult_COption_PathFailureZDecodeErrorZ {
22546                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22547                         err: Box::into_raw(Box::new(e)),
22548                 },
22549                 result_ok: false,
22550         }
22551 }
22552 /// Checks if the given object is currently in the success state
22553 #[no_mangle]
22554 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
22555         o.result_ok
22556 }
22557 #[no_mangle]
22558 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
22559 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
22560 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
22561         fn drop(&mut self) {
22562                 if self.result_ok {
22563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22565                         }
22566                 } else {
22567                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22568                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22569                         }
22570                 }
22571         }
22572 }
22573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
22574         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22575                 let contents = if o.result_ok {
22576                         let result = unsafe { o.contents.result };
22577                         unsafe { o.contents.result = core::ptr::null_mut() };
22578                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
22579                 } else {
22580                         let err = unsafe { o.contents.err };
22581                         unsafe { o.contents.err = core::ptr::null_mut(); }
22582                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
22583                 };
22584                 Self {
22585                         contents,
22586                         result_ok: o.result_ok,
22587                 }
22588         }
22589 }
22590 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
22591         fn clone(&self) -> Self {
22592                 if self.result_ok {
22593                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22594                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
22595                         } }
22596                 } else {
22597                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22598                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22599                         } }
22600                 }
22601         }
22602 }
22603 #[no_mangle]
22604 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
22605 /// but with all dynamically-allocated buffers duplicated in new buffers.
22606 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
22607 #[repr(C)]
22608 #[derive(Clone)]
22609 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
22610 pub enum COption_ClosureReasonZ {
22611         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
22612         Some(crate::lightning::events::ClosureReason),
22613         /// When we're in this state, this COption_ClosureReasonZ contains nothing
22614         None
22615 }
22616 impl COption_ClosureReasonZ {
22617         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22618                 if let Self::None = self { false } else { true }
22619         }
22620         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22621                 !self.is_some()
22622         }
22623         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
22624                 if let Self::Some(v) = self { v } else { unreachable!() }
22625         }
22626 }
22627 #[no_mangle]
22628 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
22629 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
22630         COption_ClosureReasonZ::Some(o)
22631 }
22632 #[no_mangle]
22633 /// Constructs a new COption_ClosureReasonZ containing nothing
22634 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
22635         COption_ClosureReasonZ::None
22636 }
22637 #[no_mangle]
22638 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
22639 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
22640 #[no_mangle]
22641 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
22642 /// but with all dynamically-allocated buffers duplicated in new buffers.
22643 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
22644 #[repr(C)]
22645 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
22646 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
22647         /// A pointer to the contents in the success state.
22648         /// Reading from this pointer when `result_ok` is not set is undefined.
22649         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
22650         /// A pointer to the contents in the error state.
22651         /// Reading from this pointer when `result_ok` is set is undefined.
22652         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22653 }
22654 #[repr(C)]
22655 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
22656 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22658 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
22659         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
22660         /// `err` or `result` depending on the state of `result_ok`.
22661         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
22662         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
22663         pub result_ok: bool,
22664 }
22665 #[no_mangle]
22666 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
22667 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22668         CResult_COption_ClosureReasonZDecodeErrorZ {
22669                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22670                         result: Box::into_raw(Box::new(o)),
22671                 },
22672                 result_ok: true,
22673         }
22674 }
22675 #[no_mangle]
22676 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
22677 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22678         CResult_COption_ClosureReasonZDecodeErrorZ {
22679                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22680                         err: Box::into_raw(Box::new(e)),
22681                 },
22682                 result_ok: false,
22683         }
22684 }
22685 /// Checks if the given object is currently in the success state
22686 #[no_mangle]
22687 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
22688         o.result_ok
22689 }
22690 #[no_mangle]
22691 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
22692 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
22693 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
22694         fn drop(&mut self) {
22695                 if self.result_ok {
22696                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22697                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22698                         }
22699                 } else {
22700                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22701                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22702                         }
22703                 }
22704         }
22705 }
22706 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
22707         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22708                 let contents = if o.result_ok {
22709                         let result = unsafe { o.contents.result };
22710                         unsafe { o.contents.result = core::ptr::null_mut() };
22711                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
22712                 } else {
22713                         let err = unsafe { o.contents.err };
22714                         unsafe { o.contents.err = core::ptr::null_mut(); }
22715                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
22716                 };
22717                 Self {
22718                         contents,
22719                         result_ok: o.result_ok,
22720                 }
22721         }
22722 }
22723 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
22724         fn clone(&self) -> Self {
22725                 if self.result_ok {
22726                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22727                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
22728                         } }
22729                 } else {
22730                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22731                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22732                         } }
22733                 }
22734         }
22735 }
22736 #[no_mangle]
22737 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
22738 /// but with all dynamically-allocated buffers duplicated in new buffers.
22739 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
22740 #[repr(C)]
22741 #[derive(Clone)]
22742 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
22743 pub enum COption_HTLCDestinationZ {
22744         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
22745         Some(crate::lightning::events::HTLCDestination),
22746         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
22747         None
22748 }
22749 impl COption_HTLCDestinationZ {
22750         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22751                 if let Self::None = self { false } else { true }
22752         }
22753         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22754                 !self.is_some()
22755         }
22756         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
22757                 if let Self::Some(v) = self { v } else { unreachable!() }
22758         }
22759 }
22760 #[no_mangle]
22761 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
22762 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
22763         COption_HTLCDestinationZ::Some(o)
22764 }
22765 #[no_mangle]
22766 /// Constructs a new COption_HTLCDestinationZ containing nothing
22767 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
22768         COption_HTLCDestinationZ::None
22769 }
22770 #[no_mangle]
22771 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
22772 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
22773 #[no_mangle]
22774 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
22775 /// but with all dynamically-allocated buffers duplicated in new buffers.
22776 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
22777 #[repr(C)]
22778 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
22779 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22780         /// A pointer to the contents in the success state.
22781         /// Reading from this pointer when `result_ok` is not set is undefined.
22782         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
22783         /// A pointer to the contents in the error state.
22784         /// Reading from this pointer when `result_ok` is set is undefined.
22785         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22786 }
22787 #[repr(C)]
22788 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
22789 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22791 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
22792         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
22793         /// `err` or `result` depending on the state of `result_ok`.
22794         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
22795         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
22796         pub result_ok: bool,
22797 }
22798 #[no_mangle]
22799 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
22800 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
22801         CResult_COption_HTLCDestinationZDecodeErrorZ {
22802                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22803                         result: Box::into_raw(Box::new(o)),
22804                 },
22805                 result_ok: true,
22806         }
22807 }
22808 #[no_mangle]
22809 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
22810 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
22811         CResult_COption_HTLCDestinationZDecodeErrorZ {
22812                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22813                         err: Box::into_raw(Box::new(e)),
22814                 },
22815                 result_ok: false,
22816         }
22817 }
22818 /// Checks if the given object is currently in the success state
22819 #[no_mangle]
22820 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
22821         o.result_ok
22822 }
22823 #[no_mangle]
22824 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
22825 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
22826 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
22827         fn drop(&mut self) {
22828                 if self.result_ok {
22829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22831                         }
22832                 } else {
22833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22835                         }
22836                 }
22837         }
22838 }
22839 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
22840         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22841                 let contents = if o.result_ok {
22842                         let result = unsafe { o.contents.result };
22843                         unsafe { o.contents.result = core::ptr::null_mut() };
22844                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
22845                 } else {
22846                         let err = unsafe { o.contents.err };
22847                         unsafe { o.contents.err = core::ptr::null_mut(); }
22848                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
22849                 };
22850                 Self {
22851                         contents,
22852                         result_ok: o.result_ok,
22853                 }
22854         }
22855 }
22856 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
22857         fn clone(&self) -> Self {
22858                 if self.result_ok {
22859                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22860                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
22861                         } }
22862                 } else {
22863                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22864                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22865                         } }
22866                 }
22867         }
22868 }
22869 #[no_mangle]
22870 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
22871 /// but with all dynamically-allocated buffers duplicated in new buffers.
22872 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
22873 #[repr(C)]
22874 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
22875 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
22876         /// A pointer to the contents in the success state.
22877         /// Reading from this pointer when `result_ok` is not set is undefined.
22878         pub result: *mut crate::lightning::events::PaymentFailureReason,
22879         /// A pointer to the contents in the error state.
22880         /// Reading from this pointer when `result_ok` is set is undefined.
22881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22882 }
22883 #[repr(C)]
22884 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
22885 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
22886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22887 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
22888         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
22889         /// `err` or `result` depending on the state of `result_ok`.
22890         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
22891         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
22892         pub result_ok: bool,
22893 }
22894 #[no_mangle]
22895 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
22896 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
22897         CResult_PaymentFailureReasonDecodeErrorZ {
22898                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22899                         result: Box::into_raw(Box::new(o)),
22900                 },
22901                 result_ok: true,
22902         }
22903 }
22904 #[no_mangle]
22905 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
22906 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
22907         CResult_PaymentFailureReasonDecodeErrorZ {
22908                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22909                         err: Box::into_raw(Box::new(e)),
22910                 },
22911                 result_ok: false,
22912         }
22913 }
22914 /// Checks if the given object is currently in the success state
22915 #[no_mangle]
22916 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
22917         o.result_ok
22918 }
22919 #[no_mangle]
22920 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
22921 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
22922 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
22923         fn drop(&mut self) {
22924                 if self.result_ok {
22925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22927                         }
22928                 } else {
22929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22931                         }
22932                 }
22933         }
22934 }
22935 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
22936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
22937                 let contents = if o.result_ok {
22938                         let result = unsafe { o.contents.result };
22939                         unsafe { o.contents.result = core::ptr::null_mut() };
22940                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
22941                 } else {
22942                         let err = unsafe { o.contents.err };
22943                         unsafe { o.contents.err = core::ptr::null_mut(); }
22944                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
22945                 };
22946                 Self {
22947                         contents,
22948                         result_ok: o.result_ok,
22949                 }
22950         }
22951 }
22952 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
22953         fn clone(&self) -> Self {
22954                 if self.result_ok {
22955                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22956                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
22957                         } }
22958                 } else {
22959                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22961                         } }
22962                 }
22963         }
22964 }
22965 #[no_mangle]
22966 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
22967 /// but with all dynamically-allocated buffers duplicated in new buffers.
22968 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
22969 #[repr(C)]
22970 #[derive(Clone)]
22971 /// An enum which can either contain a crate::c_types::U128 or not
22972 pub enum COption_U128Z {
22973         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
22974         Some(crate::c_types::U128),
22975         /// When we're in this state, this COption_U128Z contains nothing
22976         None
22977 }
22978 impl COption_U128Z {
22979         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22980                 if let Self::None = self { false } else { true }
22981         }
22982         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22983                 !self.is_some()
22984         }
22985         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
22986                 if let Self::Some(v) = self { v } else { unreachable!() }
22987         }
22988 }
22989 #[no_mangle]
22990 /// Constructs a new COption_U128Z containing a crate::c_types::U128
22991 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
22992         COption_U128Z::Some(o)
22993 }
22994 #[no_mangle]
22995 /// Constructs a new COption_U128Z containing nothing
22996 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
22997         COption_U128Z::None
22998 }
22999 #[no_mangle]
23000 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23001 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23002 #[no_mangle]
23003 /// Creates a new COption_U128Z which has the same data as `orig`
23004 /// but with all dynamically-allocated buffers duplicated in new buffers.
23005 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23006 #[repr(C)]
23007 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23008 /// This corresponds to std::vector in C++
23009 pub struct CVec_ClaimedHTLCZ {
23010         /// The elements in the array.
23011         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23012         pub data: *mut crate::lightning::events::ClaimedHTLC,
23013         /// The number of elements pointed to by `data`.
23014         pub datalen: usize
23015 }
23016 impl CVec_ClaimedHTLCZ {
23017         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23018                 if self.datalen == 0 { return Vec::new(); }
23019                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23020                 self.data = core::ptr::null_mut();
23021                 self.datalen = 0;
23022                 ret
23023         }
23024         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23025                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23026         }
23027 }
23028 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23029         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23030                 let datalen = v.len();
23031                 let data = Box::into_raw(v.into_boxed_slice());
23032                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23033         }
23034 }
23035 #[no_mangle]
23036 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23037 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23038 impl Drop for CVec_ClaimedHTLCZ {
23039         fn drop(&mut self) {
23040                 if self.datalen == 0 { return; }
23041                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23042         }
23043 }
23044 impl Clone for CVec_ClaimedHTLCZ {
23045         fn clone(&self) -> Self {
23046                 let mut res = Vec::new();
23047                 if self.datalen == 0 { return Self::from(res); }
23048                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23049                 Self::from(res)
23050         }
23051 }
23052 #[repr(C)]
23053 #[derive(Clone)]
23054 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23055 pub enum COption_PaymentFailureReasonZ {
23056         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23057         Some(crate::lightning::events::PaymentFailureReason),
23058         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23059         None
23060 }
23061 impl COption_PaymentFailureReasonZ {
23062         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23063                 if let Self::None = self { false } else { true }
23064         }
23065         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23066                 !self.is_some()
23067         }
23068         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23069                 if let Self::Some(v) = self { v } else { unreachable!() }
23070         }
23071 }
23072 #[no_mangle]
23073 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23074 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23075         COption_PaymentFailureReasonZ::Some(o)
23076 }
23077 #[no_mangle]
23078 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23079 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23080         COption_PaymentFailureReasonZ::None
23081 }
23082 #[no_mangle]
23083 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23084 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23085 #[no_mangle]
23086 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23087 /// but with all dynamically-allocated buffers duplicated in new buffers.
23088 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23089 #[repr(C)]
23090 #[derive(Clone)]
23091 /// An enum which can either contain a crate::lightning::events::Event or not
23092 pub enum COption_EventZ {
23093         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23094         Some(crate::lightning::events::Event),
23095         /// When we're in this state, this COption_EventZ contains nothing
23096         None
23097 }
23098 impl COption_EventZ {
23099         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23100                 if let Self::None = self { false } else { true }
23101         }
23102         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23103                 !self.is_some()
23104         }
23105         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23106                 if let Self::Some(v) = self { v } else { unreachable!() }
23107         }
23108 }
23109 #[no_mangle]
23110 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23111 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23112         COption_EventZ::Some(o)
23113 }
23114 #[no_mangle]
23115 /// Constructs a new COption_EventZ containing nothing
23116 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23117         COption_EventZ::None
23118 }
23119 #[no_mangle]
23120 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23121 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23122 #[no_mangle]
23123 /// Creates a new COption_EventZ which has the same data as `orig`
23124 /// but with all dynamically-allocated buffers duplicated in new buffers.
23125 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23126 #[repr(C)]
23127 /// The contents of CResult_COption_EventZDecodeErrorZ
23128 pub union CResult_COption_EventZDecodeErrorZPtr {
23129         /// A pointer to the contents in the success state.
23130         /// Reading from this pointer when `result_ok` is not set is undefined.
23131         pub result: *mut crate::c_types::derived::COption_EventZ,
23132         /// A pointer to the contents in the error state.
23133         /// Reading from this pointer when `result_ok` is set is undefined.
23134         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23135 }
23136 #[repr(C)]
23137 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23138 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23140 pub struct CResult_COption_EventZDecodeErrorZ {
23141         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23142         /// `err` or `result` depending on the state of `result_ok`.
23143         pub contents: CResult_COption_EventZDecodeErrorZPtr,
23144         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23145         pub result_ok: bool,
23146 }
23147 #[no_mangle]
23148 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23149 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23150         CResult_COption_EventZDecodeErrorZ {
23151                 contents: CResult_COption_EventZDecodeErrorZPtr {
23152                         result: Box::into_raw(Box::new(o)),
23153                 },
23154                 result_ok: true,
23155         }
23156 }
23157 #[no_mangle]
23158 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23159 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23160         CResult_COption_EventZDecodeErrorZ {
23161                 contents: CResult_COption_EventZDecodeErrorZPtr {
23162                         err: Box::into_raw(Box::new(e)),
23163                 },
23164                 result_ok: false,
23165         }
23166 }
23167 /// Checks if the given object is currently in the success state
23168 #[no_mangle]
23169 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23170         o.result_ok
23171 }
23172 #[no_mangle]
23173 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23174 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23175 impl Drop for CResult_COption_EventZDecodeErrorZ {
23176         fn drop(&mut self) {
23177                 if self.result_ok {
23178                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23179                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23180                         }
23181                 } else {
23182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23184                         }
23185                 }
23186         }
23187 }
23188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23189         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23190                 let contents = if o.result_ok {
23191                         let result = unsafe { o.contents.result };
23192                         unsafe { o.contents.result = core::ptr::null_mut() };
23193                         CResult_COption_EventZDecodeErrorZPtr { result }
23194                 } else {
23195                         let err = unsafe { o.contents.err };
23196                         unsafe { o.contents.err = core::ptr::null_mut(); }
23197                         CResult_COption_EventZDecodeErrorZPtr { err }
23198                 };
23199                 Self {
23200                         contents,
23201                         result_ok: o.result_ok,
23202                 }
23203         }
23204 }
23205 impl Clone for CResult_COption_EventZDecodeErrorZ {
23206         fn clone(&self) -> Self {
23207                 if self.result_ok {
23208                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
23209                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
23210                         } }
23211                 } else {
23212                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
23213                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23214                         } }
23215                 }
23216         }
23217 }
23218 #[no_mangle]
23219 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
23220 /// but with all dynamically-allocated buffers duplicated in new buffers.
23221 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
23222 #[repr(C)]
23223 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
23224 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
23225         /// A pointer to the contents in the success state.
23226         /// Reading from this pointer when `result_ok` is not set is undefined.
23227         pub result: *mut crate::lightning_invoice::SiPrefix,
23228         /// A pointer to the contents in the error state.
23229         /// Reading from this pointer when `result_ok` is set is undefined.
23230         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23231 }
23232 #[repr(C)]
23233 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
23234 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23236 pub struct CResult_SiPrefixBolt11ParseErrorZ {
23237         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
23238         /// `err` or `result` depending on the state of `result_ok`.
23239         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
23240         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
23241         pub result_ok: bool,
23242 }
23243 #[no_mangle]
23244 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
23245 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
23246         CResult_SiPrefixBolt11ParseErrorZ {
23247                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23248                         result: Box::into_raw(Box::new(o)),
23249                 },
23250                 result_ok: true,
23251         }
23252 }
23253 #[no_mangle]
23254 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
23255 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
23256         CResult_SiPrefixBolt11ParseErrorZ {
23257                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23258                         err: Box::into_raw(Box::new(e)),
23259                 },
23260                 result_ok: false,
23261         }
23262 }
23263 /// Checks if the given object is currently in the success state
23264 #[no_mangle]
23265 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
23266         o.result_ok
23267 }
23268 #[no_mangle]
23269 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
23270 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
23271 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
23272         fn drop(&mut self) {
23273                 if self.result_ok {
23274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23276                         }
23277                 } else {
23278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23280                         }
23281                 }
23282         }
23283 }
23284 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
23285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23286                 let contents = if o.result_ok {
23287                         let result = unsafe { o.contents.result };
23288                         unsafe { o.contents.result = core::ptr::null_mut() };
23289                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
23290                 } else {
23291                         let err = unsafe { o.contents.err };
23292                         unsafe { o.contents.err = core::ptr::null_mut(); }
23293                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
23294                 };
23295                 Self {
23296                         contents,
23297                         result_ok: o.result_ok,
23298                 }
23299         }
23300 }
23301 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
23302         fn clone(&self) -> Self {
23303                 if self.result_ok {
23304                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23305                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
23306                         } }
23307                 } else {
23308                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23309                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23310                         } }
23311                 }
23312         }
23313 }
23314 #[no_mangle]
23315 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
23316 /// but with all dynamically-allocated buffers duplicated in new buffers.
23317 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
23318 #[repr(C)]
23319 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
23320 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23321         /// A pointer to the contents in the success state.
23322         /// Reading from this pointer when `result_ok` is not set is undefined.
23323         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23324         /// A pointer to the contents in the error state.
23325         /// Reading from this pointer when `result_ok` is set is undefined.
23326         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
23327 }
23328 #[repr(C)]
23329 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
23330 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
23331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23332 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23333         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
23334         /// `err` or `result` depending on the state of `result_ok`.
23335         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
23336         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
23337         pub result_ok: bool,
23338 }
23339 #[no_mangle]
23340 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
23341 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23342         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23343                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23344                         result: Box::into_raw(Box::new(o)),
23345                 },
23346                 result_ok: true,
23347         }
23348 }
23349 #[no_mangle]
23350 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
23351 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23352         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23353                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23354                         err: Box::into_raw(Box::new(e)),
23355                 },
23356                 result_ok: false,
23357         }
23358 }
23359 /// Checks if the given object is currently in the success state
23360 #[no_mangle]
23361 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
23362         o.result_ok
23363 }
23364 #[no_mangle]
23365 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
23366 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
23367 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23368         fn drop(&mut self) {
23369                 if self.result_ok {
23370                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23371                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23372                         }
23373                 } else {
23374                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23375                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23376                         }
23377                 }
23378         }
23379 }
23380 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23381         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
23382                 let contents = if o.result_ok {
23383                         let result = unsafe { o.contents.result };
23384                         unsafe { o.contents.result = core::ptr::null_mut() };
23385                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
23386                 } else {
23387                         let err = unsafe { o.contents.err };
23388                         unsafe { o.contents.err = core::ptr::null_mut(); }
23389                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
23390                 };
23391                 Self {
23392                         contents,
23393                         result_ok: o.result_ok,
23394                 }
23395         }
23396 }
23397 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23398         fn clone(&self) -> Self {
23399                 if self.result_ok {
23400                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23401                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23402                         } }
23403                 } else {
23404                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23405                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
23406                         } }
23407                 }
23408         }
23409 }
23410 #[no_mangle]
23411 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
23412 /// but with all dynamically-allocated buffers duplicated in new buffers.
23413 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
23414 #[repr(C)]
23415 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
23416 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23417         /// A pointer to the contents in the success state.
23418         /// Reading from this pointer when `result_ok` is not set is undefined.
23419         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
23420         /// A pointer to the contents in the error state.
23421         /// Reading from this pointer when `result_ok` is set is undefined.
23422         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23423 }
23424 #[repr(C)]
23425 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
23426 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23428 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23429         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
23430         /// `err` or `result` depending on the state of `result_ok`.
23431         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
23432         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
23433         pub result_ok: bool,
23434 }
23435 #[no_mangle]
23436 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
23437 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23438         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23439                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23440                         result: Box::into_raw(Box::new(o)),
23441                 },
23442                 result_ok: true,
23443         }
23444 }
23445 #[no_mangle]
23446 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
23447 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23448         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23449                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23450                         err: Box::into_raw(Box::new(e)),
23451                 },
23452                 result_ok: false,
23453         }
23454 }
23455 /// Checks if the given object is currently in the success state
23456 #[no_mangle]
23457 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
23458         o.result_ok
23459 }
23460 #[no_mangle]
23461 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
23462 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
23463 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23464         fn drop(&mut self) {
23465                 if self.result_ok {
23466                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23467                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23468                         }
23469                 } else {
23470                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23471                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23472                         }
23473                 }
23474         }
23475 }
23476 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23477         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23478                 let contents = if o.result_ok {
23479                         let result = unsafe { o.contents.result };
23480                         unsafe { o.contents.result = core::ptr::null_mut() };
23481                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
23482                 } else {
23483                         let err = unsafe { o.contents.err };
23484                         unsafe { o.contents.err = core::ptr::null_mut(); }
23485                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
23486                 };
23487                 Self {
23488                         contents,
23489                         result_ok: o.result_ok,
23490                 }
23491         }
23492 }
23493 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23494         fn clone(&self) -> Self {
23495                 if self.result_ok {
23496                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23497                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
23498                         } }
23499                 } else {
23500                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23501                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23502                         } }
23503                 }
23504         }
23505 }
23506 #[no_mangle]
23507 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
23508 /// but with all dynamically-allocated buffers duplicated in new buffers.
23509 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
23510 #[repr(C)]
23511 /// A tuple of 3 elements. See the individual fields for the types contained.
23512 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23513         /// The element at position 0
23514         pub a: crate::lightning_invoice::RawBolt11Invoice,
23515         /// The element at position 1
23516         pub b: crate::c_types::ThirtyTwoBytes,
23517         /// The element at position 2
23518         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
23519 }
23520 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23521         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
23522                 Self {
23523                         a: tup.0,
23524                         b: tup.1,
23525                         c: tup.2,
23526                 }
23527         }
23528 }
23529 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23530         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
23531                 (self.a, self.b, self.c)
23532         }
23533 }
23534 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23535         fn clone(&self) -> Self {
23536                 Self {
23537                         a: Clone::clone(&self.a),
23538                         b: Clone::clone(&self.b),
23539                         c: Clone::clone(&self.c),
23540                 }
23541         }
23542 }
23543 #[no_mangle]
23544 /// Creates a new tuple which has the same data as `orig`
23545 /// but with all dynamically-allocated buffers duplicated in new buffers.
23546 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
23547 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
23548 #[no_mangle]
23549 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 {
23550         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
23551 }
23552
23553 #[no_mangle]
23554 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
23555 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
23556 #[repr(C)]
23557 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
23558 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
23559         /// A pointer to the contents in the success state.
23560         /// Reading from this pointer when `result_ok` is not set is undefined.
23561         pub result: *mut crate::lightning_invoice::PayeePubKey,
23562         /// A pointer to the contents in the error state.
23563         /// Reading from this pointer when `result_ok` is set is undefined.
23564         pub err: *mut crate::c_types::Secp256k1Error,
23565 }
23566 #[repr(C)]
23567 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
23568 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
23569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23570 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
23571         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
23572         /// `err` or `result` depending on the state of `result_ok`.
23573         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
23574         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
23575         pub result_ok: bool,
23576 }
23577 #[no_mangle]
23578 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
23579 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
23580         CResult_PayeePubKeySecp256k1ErrorZ {
23581                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23582                         result: Box::into_raw(Box::new(o)),
23583                 },
23584                 result_ok: true,
23585         }
23586 }
23587 #[no_mangle]
23588 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
23589 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
23590         CResult_PayeePubKeySecp256k1ErrorZ {
23591                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23592                         err: Box::into_raw(Box::new(e)),
23593                 },
23594                 result_ok: false,
23595         }
23596 }
23597 /// Checks if the given object is currently in the success state
23598 #[no_mangle]
23599 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
23600         o.result_ok
23601 }
23602 #[no_mangle]
23603 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
23604 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
23605 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
23606         fn drop(&mut self) {
23607                 if self.result_ok {
23608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23610                         }
23611                 } else {
23612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23614                         }
23615                 }
23616         }
23617 }
23618 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
23619         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
23620                 let contents = if o.result_ok {
23621                         let result = unsafe { o.contents.result };
23622                         unsafe { o.contents.result = core::ptr::null_mut() };
23623                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
23624                 } else {
23625                         let err = unsafe { o.contents.err };
23626                         unsafe { o.contents.err = core::ptr::null_mut(); }
23627                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
23628                 };
23629                 Self {
23630                         contents,
23631                         result_ok: o.result_ok,
23632                 }
23633         }
23634 }
23635 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
23636         fn clone(&self) -> Self {
23637                 if self.result_ok {
23638                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23639                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
23640                         } }
23641                 } else {
23642                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23643                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23644                         } }
23645                 }
23646         }
23647 }
23648 #[no_mangle]
23649 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
23650 /// but with all dynamically-allocated buffers duplicated in new buffers.
23651 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
23652 #[repr(C)]
23653 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
23654 /// This corresponds to std::vector in C++
23655 pub struct CVec_PrivateRouteZ {
23656         /// The elements in the array.
23657         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23658         pub data: *mut crate::lightning_invoice::PrivateRoute,
23659         /// The number of elements pointed to by `data`.
23660         pub datalen: usize
23661 }
23662 impl CVec_PrivateRouteZ {
23663         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
23664                 if self.datalen == 0 { return Vec::new(); }
23665                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23666                 self.data = core::ptr::null_mut();
23667                 self.datalen = 0;
23668                 ret
23669         }
23670         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
23671                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23672         }
23673 }
23674 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
23675         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
23676                 let datalen = v.len();
23677                 let data = Box::into_raw(v.into_boxed_slice());
23678                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23679         }
23680 }
23681 #[no_mangle]
23682 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23683 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
23684 impl Drop for CVec_PrivateRouteZ {
23685         fn drop(&mut self) {
23686                 if self.datalen == 0 { return; }
23687                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23688         }
23689 }
23690 impl Clone for CVec_PrivateRouteZ {
23691         fn clone(&self) -> Self {
23692                 let mut res = Vec::new();
23693                 if self.datalen == 0 { return Self::from(res); }
23694                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23695                 Self::from(res)
23696         }
23697 }
23698 #[repr(C)]
23699 /// The contents of CResult_PositiveTimestampCreationErrorZ
23700 pub union CResult_PositiveTimestampCreationErrorZPtr {
23701         /// A pointer to the contents in the success state.
23702         /// Reading from this pointer when `result_ok` is not set is undefined.
23703         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
23704         /// A pointer to the contents in the error state.
23705         /// Reading from this pointer when `result_ok` is set is undefined.
23706         pub err: *mut crate::lightning_invoice::CreationError,
23707 }
23708 #[repr(C)]
23709 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
23710 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
23711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23712 pub struct CResult_PositiveTimestampCreationErrorZ {
23713         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
23714         /// `err` or `result` depending on the state of `result_ok`.
23715         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
23716         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
23717         pub result_ok: bool,
23718 }
23719 #[no_mangle]
23720 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
23721 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
23722         CResult_PositiveTimestampCreationErrorZ {
23723                 contents: CResult_PositiveTimestampCreationErrorZPtr {
23724                         result: Box::into_raw(Box::new(o)),
23725                 },
23726                 result_ok: true,
23727         }
23728 }
23729 #[no_mangle]
23730 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
23731 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
23732         CResult_PositiveTimestampCreationErrorZ {
23733                 contents: CResult_PositiveTimestampCreationErrorZPtr {
23734                         err: Box::into_raw(Box::new(e)),
23735                 },
23736                 result_ok: false,
23737         }
23738 }
23739 /// Checks if the given object is currently in the success state
23740 #[no_mangle]
23741 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
23742         o.result_ok
23743 }
23744 #[no_mangle]
23745 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
23746 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
23747 impl Drop for CResult_PositiveTimestampCreationErrorZ {
23748         fn drop(&mut self) {
23749                 if self.result_ok {
23750                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23751                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23752                         }
23753                 } else {
23754                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23755                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23756                         }
23757                 }
23758         }
23759 }
23760 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
23761         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
23762                 let contents = if o.result_ok {
23763                         let result = unsafe { o.contents.result };
23764                         unsafe { o.contents.result = core::ptr::null_mut() };
23765                         CResult_PositiveTimestampCreationErrorZPtr { result }
23766                 } else {
23767                         let err = unsafe { o.contents.err };
23768                         unsafe { o.contents.err = core::ptr::null_mut(); }
23769                         CResult_PositiveTimestampCreationErrorZPtr { err }
23770                 };
23771                 Self {
23772                         contents,
23773                         result_ok: o.result_ok,
23774                 }
23775         }
23776 }
23777 impl Clone for CResult_PositiveTimestampCreationErrorZ {
23778         fn clone(&self) -> Self {
23779                 if self.result_ok {
23780                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
23781                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
23782                         } }
23783                 } else {
23784                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
23785                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
23786                         } }
23787                 }
23788         }
23789 }
23790 #[no_mangle]
23791 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
23792 /// but with all dynamically-allocated buffers duplicated in new buffers.
23793 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
23794 #[repr(C)]
23795 /// The contents of CResult_NoneBolt11SemanticErrorZ
23796 pub union CResult_NoneBolt11SemanticErrorZPtr {
23797         /// Note that this value is always NULL, as there are no contents in the OK variant
23798         pub result: *mut core::ffi::c_void,
23799         /// A pointer to the contents in the error state.
23800         /// Reading from this pointer when `result_ok` is set is undefined.
23801         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
23802 }
23803 #[repr(C)]
23804 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
23805 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
23806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23807 pub struct CResult_NoneBolt11SemanticErrorZ {
23808         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
23809         /// `err` or `result` depending on the state of `result_ok`.
23810         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
23811         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
23812         pub result_ok: bool,
23813 }
23814 #[no_mangle]
23815 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
23816 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
23817         CResult_NoneBolt11SemanticErrorZ {
23818                 contents: CResult_NoneBolt11SemanticErrorZPtr {
23819                         result: core::ptr::null_mut(),
23820                 },
23821                 result_ok: true,
23822         }
23823 }
23824 #[no_mangle]
23825 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
23826 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
23827         CResult_NoneBolt11SemanticErrorZ {
23828                 contents: CResult_NoneBolt11SemanticErrorZPtr {
23829                         err: Box::into_raw(Box::new(e)),
23830                 },
23831                 result_ok: false,
23832         }
23833 }
23834 /// Checks if the given object is currently in the success state
23835 #[no_mangle]
23836 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
23837         o.result_ok
23838 }
23839 #[no_mangle]
23840 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
23841 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
23842 impl Drop for CResult_NoneBolt11SemanticErrorZ {
23843         fn drop(&mut self) {
23844                 if self.result_ok {
23845                 } else {
23846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23848                         }
23849                 }
23850         }
23851 }
23852 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
23853         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
23854                 let contents = if o.result_ok {
23855                         let _ = unsafe { Box::from_raw(o.contents.result) };
23856                         o.contents.result = core::ptr::null_mut();
23857                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
23858                 } else {
23859                         let err = unsafe { o.contents.err };
23860                         unsafe { o.contents.err = core::ptr::null_mut(); }
23861                         CResult_NoneBolt11SemanticErrorZPtr { err }
23862                 };
23863                 Self {
23864                         contents,
23865                         result_ok: o.result_ok,
23866                 }
23867         }
23868 }
23869 impl Clone for CResult_NoneBolt11SemanticErrorZ {
23870         fn clone(&self) -> Self {
23871                 if self.result_ok {
23872                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
23873                                 result: core::ptr::null_mut()
23874                         } }
23875                 } else {
23876                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
23877                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
23878                         } }
23879                 }
23880         }
23881 }
23882 #[no_mangle]
23883 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
23884 /// but with all dynamically-allocated buffers duplicated in new buffers.
23885 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
23886 #[repr(C)]
23887 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
23888 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23889         /// A pointer to the contents in the success state.
23890         /// Reading from this pointer when `result_ok` is not set is undefined.
23891         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23892         /// A pointer to the contents in the error state.
23893         /// Reading from this pointer when `result_ok` is set is undefined.
23894         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
23895 }
23896 #[repr(C)]
23897 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
23898 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
23899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23900 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23901         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
23902         /// `err` or `result` depending on the state of `result_ok`.
23903         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
23904         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
23905         pub result_ok: bool,
23906 }
23907 #[no_mangle]
23908 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
23909 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23910         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23911                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23912                         result: Box::into_raw(Box::new(o)),
23913                 },
23914                 result_ok: true,
23915         }
23916 }
23917 #[no_mangle]
23918 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
23919 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23920         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23921                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23922                         err: Box::into_raw(Box::new(e)),
23923                 },
23924                 result_ok: false,
23925         }
23926 }
23927 /// Checks if the given object is currently in the success state
23928 #[no_mangle]
23929 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
23930         o.result_ok
23931 }
23932 #[no_mangle]
23933 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
23934 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
23935 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23936         fn drop(&mut self) {
23937                 if self.result_ok {
23938                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23939                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23940                         }
23941                 } else {
23942                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23943                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23944                         }
23945                 }
23946         }
23947 }
23948 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23949         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
23950                 let contents = if o.result_ok {
23951                         let result = unsafe { o.contents.result };
23952                         unsafe { o.contents.result = core::ptr::null_mut() };
23953                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
23954                 } else {
23955                         let err = unsafe { o.contents.err };
23956                         unsafe { o.contents.err = core::ptr::null_mut(); }
23957                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
23958                 };
23959                 Self {
23960                         contents,
23961                         result_ok: o.result_ok,
23962                 }
23963         }
23964 }
23965 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23966         fn clone(&self) -> Self {
23967                 if self.result_ok {
23968                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23969                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23970                         } }
23971                 } else {
23972                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23973                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
23974                         } }
23975                 }
23976         }
23977 }
23978 #[no_mangle]
23979 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
23980 /// but with all dynamically-allocated buffers duplicated in new buffers.
23981 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
23982 #[repr(C)]
23983 /// The contents of CResult_DescriptionCreationErrorZ
23984 pub union CResult_DescriptionCreationErrorZPtr {
23985         /// A pointer to the contents in the success state.
23986         /// Reading from this pointer when `result_ok` is not set is undefined.
23987         pub result: *mut crate::lightning_invoice::Description,
23988         /// A pointer to the contents in the error state.
23989         /// Reading from this pointer when `result_ok` is set is undefined.
23990         pub err: *mut crate::lightning_invoice::CreationError,
23991 }
23992 #[repr(C)]
23993 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
23994 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
23995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23996 pub struct CResult_DescriptionCreationErrorZ {
23997         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
23998         /// `err` or `result` depending on the state of `result_ok`.
23999         pub contents: CResult_DescriptionCreationErrorZPtr,
24000         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
24001         pub result_ok: bool,
24002 }
24003 #[no_mangle]
24004 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
24005 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
24006         CResult_DescriptionCreationErrorZ {
24007                 contents: CResult_DescriptionCreationErrorZPtr {
24008                         result: Box::into_raw(Box::new(o)),
24009                 },
24010                 result_ok: true,
24011         }
24012 }
24013 #[no_mangle]
24014 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
24015 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
24016         CResult_DescriptionCreationErrorZ {
24017                 contents: CResult_DescriptionCreationErrorZPtr {
24018                         err: Box::into_raw(Box::new(e)),
24019                 },
24020                 result_ok: false,
24021         }
24022 }
24023 /// Checks if the given object is currently in the success state
24024 #[no_mangle]
24025 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
24026         o.result_ok
24027 }
24028 #[no_mangle]
24029 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
24030 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
24031 impl Drop for CResult_DescriptionCreationErrorZ {
24032         fn drop(&mut self) {
24033                 if self.result_ok {
24034                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24035                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24036                         }
24037                 } else {
24038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24040                         }
24041                 }
24042         }
24043 }
24044 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
24045         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
24046                 let contents = if o.result_ok {
24047                         let result = unsafe { o.contents.result };
24048                         unsafe { o.contents.result = core::ptr::null_mut() };
24049                         CResult_DescriptionCreationErrorZPtr { result }
24050                 } else {
24051                         let err = unsafe { o.contents.err };
24052                         unsafe { o.contents.err = core::ptr::null_mut(); }
24053                         CResult_DescriptionCreationErrorZPtr { err }
24054                 };
24055                 Self {
24056                         contents,
24057                         result_ok: o.result_ok,
24058                 }
24059         }
24060 }
24061 impl Clone for CResult_DescriptionCreationErrorZ {
24062         fn clone(&self) -> Self {
24063                 if self.result_ok {
24064                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
24065                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
24066                         } }
24067                 } else {
24068                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
24069                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24070                         } }
24071                 }
24072         }
24073 }
24074 #[no_mangle]
24075 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24076 /// but with all dynamically-allocated buffers duplicated in new buffers.
24077 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
24078 #[repr(C)]
24079 /// The contents of CResult_PrivateRouteCreationErrorZ
24080 pub union CResult_PrivateRouteCreationErrorZPtr {
24081         /// A pointer to the contents in the success state.
24082         /// Reading from this pointer when `result_ok` is not set is undefined.
24083         pub result: *mut crate::lightning_invoice::PrivateRoute,
24084         /// A pointer to the contents in the error state.
24085         /// Reading from this pointer when `result_ok` is set is undefined.
24086         pub err: *mut crate::lightning_invoice::CreationError,
24087 }
24088 #[repr(C)]
24089 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
24090 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
24091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24092 pub struct CResult_PrivateRouteCreationErrorZ {
24093         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
24094         /// `err` or `result` depending on the state of `result_ok`.
24095         pub contents: CResult_PrivateRouteCreationErrorZPtr,
24096         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
24097         pub result_ok: bool,
24098 }
24099 #[no_mangle]
24100 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24101 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
24102         CResult_PrivateRouteCreationErrorZ {
24103                 contents: CResult_PrivateRouteCreationErrorZPtr {
24104                         result: Box::into_raw(Box::new(o)),
24105                 },
24106                 result_ok: true,
24107         }
24108 }
24109 #[no_mangle]
24110 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24111 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
24112         CResult_PrivateRouteCreationErrorZ {
24113                 contents: CResult_PrivateRouteCreationErrorZPtr {
24114                         err: Box::into_raw(Box::new(e)),
24115                 },
24116                 result_ok: false,
24117         }
24118 }
24119 /// Checks if the given object is currently in the success state
24120 #[no_mangle]
24121 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
24122         o.result_ok
24123 }
24124 #[no_mangle]
24125 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24126 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
24127 impl Drop for CResult_PrivateRouteCreationErrorZ {
24128         fn drop(&mut self) {
24129                 if self.result_ok {
24130                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24131                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24132                         }
24133                 } else {
24134                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24135                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24136                         }
24137                 }
24138         }
24139 }
24140 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
24141         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
24142                 let contents = if o.result_ok {
24143                         let result = unsafe { o.contents.result };
24144                         unsafe { o.contents.result = core::ptr::null_mut() };
24145                         CResult_PrivateRouteCreationErrorZPtr { result }
24146                 } else {
24147                         let err = unsafe { o.contents.err };
24148                         unsafe { o.contents.err = core::ptr::null_mut(); }
24149                         CResult_PrivateRouteCreationErrorZPtr { err }
24150                 };
24151                 Self {
24152                         contents,
24153                         result_ok: o.result_ok,
24154                 }
24155         }
24156 }
24157 impl Clone for CResult_PrivateRouteCreationErrorZ {
24158         fn clone(&self) -> Self {
24159                 if self.result_ok {
24160                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
24161                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
24162                         } }
24163                 } else {
24164                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
24165                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24166                         } }
24167                 }
24168         }
24169 }
24170 #[no_mangle]
24171 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24172 /// but with all dynamically-allocated buffers duplicated in new buffers.
24173 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
24174 #[repr(C)]
24175 /// The contents of CResult_OutPointDecodeErrorZ
24176 pub union CResult_OutPointDecodeErrorZPtr {
24177         /// A pointer to the contents in the success state.
24178         /// Reading from this pointer when `result_ok` is not set is undefined.
24179         pub result: *mut crate::lightning::chain::transaction::OutPoint,
24180         /// A pointer to the contents in the error state.
24181         /// Reading from this pointer when `result_ok` is set is undefined.
24182         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24183 }
24184 #[repr(C)]
24185 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
24186 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24188 pub struct CResult_OutPointDecodeErrorZ {
24189         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
24190         /// `err` or `result` depending on the state of `result_ok`.
24191         pub contents: CResult_OutPointDecodeErrorZPtr,
24192         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
24193         pub result_ok: bool,
24194 }
24195 #[no_mangle]
24196 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
24197 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
24198         CResult_OutPointDecodeErrorZ {
24199                 contents: CResult_OutPointDecodeErrorZPtr {
24200                         result: Box::into_raw(Box::new(o)),
24201                 },
24202                 result_ok: true,
24203         }
24204 }
24205 #[no_mangle]
24206 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
24207 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
24208         CResult_OutPointDecodeErrorZ {
24209                 contents: CResult_OutPointDecodeErrorZPtr {
24210                         err: Box::into_raw(Box::new(e)),
24211                 },
24212                 result_ok: false,
24213         }
24214 }
24215 /// Checks if the given object is currently in the success state
24216 #[no_mangle]
24217 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
24218         o.result_ok
24219 }
24220 #[no_mangle]
24221 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
24222 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
24223 impl Drop for CResult_OutPointDecodeErrorZ {
24224         fn drop(&mut self) {
24225                 if self.result_ok {
24226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24228                         }
24229                 } else {
24230                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24231                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24232                         }
24233                 }
24234         }
24235 }
24236 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
24237         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24238                 let contents = if o.result_ok {
24239                         let result = unsafe { o.contents.result };
24240                         unsafe { o.contents.result = core::ptr::null_mut() };
24241                         CResult_OutPointDecodeErrorZPtr { result }
24242                 } else {
24243                         let err = unsafe { o.contents.err };
24244                         unsafe { o.contents.err = core::ptr::null_mut(); }
24245                         CResult_OutPointDecodeErrorZPtr { err }
24246                 };
24247                 Self {
24248                         contents,
24249                         result_ok: o.result_ok,
24250                 }
24251         }
24252 }
24253 impl Clone for CResult_OutPointDecodeErrorZ {
24254         fn clone(&self) -> Self {
24255                 if self.result_ok {
24256                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
24257                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
24258                         } }
24259                 } else {
24260                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
24261                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24262                         } }
24263                 }
24264         }
24265 }
24266 #[no_mangle]
24267 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
24268 /// but with all dynamically-allocated buffers duplicated in new buffers.
24269 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
24270 #[repr(C)]
24271 /// The contents of CResult_BigSizeDecodeErrorZ
24272 pub union CResult_BigSizeDecodeErrorZPtr {
24273         /// A pointer to the contents in the success state.
24274         /// Reading from this pointer when `result_ok` is not set is undefined.
24275         pub result: *mut crate::lightning::util::ser::BigSize,
24276         /// A pointer to the contents in the error state.
24277         /// Reading from this pointer when `result_ok` is set is undefined.
24278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24279 }
24280 #[repr(C)]
24281 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
24282 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
24283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24284 pub struct CResult_BigSizeDecodeErrorZ {
24285         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
24286         /// `err` or `result` depending on the state of `result_ok`.
24287         pub contents: CResult_BigSizeDecodeErrorZPtr,
24288         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
24289         pub result_ok: bool,
24290 }
24291 #[no_mangle]
24292 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
24293 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
24294         CResult_BigSizeDecodeErrorZ {
24295                 contents: CResult_BigSizeDecodeErrorZPtr {
24296                         result: Box::into_raw(Box::new(o)),
24297                 },
24298                 result_ok: true,
24299         }
24300 }
24301 #[no_mangle]
24302 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
24303 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
24304         CResult_BigSizeDecodeErrorZ {
24305                 contents: CResult_BigSizeDecodeErrorZPtr {
24306                         err: Box::into_raw(Box::new(e)),
24307                 },
24308                 result_ok: false,
24309         }
24310 }
24311 /// Checks if the given object is currently in the success state
24312 #[no_mangle]
24313 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
24314         o.result_ok
24315 }
24316 #[no_mangle]
24317 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
24318 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
24319 impl Drop for CResult_BigSizeDecodeErrorZ {
24320         fn drop(&mut self) {
24321                 if self.result_ok {
24322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24324                         }
24325                 } else {
24326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24328                         }
24329                 }
24330         }
24331 }
24332 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
24333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
24334                 let contents = if o.result_ok {
24335                         let result = unsafe { o.contents.result };
24336                         unsafe { o.contents.result = core::ptr::null_mut() };
24337                         CResult_BigSizeDecodeErrorZPtr { result }
24338                 } else {
24339                         let err = unsafe { o.contents.err };
24340                         unsafe { o.contents.err = core::ptr::null_mut(); }
24341                         CResult_BigSizeDecodeErrorZPtr { err }
24342                 };
24343                 Self {
24344                         contents,
24345                         result_ok: o.result_ok,
24346                 }
24347         }
24348 }
24349 impl Clone for CResult_BigSizeDecodeErrorZ {
24350         fn clone(&self) -> Self {
24351                 if self.result_ok {
24352                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
24353                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
24354                         } }
24355                 } else {
24356                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
24357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24358                         } }
24359                 }
24360         }
24361 }
24362 #[no_mangle]
24363 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
24364 /// but with all dynamically-allocated buffers duplicated in new buffers.
24365 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
24366 #[repr(C)]
24367 /// The contents of CResult_HostnameDecodeErrorZ
24368 pub union CResult_HostnameDecodeErrorZPtr {
24369         /// A pointer to the contents in the success state.
24370         /// Reading from this pointer when `result_ok` is not set is undefined.
24371         pub result: *mut crate::lightning::util::ser::Hostname,
24372         /// A pointer to the contents in the error state.
24373         /// Reading from this pointer when `result_ok` is set is undefined.
24374         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24375 }
24376 #[repr(C)]
24377 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
24378 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
24379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24380 pub struct CResult_HostnameDecodeErrorZ {
24381         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
24382         /// `err` or `result` depending on the state of `result_ok`.
24383         pub contents: CResult_HostnameDecodeErrorZPtr,
24384         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
24385         pub result_ok: bool,
24386 }
24387 #[no_mangle]
24388 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
24389 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
24390         CResult_HostnameDecodeErrorZ {
24391                 contents: CResult_HostnameDecodeErrorZPtr {
24392                         result: Box::into_raw(Box::new(o)),
24393                 },
24394                 result_ok: true,
24395         }
24396 }
24397 #[no_mangle]
24398 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
24399 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
24400         CResult_HostnameDecodeErrorZ {
24401                 contents: CResult_HostnameDecodeErrorZPtr {
24402                         err: Box::into_raw(Box::new(e)),
24403                 },
24404                 result_ok: false,
24405         }
24406 }
24407 /// Checks if the given object is currently in the success state
24408 #[no_mangle]
24409 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
24410         o.result_ok
24411 }
24412 #[no_mangle]
24413 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
24414 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
24415 impl Drop for CResult_HostnameDecodeErrorZ {
24416         fn drop(&mut self) {
24417                 if self.result_ok {
24418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24420                         }
24421                 } else {
24422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24424                         }
24425                 }
24426         }
24427 }
24428 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
24429         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
24430                 let contents = if o.result_ok {
24431                         let result = unsafe { o.contents.result };
24432                         unsafe { o.contents.result = core::ptr::null_mut() };
24433                         CResult_HostnameDecodeErrorZPtr { result }
24434                 } else {
24435                         let err = unsafe { o.contents.err };
24436                         unsafe { o.contents.err = core::ptr::null_mut(); }
24437                         CResult_HostnameDecodeErrorZPtr { err }
24438                 };
24439                 Self {
24440                         contents,
24441                         result_ok: o.result_ok,
24442                 }
24443         }
24444 }
24445 impl Clone for CResult_HostnameDecodeErrorZ {
24446         fn clone(&self) -> Self {
24447                 if self.result_ok {
24448                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
24449                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
24450                         } }
24451                 } else {
24452                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
24453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24454                         } }
24455                 }
24456         }
24457 }
24458 #[no_mangle]
24459 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
24460 /// but with all dynamically-allocated buffers duplicated in new buffers.
24461 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
24462 #[repr(C)]
24463 /// The contents of CResult_TransactionU16LenLimitedNoneZ
24464 pub union CResult_TransactionU16LenLimitedNoneZPtr {
24465         /// A pointer to the contents in the success state.
24466         /// Reading from this pointer when `result_ok` is not set is undefined.
24467         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24468         /// Note that this value is always NULL, as there are no contents in the Err variant
24469         pub err: *mut core::ffi::c_void,
24470 }
24471 #[repr(C)]
24472 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
24473 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
24474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24475 pub struct CResult_TransactionU16LenLimitedNoneZ {
24476         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
24477         /// `err` or `result` depending on the state of `result_ok`.
24478         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
24479         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
24480         pub result_ok: bool,
24481 }
24482 #[no_mangle]
24483 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
24484 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
24485         CResult_TransactionU16LenLimitedNoneZ {
24486                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24487                         result: Box::into_raw(Box::new(o)),
24488                 },
24489                 result_ok: true,
24490         }
24491 }
24492 #[no_mangle]
24493 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
24494 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
24495         CResult_TransactionU16LenLimitedNoneZ {
24496                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24497                         err: core::ptr::null_mut(),
24498                 },
24499                 result_ok: false,
24500         }
24501 }
24502 /// Checks if the given object is currently in the success state
24503 #[no_mangle]
24504 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
24505         o.result_ok
24506 }
24507 #[no_mangle]
24508 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
24509 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
24510 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
24511         fn drop(&mut self) {
24512                 if self.result_ok {
24513                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24514                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24515                         }
24516                 } else {
24517                 }
24518         }
24519 }
24520 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
24521         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
24522                 let contents = if o.result_ok {
24523                         let result = unsafe { o.contents.result };
24524                         unsafe { o.contents.result = core::ptr::null_mut() };
24525                         CResult_TransactionU16LenLimitedNoneZPtr { result }
24526                 } else {
24527                         let _ = unsafe { Box::from_raw(o.contents.err) };
24528                         o.contents.err = core::ptr::null_mut();
24529                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
24530                 };
24531                 Self {
24532                         contents,
24533                         result_ok: o.result_ok,
24534                 }
24535         }
24536 }
24537 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
24538         fn clone(&self) -> Self {
24539                 if self.result_ok {
24540                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24541                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24542                         } }
24543                 } else {
24544                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24545                                 err: core::ptr::null_mut()
24546                         } }
24547                 }
24548         }
24549 }
24550 #[no_mangle]
24551 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
24552 /// but with all dynamically-allocated buffers duplicated in new buffers.
24553 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
24554 #[repr(C)]
24555 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
24556 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24557         /// A pointer to the contents in the success state.
24558         /// Reading from this pointer when `result_ok` is not set is undefined.
24559         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24560         /// A pointer to the contents in the error state.
24561         /// Reading from this pointer when `result_ok` is set is undefined.
24562         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24563 }
24564 #[repr(C)]
24565 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
24566 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
24567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24568 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
24569         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
24570         /// `err` or `result` depending on the state of `result_ok`.
24571         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
24572         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
24573         pub result_ok: bool,
24574 }
24575 #[no_mangle]
24576 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
24577 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24578         CResult_TransactionU16LenLimitedDecodeErrorZ {
24579                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24580                         result: Box::into_raw(Box::new(o)),
24581                 },
24582                 result_ok: true,
24583         }
24584 }
24585 #[no_mangle]
24586 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
24587 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24588         CResult_TransactionU16LenLimitedDecodeErrorZ {
24589                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24590                         err: Box::into_raw(Box::new(e)),
24591                 },
24592                 result_ok: false,
24593         }
24594 }
24595 /// Checks if the given object is currently in the success state
24596 #[no_mangle]
24597 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
24598         o.result_ok
24599 }
24600 #[no_mangle]
24601 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
24602 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
24603 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
24604         fn drop(&mut self) {
24605                 if self.result_ok {
24606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24608                         }
24609                 } else {
24610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24612                         }
24613                 }
24614         }
24615 }
24616 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
24617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
24618                 let contents = if o.result_ok {
24619                         let result = unsafe { o.contents.result };
24620                         unsafe { o.contents.result = core::ptr::null_mut() };
24621                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
24622                 } else {
24623                         let err = unsafe { o.contents.err };
24624                         unsafe { o.contents.err = core::ptr::null_mut(); }
24625                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
24626                 };
24627                 Self {
24628                         contents,
24629                         result_ok: o.result_ok,
24630                 }
24631         }
24632 }
24633 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
24634         fn clone(&self) -> Self {
24635                 if self.result_ok {
24636                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24637                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24638                         } }
24639                 } else {
24640                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24641                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24642                         } }
24643                 }
24644         }
24645 }
24646 #[no_mangle]
24647 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
24648 /// but with all dynamically-allocated buffers duplicated in new buffers.
24649 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
24650 #[repr(C)]
24651 /// The contents of CResult_UntrustedStringDecodeErrorZ
24652 pub union CResult_UntrustedStringDecodeErrorZPtr {
24653         /// A pointer to the contents in the success state.
24654         /// Reading from this pointer when `result_ok` is not set is undefined.
24655         pub result: *mut crate::lightning::util::string::UntrustedString,
24656         /// A pointer to the contents in the error state.
24657         /// Reading from this pointer when `result_ok` is set is undefined.
24658         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24659 }
24660 #[repr(C)]
24661 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
24662 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
24663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24664 pub struct CResult_UntrustedStringDecodeErrorZ {
24665         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
24666         /// `err` or `result` depending on the state of `result_ok`.
24667         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
24668         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
24669         pub result_ok: bool,
24670 }
24671 #[no_mangle]
24672 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
24673 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
24674         CResult_UntrustedStringDecodeErrorZ {
24675                 contents: CResult_UntrustedStringDecodeErrorZPtr {
24676                         result: Box::into_raw(Box::new(o)),
24677                 },
24678                 result_ok: true,
24679         }
24680 }
24681 #[no_mangle]
24682 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
24683 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
24684         CResult_UntrustedStringDecodeErrorZ {
24685                 contents: CResult_UntrustedStringDecodeErrorZPtr {
24686                         err: Box::into_raw(Box::new(e)),
24687                 },
24688                 result_ok: false,
24689         }
24690 }
24691 /// Checks if the given object is currently in the success state
24692 #[no_mangle]
24693 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
24694         o.result_ok
24695 }
24696 #[no_mangle]
24697 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
24698 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
24699 impl Drop for CResult_UntrustedStringDecodeErrorZ {
24700         fn drop(&mut self) {
24701                 if self.result_ok {
24702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24704                         }
24705                 } else {
24706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24708                         }
24709                 }
24710         }
24711 }
24712 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
24713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
24714                 let contents = if o.result_ok {
24715                         let result = unsafe { o.contents.result };
24716                         unsafe { o.contents.result = core::ptr::null_mut() };
24717                         CResult_UntrustedStringDecodeErrorZPtr { result }
24718                 } else {
24719                         let err = unsafe { o.contents.err };
24720                         unsafe { o.contents.err = core::ptr::null_mut(); }
24721                         CResult_UntrustedStringDecodeErrorZPtr { err }
24722                 };
24723                 Self {
24724                         contents,
24725                         result_ok: o.result_ok,
24726                 }
24727         }
24728 }
24729 impl Clone for CResult_UntrustedStringDecodeErrorZ {
24730         fn clone(&self) -> Self {
24731                 if self.result_ok {
24732                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
24733                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
24734                         } }
24735                 } else {
24736                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
24737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24738                         } }
24739                 }
24740         }
24741 }
24742 #[no_mangle]
24743 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
24744 /// but with all dynamically-allocated buffers duplicated in new buffers.
24745 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
24746 #[repr(C)]
24747 /// The contents of CResult_ChannelIdDecodeErrorZ
24748 pub union CResult_ChannelIdDecodeErrorZPtr {
24749         /// A pointer to the contents in the success state.
24750         /// Reading from this pointer when `result_ok` is not set is undefined.
24751         pub result: *mut crate::lightning::ln::types::ChannelId,
24752         /// A pointer to the contents in the error state.
24753         /// Reading from this pointer when `result_ok` is set is undefined.
24754         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24755 }
24756 #[repr(C)]
24757 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
24758 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
24759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24760 pub struct CResult_ChannelIdDecodeErrorZ {
24761         /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
24762         /// `err` or `result` depending on the state of `result_ok`.
24763         pub contents: CResult_ChannelIdDecodeErrorZPtr,
24764         /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
24765         pub result_ok: bool,
24766 }
24767 #[no_mangle]
24768 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
24769 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
24770         CResult_ChannelIdDecodeErrorZ {
24771                 contents: CResult_ChannelIdDecodeErrorZPtr {
24772                         result: Box::into_raw(Box::new(o)),
24773                 },
24774                 result_ok: true,
24775         }
24776 }
24777 #[no_mangle]
24778 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
24779 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
24780         CResult_ChannelIdDecodeErrorZ {
24781                 contents: CResult_ChannelIdDecodeErrorZPtr {
24782                         err: Box::into_raw(Box::new(e)),
24783                 },
24784                 result_ok: false,
24785         }
24786 }
24787 /// Checks if the given object is currently in the success state
24788 #[no_mangle]
24789 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
24790         o.result_ok
24791 }
24792 #[no_mangle]
24793 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
24794 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
24795 impl Drop for CResult_ChannelIdDecodeErrorZ {
24796         fn drop(&mut self) {
24797                 if self.result_ok {
24798                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24799                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24800                         }
24801                 } else {
24802                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24803                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24804                         }
24805                 }
24806         }
24807 }
24808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
24809         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
24810                 let contents = if o.result_ok {
24811                         let result = unsafe { o.contents.result };
24812                         unsafe { o.contents.result = core::ptr::null_mut() };
24813                         CResult_ChannelIdDecodeErrorZPtr { result }
24814                 } else {
24815                         let err = unsafe { o.contents.err };
24816                         unsafe { o.contents.err = core::ptr::null_mut(); }
24817                         CResult_ChannelIdDecodeErrorZPtr { err }
24818                 };
24819                 Self {
24820                         contents,
24821                         result_ok: o.result_ok,
24822                 }
24823         }
24824 }
24825 impl Clone for CResult_ChannelIdDecodeErrorZ {
24826         fn clone(&self) -> Self {
24827                 if self.result_ok {
24828                         Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
24829                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
24830                         } }
24831                 } else {
24832                         Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
24833                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24834                         } }
24835                 }
24836         }
24837 }
24838 #[no_mangle]
24839 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
24840 /// but with all dynamically-allocated buffers duplicated in new buffers.
24841 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
24842 #[repr(C)]
24843 /// A tuple of 2 elements. See the individual fields for the types contained.
24844 pub struct C2Tuple__u832u16Z {
24845         /// The element at position 0
24846         pub a: crate::c_types::ThirtyTwoBytes,
24847         /// The element at position 1
24848         pub b: u16,
24849 }
24850 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
24851         fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
24852                 Self {
24853                         a: tup.0,
24854                         b: tup.1,
24855                 }
24856         }
24857 }
24858 impl C2Tuple__u832u16Z {
24859         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
24860                 (self.a, self.b)
24861         }
24862 }
24863 impl Clone for C2Tuple__u832u16Z {
24864         fn clone(&self) -> Self {
24865                 Self {
24866                         a: Clone::clone(&self.a),
24867                         b: Clone::clone(&self.b),
24868                 }
24869         }
24870 }
24871 #[no_mangle]
24872 /// Creates a new tuple which has the same data as `orig`
24873 /// but with all dynamically-allocated buffers duplicated in new buffers.
24874 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
24875 /// Creates a new C2Tuple__u832u16Z from the contained elements.
24876 #[no_mangle]
24877 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
24878         C2Tuple__u832u16Z { a, b, }
24879 }
24880
24881 #[no_mangle]
24882 /// Frees any resources used by the C2Tuple__u832u16Z.
24883 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
24884 #[repr(C)]
24885 /// The contents of CResult_PaymentRelayDecodeErrorZ
24886 pub union CResult_PaymentRelayDecodeErrorZPtr {
24887         /// A pointer to the contents in the success state.
24888         /// Reading from this pointer when `result_ok` is not set is undefined.
24889         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
24890         /// A pointer to the contents in the error state.
24891         /// Reading from this pointer when `result_ok` is set is undefined.
24892         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24893 }
24894 #[repr(C)]
24895 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
24896 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
24897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24898 pub struct CResult_PaymentRelayDecodeErrorZ {
24899         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
24900         /// `err` or `result` depending on the state of `result_ok`.
24901         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
24902         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
24903         pub result_ok: bool,
24904 }
24905 #[no_mangle]
24906 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
24907 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
24908         CResult_PaymentRelayDecodeErrorZ {
24909                 contents: CResult_PaymentRelayDecodeErrorZPtr {
24910                         result: Box::into_raw(Box::new(o)),
24911                 },
24912                 result_ok: true,
24913         }
24914 }
24915 #[no_mangle]
24916 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
24917 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
24918         CResult_PaymentRelayDecodeErrorZ {
24919                 contents: CResult_PaymentRelayDecodeErrorZPtr {
24920                         err: Box::into_raw(Box::new(e)),
24921                 },
24922                 result_ok: false,
24923         }
24924 }
24925 /// Checks if the given object is currently in the success state
24926 #[no_mangle]
24927 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
24928         o.result_ok
24929 }
24930 #[no_mangle]
24931 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
24932 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
24933 impl Drop for CResult_PaymentRelayDecodeErrorZ {
24934         fn drop(&mut self) {
24935                 if self.result_ok {
24936                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24937                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24938                         }
24939                 } else {
24940                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24941                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24942                         }
24943                 }
24944         }
24945 }
24946 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
24947         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
24948                 let contents = if o.result_ok {
24949                         let result = unsafe { o.contents.result };
24950                         unsafe { o.contents.result = core::ptr::null_mut() };
24951                         CResult_PaymentRelayDecodeErrorZPtr { result }
24952                 } else {
24953                         let err = unsafe { o.contents.err };
24954                         unsafe { o.contents.err = core::ptr::null_mut(); }
24955                         CResult_PaymentRelayDecodeErrorZPtr { err }
24956                 };
24957                 Self {
24958                         contents,
24959                         result_ok: o.result_ok,
24960                 }
24961         }
24962 }
24963 impl Clone for CResult_PaymentRelayDecodeErrorZ {
24964         fn clone(&self) -> Self {
24965                 if self.result_ok {
24966                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
24967                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
24968                         } }
24969                 } else {
24970                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
24971                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24972                         } }
24973                 }
24974         }
24975 }
24976 #[no_mangle]
24977 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
24978 /// but with all dynamically-allocated buffers duplicated in new buffers.
24979 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
24980 #[repr(C)]
24981 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
24982 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
24983         /// A pointer to the contents in the success state.
24984         /// Reading from this pointer when `result_ok` is not set is undefined.
24985         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
24986         /// A pointer to the contents in the error state.
24987         /// Reading from this pointer when `result_ok` is set is undefined.
24988         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24989 }
24990 #[repr(C)]
24991 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
24992 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
24993 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24994 pub struct CResult_PaymentConstraintsDecodeErrorZ {
24995         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
24996         /// `err` or `result` depending on the state of `result_ok`.
24997         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
24998         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
24999         pub result_ok: bool,
25000 }
25001 #[no_mangle]
25002 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
25003 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
25004         CResult_PaymentConstraintsDecodeErrorZ {
25005                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25006                         result: Box::into_raw(Box::new(o)),
25007                 },
25008                 result_ok: true,
25009         }
25010 }
25011 #[no_mangle]
25012 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
25013 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
25014         CResult_PaymentConstraintsDecodeErrorZ {
25015                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25016                         err: Box::into_raw(Box::new(e)),
25017                 },
25018                 result_ok: false,
25019         }
25020 }
25021 /// Checks if the given object is currently in the success state
25022 #[no_mangle]
25023 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
25024         o.result_ok
25025 }
25026 #[no_mangle]
25027 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
25028 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
25029 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
25030         fn drop(&mut self) {
25031                 if self.result_ok {
25032                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25033                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25034                         }
25035                 } else {
25036                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25037                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25038                         }
25039                 }
25040         }
25041 }
25042 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
25043         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
25044                 let contents = if o.result_ok {
25045                         let result = unsafe { o.contents.result };
25046                         unsafe { o.contents.result = core::ptr::null_mut() };
25047                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
25048                 } else {
25049                         let err = unsafe { o.contents.err };
25050                         unsafe { o.contents.err = core::ptr::null_mut(); }
25051                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
25052                 };
25053                 Self {
25054                         contents,
25055                         result_ok: o.result_ok,
25056                 }
25057         }
25058 }
25059 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
25060         fn clone(&self) -> Self {
25061                 if self.result_ok {
25062                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25063                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
25064                         } }
25065                 } else {
25066                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25067                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25068                         } }
25069                 }
25070         }
25071 }
25072 #[no_mangle]
25073 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
25074 /// but with all dynamically-allocated buffers duplicated in new buffers.
25075 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
25076 #[repr(C)]
25077 /// The contents of CResult_PaymentContextDecodeErrorZ
25078 pub union CResult_PaymentContextDecodeErrorZPtr {
25079         /// A pointer to the contents in the success state.
25080         /// Reading from this pointer when `result_ok` is not set is undefined.
25081         pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
25082         /// A pointer to the contents in the error state.
25083         /// Reading from this pointer when `result_ok` is set is undefined.
25084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25085 }
25086 #[repr(C)]
25087 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
25088 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25090 pub struct CResult_PaymentContextDecodeErrorZ {
25091         /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
25092         /// `err` or `result` depending on the state of `result_ok`.
25093         pub contents: CResult_PaymentContextDecodeErrorZPtr,
25094         /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
25095         pub result_ok: bool,
25096 }
25097 #[no_mangle]
25098 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
25099 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
25100         CResult_PaymentContextDecodeErrorZ {
25101                 contents: CResult_PaymentContextDecodeErrorZPtr {
25102                         result: Box::into_raw(Box::new(o)),
25103                 },
25104                 result_ok: true,
25105         }
25106 }
25107 #[no_mangle]
25108 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
25109 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
25110         CResult_PaymentContextDecodeErrorZ {
25111                 contents: CResult_PaymentContextDecodeErrorZPtr {
25112                         err: Box::into_raw(Box::new(e)),
25113                 },
25114                 result_ok: false,
25115         }
25116 }
25117 /// Checks if the given object is currently in the success state
25118 #[no_mangle]
25119 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
25120         o.result_ok
25121 }
25122 #[no_mangle]
25123 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
25124 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
25125 impl Drop for CResult_PaymentContextDecodeErrorZ {
25126         fn drop(&mut self) {
25127                 if self.result_ok {
25128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25130                         }
25131                 } else {
25132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25134                         }
25135                 }
25136         }
25137 }
25138 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
25139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25140                 let contents = if o.result_ok {
25141                         let result = unsafe { o.contents.result };
25142                         unsafe { o.contents.result = core::ptr::null_mut() };
25143                         CResult_PaymentContextDecodeErrorZPtr { result }
25144                 } else {
25145                         let err = unsafe { o.contents.err };
25146                         unsafe { o.contents.err = core::ptr::null_mut(); }
25147                         CResult_PaymentContextDecodeErrorZPtr { err }
25148                 };
25149                 Self {
25150                         contents,
25151                         result_ok: o.result_ok,
25152                 }
25153         }
25154 }
25155 impl Clone for CResult_PaymentContextDecodeErrorZ {
25156         fn clone(&self) -> Self {
25157                 if self.result_ok {
25158                         Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
25159                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
25160                         } }
25161                 } else {
25162                         Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
25163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25164                         } }
25165                 }
25166         }
25167 }
25168 #[no_mangle]
25169 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
25170 /// but with all dynamically-allocated buffers duplicated in new buffers.
25171 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
25172 #[repr(C)]
25173 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
25174 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
25175         /// A pointer to the contents in the success state.
25176         /// Reading from this pointer when `result_ok` is not set is undefined.
25177         pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
25178         /// A pointer to the contents in the error state.
25179         /// Reading from this pointer when `result_ok` is set is undefined.
25180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25181 }
25182 #[repr(C)]
25183 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
25184 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25186 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
25187         /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
25188         /// `err` or `result` depending on the state of `result_ok`.
25189         pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
25190         /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
25191         pub result_ok: bool,
25192 }
25193 #[no_mangle]
25194 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
25195 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
25196         CResult_UnknownPaymentContextDecodeErrorZ {
25197                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25198                         result: Box::into_raw(Box::new(o)),
25199                 },
25200                 result_ok: true,
25201         }
25202 }
25203 #[no_mangle]
25204 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
25205 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
25206         CResult_UnknownPaymentContextDecodeErrorZ {
25207                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25208                         err: Box::into_raw(Box::new(e)),
25209                 },
25210                 result_ok: false,
25211         }
25212 }
25213 /// Checks if the given object is currently in the success state
25214 #[no_mangle]
25215 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
25216         o.result_ok
25217 }
25218 #[no_mangle]
25219 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
25220 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
25221 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
25222         fn drop(&mut self) {
25223                 if self.result_ok {
25224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25226                         }
25227                 } else {
25228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25230                         }
25231                 }
25232         }
25233 }
25234 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
25235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25236                 let contents = if o.result_ok {
25237                         let result = unsafe { o.contents.result };
25238                         unsafe { o.contents.result = core::ptr::null_mut() };
25239                         CResult_UnknownPaymentContextDecodeErrorZPtr { result }
25240                 } else {
25241                         let err = unsafe { o.contents.err };
25242                         unsafe { o.contents.err = core::ptr::null_mut(); }
25243                         CResult_UnknownPaymentContextDecodeErrorZPtr { err }
25244                 };
25245                 Self {
25246                         contents,
25247                         result_ok: o.result_ok,
25248                 }
25249         }
25250 }
25251 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
25252         fn clone(&self) -> Self {
25253                 if self.result_ok {
25254                         Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25255                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
25256                         } }
25257                 } else {
25258                         Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25260                         } }
25261                 }
25262         }
25263 }
25264 #[no_mangle]
25265 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
25266 /// but with all dynamically-allocated buffers duplicated in new buffers.
25267 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
25268 #[repr(C)]
25269 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
25270 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
25271         /// A pointer to the contents in the success state.
25272         /// Reading from this pointer when `result_ok` is not set is undefined.
25273         pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
25274         /// A pointer to the contents in the error state.
25275         /// Reading from this pointer when `result_ok` is set is undefined.
25276         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25277 }
25278 #[repr(C)]
25279 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
25280 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25282 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
25283         /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
25284         /// `err` or `result` depending on the state of `result_ok`.
25285         pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
25286         /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
25287         pub result_ok: bool,
25288 }
25289 #[no_mangle]
25290 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
25291 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
25292         CResult_Bolt12OfferContextDecodeErrorZ {
25293                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25294                         result: Box::into_raw(Box::new(o)),
25295                 },
25296                 result_ok: true,
25297         }
25298 }
25299 #[no_mangle]
25300 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
25301 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
25302         CResult_Bolt12OfferContextDecodeErrorZ {
25303                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25304                         err: Box::into_raw(Box::new(e)),
25305                 },
25306                 result_ok: false,
25307         }
25308 }
25309 /// Checks if the given object is currently in the success state
25310 #[no_mangle]
25311 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
25312         o.result_ok
25313 }
25314 #[no_mangle]
25315 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
25316 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
25317 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
25318         fn drop(&mut self) {
25319                 if self.result_ok {
25320                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25321                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25322                         }
25323                 } else {
25324                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25325                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25326                         }
25327                 }
25328         }
25329 }
25330 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
25331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25332                 let contents = if o.result_ok {
25333                         let result = unsafe { o.contents.result };
25334                         unsafe { o.contents.result = core::ptr::null_mut() };
25335                         CResult_Bolt12OfferContextDecodeErrorZPtr { result }
25336                 } else {
25337                         let err = unsafe { o.contents.err };
25338                         unsafe { o.contents.err = core::ptr::null_mut(); }
25339                         CResult_Bolt12OfferContextDecodeErrorZPtr { err }
25340                 };
25341                 Self {
25342                         contents,
25343                         result_ok: o.result_ok,
25344                 }
25345         }
25346 }
25347 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
25348         fn clone(&self) -> Self {
25349                 if self.result_ok {
25350                         Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25351                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
25352                         } }
25353                 } else {
25354                         Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25355                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25356                         } }
25357                 }
25358         }
25359 }
25360 #[no_mangle]
25361 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
25362 /// but with all dynamically-allocated buffers duplicated in new buffers.
25363 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
25364 #[repr(C)]
25365 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
25366 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
25367         /// A pointer to the contents in the success state.
25368         /// Reading from this pointer when `result_ok` is not set is undefined.
25369         pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
25370         /// A pointer to the contents in the error state.
25371         /// Reading from this pointer when `result_ok` is set is undefined.
25372         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25373 }
25374 #[repr(C)]
25375 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
25376 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25378 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
25379         /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
25380         /// `err` or `result` depending on the state of `result_ok`.
25381         pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
25382         /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
25383         pub result_ok: bool,
25384 }
25385 #[no_mangle]
25386 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
25387 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
25388         CResult_Bolt12RefundContextDecodeErrorZ {
25389                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25390                         result: Box::into_raw(Box::new(o)),
25391                 },
25392                 result_ok: true,
25393         }
25394 }
25395 #[no_mangle]
25396 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
25397 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
25398         CResult_Bolt12RefundContextDecodeErrorZ {
25399                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25400                         err: Box::into_raw(Box::new(e)),
25401                 },
25402                 result_ok: false,
25403         }
25404 }
25405 /// Checks if the given object is currently in the success state
25406 #[no_mangle]
25407 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
25408         o.result_ok
25409 }
25410 #[no_mangle]
25411 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
25412 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
25413 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
25414         fn drop(&mut self) {
25415                 if self.result_ok {
25416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25418                         }
25419                 } else {
25420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25422                         }
25423                 }
25424         }
25425 }
25426 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
25427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25428                 let contents = if o.result_ok {
25429                         let result = unsafe { o.contents.result };
25430                         unsafe { o.contents.result = core::ptr::null_mut() };
25431                         CResult_Bolt12RefundContextDecodeErrorZPtr { result }
25432                 } else {
25433                         let err = unsafe { o.contents.err };
25434                         unsafe { o.contents.err = core::ptr::null_mut(); }
25435                         CResult_Bolt12RefundContextDecodeErrorZPtr { err }
25436                 };
25437                 Self {
25438                         contents,
25439                         result_ok: o.result_ok,
25440                 }
25441         }
25442 }
25443 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
25444         fn clone(&self) -> Self {
25445                 if self.result_ok {
25446                         Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25447                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
25448                         } }
25449                 } else {
25450                         Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25451                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25452                         } }
25453                 }
25454         }
25455 }
25456 #[no_mangle]
25457 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
25458 /// but with all dynamically-allocated buffers duplicated in new buffers.
25459 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
25460 #[repr(C)]
25461 /// The contents of CResult_StrSecp256k1ErrorZ
25462 pub union CResult_StrSecp256k1ErrorZPtr {
25463         /// A pointer to the contents in the success state.
25464         /// Reading from this pointer when `result_ok` is not set is undefined.
25465         pub result: *mut crate::c_types::Str,
25466         /// A pointer to the contents in the error state.
25467         /// Reading from this pointer when `result_ok` is set is undefined.
25468         pub err: *mut crate::c_types::Secp256k1Error,
25469 }
25470 #[repr(C)]
25471 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
25472 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
25473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25474 pub struct CResult_StrSecp256k1ErrorZ {
25475         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
25476         /// `err` or `result` depending on the state of `result_ok`.
25477         pub contents: CResult_StrSecp256k1ErrorZPtr,
25478         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
25479         pub result_ok: bool,
25480 }
25481 #[no_mangle]
25482 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
25483 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
25484         CResult_StrSecp256k1ErrorZ {
25485                 contents: CResult_StrSecp256k1ErrorZPtr {
25486                         result: Box::into_raw(Box::new(o)),
25487                 },
25488                 result_ok: true,
25489         }
25490 }
25491 #[no_mangle]
25492 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
25493 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
25494         CResult_StrSecp256k1ErrorZ {
25495                 contents: CResult_StrSecp256k1ErrorZPtr {
25496                         err: Box::into_raw(Box::new(e)),
25497                 },
25498                 result_ok: false,
25499         }
25500 }
25501 /// Checks if the given object is currently in the success state
25502 #[no_mangle]
25503 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
25504         o.result_ok
25505 }
25506 #[no_mangle]
25507 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
25508 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
25509 impl Drop for CResult_StrSecp256k1ErrorZ {
25510         fn drop(&mut self) {
25511                 if self.result_ok {
25512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25514                         }
25515                 } else {
25516                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25517                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25518                         }
25519                 }
25520         }
25521 }
25522 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
25523         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
25524                 let contents = if o.result_ok {
25525                         let result = unsafe { o.contents.result };
25526                         unsafe { o.contents.result = core::ptr::null_mut() };
25527                         CResult_StrSecp256k1ErrorZPtr { result }
25528                 } else {
25529                         let err = unsafe { o.contents.err };
25530                         unsafe { o.contents.err = core::ptr::null_mut(); }
25531                         CResult_StrSecp256k1ErrorZPtr { err }
25532                 };
25533                 Self {
25534                         contents,
25535                         result_ok: o.result_ok,
25536                 }
25537         }
25538 }
25539 impl Clone for CResult_StrSecp256k1ErrorZ {
25540         fn clone(&self) -> Self {
25541                 if self.result_ok {
25542                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
25543                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
25544                         } }
25545                 } else {
25546                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
25547                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
25548                         } }
25549                 }
25550         }
25551 }
25552 #[no_mangle]
25553 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
25554 /// but with all dynamically-allocated buffers duplicated in new buffers.
25555 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
25556 #[repr(C)]
25557 /// A tuple of 3 elements. See the individual fields for the types contained.
25558 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25559         /// The element at position 0
25560         pub a: crate::c_types::ThirtyTwoBytes,
25561         /// The element at position 1
25562         pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
25563         /// The element at position 2
25564         pub c: crate::lightning::routing::router::RouteParameters,
25565 }
25566 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25567         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
25568                 Self {
25569                         a: tup.0,
25570                         b: tup.1,
25571                         c: tup.2,
25572                 }
25573         }
25574 }
25575 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25576         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
25577                 (self.a, self.b, self.c)
25578         }
25579 }
25580 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25581         fn clone(&self) -> Self {
25582                 Self {
25583                         a: Clone::clone(&self.a),
25584                         b: Clone::clone(&self.b),
25585                         c: Clone::clone(&self.c),
25586                 }
25587         }
25588 }
25589 #[no_mangle]
25590 /// Creates a new tuple which has the same data as `orig`
25591 /// but with all dynamically-allocated buffers duplicated in new buffers.
25592 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
25593 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
25594 #[no_mangle]
25595 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 {
25596         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
25597 }
25598
25599 #[no_mangle]
25600 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
25601 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
25602 #[repr(C)]
25603 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
25604 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25605         /// A pointer to the contents in the success state.
25606         /// Reading from this pointer when `result_ok` is not set is undefined.
25607         pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
25608         /// Note that this value is always NULL, as there are no contents in the Err variant
25609         pub err: *mut core::ffi::c_void,
25610 }
25611 #[repr(C)]
25612 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
25613 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
25614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25615 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25616         /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
25617         /// `err` or `result` depending on the state of `result_ok`.
25618         pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
25619         /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
25620         pub result_ok: bool,
25621 }
25622 #[no_mangle]
25623 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
25624 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25625         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25626                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25627                         result: Box::into_raw(Box::new(o)),
25628                 },
25629                 result_ok: true,
25630         }
25631 }
25632 #[no_mangle]
25633 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
25634 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25635         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25636                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25637                         err: core::ptr::null_mut(),
25638                 },
25639                 result_ok: false,
25640         }
25641 }
25642 /// Checks if the given object is currently in the success state
25643 #[no_mangle]
25644 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
25645         o.result_ok
25646 }
25647 #[no_mangle]
25648 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
25649 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
25650 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25651         fn drop(&mut self) {
25652                 if self.result_ok {
25653                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25654                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25655                         }
25656                 } else {
25657                 }
25658         }
25659 }
25660 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25661         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
25662                 let contents = if o.result_ok {
25663                         let result = unsafe { o.contents.result };
25664                         unsafe { o.contents.result = core::ptr::null_mut() };
25665                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
25666                 } else {
25667                         let _ = unsafe { Box::from_raw(o.contents.err) };
25668                         o.contents.err = core::ptr::null_mut();
25669                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
25670                 };
25671                 Self {
25672                         contents,
25673                         result_ok: o.result_ok,
25674                 }
25675         }
25676 }
25677 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25678         fn clone(&self) -> Self {
25679                 if self.result_ok {
25680                         Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25681                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
25682                         } }
25683                 } else {
25684                         Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25685                                 err: core::ptr::null_mut()
25686                         } }
25687                 }
25688         }
25689 }
25690 #[no_mangle]
25691 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
25692 /// but with all dynamically-allocated buffers duplicated in new buffers.
25693 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
25694 #[repr(C)]
25695 /// The contents of CResult_TxOutUtxoLookupErrorZ
25696 pub union CResult_TxOutUtxoLookupErrorZPtr {
25697         /// A pointer to the contents in the success state.
25698         /// Reading from this pointer when `result_ok` is not set is undefined.
25699         pub result: *mut crate::c_types::TxOut,
25700         /// A pointer to the contents in the error state.
25701         /// Reading from this pointer when `result_ok` is set is undefined.
25702         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
25703 }
25704 #[repr(C)]
25705 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
25706 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
25707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25708 pub struct CResult_TxOutUtxoLookupErrorZ {
25709         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
25710         /// `err` or `result` depending on the state of `result_ok`.
25711         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
25712         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
25713         pub result_ok: bool,
25714 }
25715 #[no_mangle]
25716 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
25717 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
25718         CResult_TxOutUtxoLookupErrorZ {
25719                 contents: CResult_TxOutUtxoLookupErrorZPtr {
25720                         result: Box::into_raw(Box::new(o)),
25721                 },
25722                 result_ok: true,
25723         }
25724 }
25725 #[no_mangle]
25726 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
25727 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
25728         CResult_TxOutUtxoLookupErrorZ {
25729                 contents: CResult_TxOutUtxoLookupErrorZPtr {
25730                         err: Box::into_raw(Box::new(e)),
25731                 },
25732                 result_ok: false,
25733         }
25734 }
25735 /// Checks if the given object is currently in the success state
25736 #[no_mangle]
25737 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
25738         o.result_ok
25739 }
25740 #[no_mangle]
25741 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
25742 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
25743 impl Drop for CResult_TxOutUtxoLookupErrorZ {
25744         fn drop(&mut self) {
25745                 if self.result_ok {
25746                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25747                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25748                         }
25749                 } else {
25750                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25751                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25752                         }
25753                 }
25754         }
25755 }
25756 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
25757         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
25758                 let contents = if o.result_ok {
25759                         let result = unsafe { o.contents.result };
25760                         unsafe { o.contents.result = core::ptr::null_mut() };
25761                         CResult_TxOutUtxoLookupErrorZPtr { result }
25762                 } else {
25763                         let err = unsafe { o.contents.err };
25764                         unsafe { o.contents.err = core::ptr::null_mut(); }
25765                         CResult_TxOutUtxoLookupErrorZPtr { err }
25766                 };
25767                 Self {
25768                         contents,
25769                         result_ok: o.result_ok,
25770                 }
25771         }
25772 }
25773 impl Clone for CResult_TxOutUtxoLookupErrorZ {
25774         fn clone(&self) -> Self {
25775                 if self.result_ok {
25776                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
25777                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
25778                         } }
25779                 } else {
25780                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
25781                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
25782                         } }
25783                 }
25784         }
25785 }
25786 #[no_mangle]
25787 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
25788 /// but with all dynamically-allocated buffers duplicated in new buffers.
25789 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
25790 #[repr(C)]
25791 /// A tuple of 3 elements. See the individual fields for the types contained.
25792 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25793         /// The element at position 0
25794         pub a: crate::c_types::PublicKey,
25795         /// The element at position 1
25796         pub b: crate::lightning::ln::msgs::OnionMessage,
25797         /// The element at position 2
25798         pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
25799 }
25800 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25801         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
25802                 Self {
25803                         a: tup.0,
25804                         b: tup.1,
25805                         c: tup.2,
25806                 }
25807         }
25808 }
25809 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25810         #[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) {
25811                 (self.a, self.b, self.c)
25812         }
25813 }
25814 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25815         fn clone(&self) -> Self {
25816                 Self {
25817                         a: Clone::clone(&self.a),
25818                         b: Clone::clone(&self.b),
25819                         c: Clone::clone(&self.c),
25820                 }
25821         }
25822 }
25823 #[no_mangle]
25824 /// Creates a new tuple which has the same data as `orig`
25825 /// but with all dynamically-allocated buffers duplicated in new buffers.
25826 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
25827 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
25828 #[no_mangle]
25829 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 {
25830         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
25831 }
25832
25833 #[no_mangle]
25834 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
25835 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
25836 #[repr(C)]
25837 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
25838 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25839         /// A pointer to the contents in the success state.
25840         /// Reading from this pointer when `result_ok` is not set is undefined.
25841         pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
25842         /// A pointer to the contents in the error state.
25843         /// Reading from this pointer when `result_ok` is set is undefined.
25844         pub err: *mut crate::lightning::onion_message::messenger::SendError,
25845 }
25846 #[repr(C)]
25847 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
25848 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
25849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25850 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25851         /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
25852         /// `err` or `result` depending on the state of `result_ok`.
25853         pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
25854         /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
25855         pub result_ok: bool,
25856 }
25857 #[no_mangle]
25858 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
25859 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25860         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25861                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25862                         result: Box::into_raw(Box::new(o)),
25863                 },
25864                 result_ok: true,
25865         }
25866 }
25867 #[no_mangle]
25868 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
25869 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25870         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25871                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25872                         err: Box::into_raw(Box::new(e)),
25873                 },
25874                 result_ok: false,
25875         }
25876 }
25877 /// Checks if the given object is currently in the success state
25878 #[no_mangle]
25879 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
25880         o.result_ok
25881 }
25882 #[no_mangle]
25883 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
25884 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
25885 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25886         fn drop(&mut self) {
25887                 if self.result_ok {
25888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25890                         }
25891                 } else {
25892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25894                         }
25895                 }
25896         }
25897 }
25898 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 {
25899         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
25900                 let contents = if o.result_ok {
25901                         let result = unsafe { o.contents.result };
25902                         unsafe { o.contents.result = core::ptr::null_mut() };
25903                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
25904                 } else {
25905                         let err = unsafe { o.contents.err };
25906                         unsafe { o.contents.err = core::ptr::null_mut(); }
25907                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
25908                 };
25909                 Self {
25910                         contents,
25911                         result_ok: o.result_ok,
25912                 }
25913         }
25914 }
25915 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25916         fn clone(&self) -> Self {
25917                 if self.result_ok {
25918                         Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25919                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
25920                         } }
25921                 } else {
25922                         Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25923                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
25924                         } }
25925                 }
25926         }
25927 }
25928 #[no_mangle]
25929 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
25930 /// but with all dynamically-allocated buffers duplicated in new buffers.
25931 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
25932 #[repr(C)]
25933 /// The contents of CResult_PeeledOnionNoneZ
25934 pub union CResult_PeeledOnionNoneZPtr {
25935         /// A pointer to the contents in the success state.
25936         /// Reading from this pointer when `result_ok` is not set is undefined.
25937         pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
25938         /// Note that this value is always NULL, as there are no contents in the Err variant
25939         pub err: *mut core::ffi::c_void,
25940 }
25941 #[repr(C)]
25942 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
25943 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
25944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25945 pub struct CResult_PeeledOnionNoneZ {
25946         /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
25947         /// `err` or `result` depending on the state of `result_ok`.
25948         pub contents: CResult_PeeledOnionNoneZPtr,
25949         /// Whether this CResult_PeeledOnionNoneZ represents a success state.
25950         pub result_ok: bool,
25951 }
25952 #[no_mangle]
25953 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
25954 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
25955         CResult_PeeledOnionNoneZ {
25956                 contents: CResult_PeeledOnionNoneZPtr {
25957                         result: Box::into_raw(Box::new(o)),
25958                 },
25959                 result_ok: true,
25960         }
25961 }
25962 #[no_mangle]
25963 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
25964 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
25965         CResult_PeeledOnionNoneZ {
25966                 contents: CResult_PeeledOnionNoneZPtr {
25967                         err: core::ptr::null_mut(),
25968                 },
25969                 result_ok: false,
25970         }
25971 }
25972 /// Checks if the given object is currently in the success state
25973 #[no_mangle]
25974 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
25975         o.result_ok
25976 }
25977 #[no_mangle]
25978 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
25979 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
25980 impl Drop for CResult_PeeledOnionNoneZ {
25981         fn drop(&mut self) {
25982                 if self.result_ok {
25983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25985                         }
25986                 } else {
25987                 }
25988         }
25989 }
25990 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
25991         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
25992                 let contents = if o.result_ok {
25993                         let result = unsafe { o.contents.result };
25994                         unsafe { o.contents.result = core::ptr::null_mut() };
25995                         CResult_PeeledOnionNoneZPtr { result }
25996                 } else {
25997                         let _ = unsafe { Box::from_raw(o.contents.err) };
25998                         o.contents.err = core::ptr::null_mut();
25999                         CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
26000                 };
26001                 Self {
26002                         contents,
26003                         result_ok: o.result_ok,
26004                 }
26005         }
26006 }
26007 impl Clone for CResult_PeeledOnionNoneZ {
26008         fn clone(&self) -> Self {
26009                 if self.result_ok {
26010                         Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
26011                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
26012                         } }
26013                 } else {
26014                         Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
26015                                 err: core::ptr::null_mut()
26016                         } }
26017                 }
26018         }
26019 }
26020 #[no_mangle]
26021 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
26022 /// but with all dynamically-allocated buffers duplicated in new buffers.
26023 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
26024 #[repr(C)]
26025 /// The contents of CResult_SendSuccessSendErrorZ
26026 pub union CResult_SendSuccessSendErrorZPtr {
26027         /// A pointer to the contents in the success state.
26028         /// Reading from this pointer when `result_ok` is not set is undefined.
26029         pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
26030         /// A pointer to the contents in the error state.
26031         /// Reading from this pointer when `result_ok` is set is undefined.
26032         pub err: *mut crate::lightning::onion_message::messenger::SendError,
26033 }
26034 #[repr(C)]
26035 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
26036 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
26037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26038 pub struct CResult_SendSuccessSendErrorZ {
26039         /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
26040         /// `err` or `result` depending on the state of `result_ok`.
26041         pub contents: CResult_SendSuccessSendErrorZPtr,
26042         /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
26043         pub result_ok: bool,
26044 }
26045 #[no_mangle]
26046 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
26047 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
26048         CResult_SendSuccessSendErrorZ {
26049                 contents: CResult_SendSuccessSendErrorZPtr {
26050                         result: Box::into_raw(Box::new(o)),
26051                 },
26052                 result_ok: true,
26053         }
26054 }
26055 #[no_mangle]
26056 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
26057 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
26058         CResult_SendSuccessSendErrorZ {
26059                 contents: CResult_SendSuccessSendErrorZPtr {
26060                         err: Box::into_raw(Box::new(e)),
26061                 },
26062                 result_ok: false,
26063         }
26064 }
26065 /// Checks if the given object is currently in the success state
26066 #[no_mangle]
26067 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
26068         o.result_ok
26069 }
26070 #[no_mangle]
26071 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
26072 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
26073 impl Drop for CResult_SendSuccessSendErrorZ {
26074         fn drop(&mut self) {
26075                 if self.result_ok {
26076                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26077                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26078                         }
26079                 } else {
26080                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26081                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26082                         }
26083                 }
26084         }
26085 }
26086 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
26087         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
26088                 let contents = if o.result_ok {
26089                         let result = unsafe { o.contents.result };
26090                         unsafe { o.contents.result = core::ptr::null_mut() };
26091                         CResult_SendSuccessSendErrorZPtr { result }
26092                 } else {
26093                         let err = unsafe { o.contents.err };
26094                         unsafe { o.contents.err = core::ptr::null_mut(); }
26095                         CResult_SendSuccessSendErrorZPtr { err }
26096                 };
26097                 Self {
26098                         contents,
26099                         result_ok: o.result_ok,
26100                 }
26101         }
26102 }
26103 impl Clone for CResult_SendSuccessSendErrorZ {
26104         fn clone(&self) -> Self {
26105                 if self.result_ok {
26106                         Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
26107                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
26108                         } }
26109                 } else {
26110                         Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
26111                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26112                         } }
26113                 }
26114         }
26115 }
26116 #[no_mangle]
26117 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
26118 /// but with all dynamically-allocated buffers duplicated in new buffers.
26119 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
26120 #[repr(C)]
26121 /// The contents of CResult_BlindedPathNoneZ
26122 pub union CResult_BlindedPathNoneZPtr {
26123         /// A pointer to the contents in the success state.
26124         /// Reading from this pointer when `result_ok` is not set is undefined.
26125         pub result: *mut crate::lightning::blinded_path::BlindedPath,
26126         /// Note that this value is always NULL, as there are no contents in the Err variant
26127         pub err: *mut core::ffi::c_void,
26128 }
26129 #[repr(C)]
26130 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
26131 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
26132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26133 pub struct CResult_BlindedPathNoneZ {
26134         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
26135         /// `err` or `result` depending on the state of `result_ok`.
26136         pub contents: CResult_BlindedPathNoneZPtr,
26137         /// Whether this CResult_BlindedPathNoneZ represents a success state.
26138         pub result_ok: bool,
26139 }
26140 #[no_mangle]
26141 /// Creates a new CResult_BlindedPathNoneZ in the success state.
26142 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
26143         CResult_BlindedPathNoneZ {
26144                 contents: CResult_BlindedPathNoneZPtr {
26145                         result: Box::into_raw(Box::new(o)),
26146                 },
26147                 result_ok: true,
26148         }
26149 }
26150 #[no_mangle]
26151 /// Creates a new CResult_BlindedPathNoneZ in the error state.
26152 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
26153         CResult_BlindedPathNoneZ {
26154                 contents: CResult_BlindedPathNoneZPtr {
26155                         err: core::ptr::null_mut(),
26156                 },
26157                 result_ok: false,
26158         }
26159 }
26160 /// Checks if the given object is currently in the success state
26161 #[no_mangle]
26162 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
26163         o.result_ok
26164 }
26165 #[no_mangle]
26166 /// Frees any resources used by the CResult_BlindedPathNoneZ.
26167 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
26168 impl Drop for CResult_BlindedPathNoneZ {
26169         fn drop(&mut self) {
26170                 if self.result_ok {
26171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26173                         }
26174                 } else {
26175                 }
26176         }
26177 }
26178 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
26179         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
26180                 let contents = if o.result_ok {
26181                         let result = unsafe { o.contents.result };
26182                         unsafe { o.contents.result = core::ptr::null_mut() };
26183                         CResult_BlindedPathNoneZPtr { result }
26184                 } else {
26185                         let _ = unsafe { Box::from_raw(o.contents.err) };
26186                         o.contents.err = core::ptr::null_mut();
26187                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
26188                 };
26189                 Self {
26190                         contents,
26191                         result_ok: o.result_ok,
26192                 }
26193         }
26194 }
26195 impl Clone for CResult_BlindedPathNoneZ {
26196         fn clone(&self) -> Self {
26197                 if self.result_ok {
26198                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
26199                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26200                         } }
26201                 } else {
26202                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
26203                                 err: core::ptr::null_mut()
26204                         } }
26205                 }
26206         }
26207 }
26208 #[no_mangle]
26209 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
26210 /// but with all dynamically-allocated buffers duplicated in new buffers.
26211 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
26212 #[repr(C)]
26213 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
26214 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26215         /// A pointer to the contents in the success state.
26216         /// Reading from this pointer when `result_ok` is not set is undefined.
26217         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
26218         /// Note that this value is always NULL, as there are no contents in the Err variant
26219         pub err: *mut core::ffi::c_void,
26220 }
26221 #[repr(C)]
26222 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
26223 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
26224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26225 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26226         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
26227         /// `err` or `result` depending on the state of `result_ok`.
26228         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
26229         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
26230         pub result_ok: bool,
26231 }
26232 #[no_mangle]
26233 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
26234 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26235         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26236                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26237                         result: Box::into_raw(Box::new(o)),
26238                 },
26239                 result_ok: true,
26240         }
26241 }
26242 #[no_mangle]
26243 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
26244 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26245         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26246                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26247                         err: core::ptr::null_mut(),
26248                 },
26249                 result_ok: false,
26250         }
26251 }
26252 /// Checks if the given object is currently in the success state
26253 #[no_mangle]
26254 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
26255         o.result_ok
26256 }
26257 #[no_mangle]
26258 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
26259 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
26260 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26261         fn drop(&mut self) {
26262                 if self.result_ok {
26263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26265                         }
26266                 } else {
26267                 }
26268         }
26269 }
26270 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26271         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
26272                 let contents = if o.result_ok {
26273                         let result = unsafe { o.contents.result };
26274                         unsafe { o.contents.result = core::ptr::null_mut() };
26275                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
26276                 } else {
26277                         let _ = unsafe { Box::from_raw(o.contents.err) };
26278                         o.contents.err = core::ptr::null_mut();
26279                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
26280                 };
26281                 Self {
26282                         contents,
26283                         result_ok: o.result_ok,
26284                 }
26285         }
26286 }
26287 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26288         fn clone(&self) -> Self {
26289                 if self.result_ok {
26290                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26291                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
26292                         } }
26293                 } else {
26294                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26295                                 err: core::ptr::null_mut()
26296                         } }
26297                 }
26298         }
26299 }
26300 #[no_mangle]
26301 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
26302 /// but with all dynamically-allocated buffers duplicated in new buffers.
26303 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
26304 #[repr(C)]
26305 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
26306 /// This corresponds to std::vector in C++
26307 pub struct CVec_ForwardNodeZ {
26308         /// The elements in the array.
26309         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26310         pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
26311         /// The number of elements pointed to by `data`.
26312         pub datalen: usize
26313 }
26314 impl CVec_ForwardNodeZ {
26315         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
26316                 if self.datalen == 0 { return Vec::new(); }
26317                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26318                 self.data = core::ptr::null_mut();
26319                 self.datalen = 0;
26320                 ret
26321         }
26322         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
26323                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26324         }
26325 }
26326 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
26327         fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
26328                 let datalen = v.len();
26329                 let data = Box::into_raw(v.into_boxed_slice());
26330                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26331         }
26332 }
26333 #[no_mangle]
26334 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26335 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
26336 impl Drop for CVec_ForwardNodeZ {
26337         fn drop(&mut self) {
26338                 if self.datalen == 0 { return; }
26339                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26340         }
26341 }
26342 impl Clone for CVec_ForwardNodeZ {
26343         fn clone(&self) -> Self {
26344                 let mut res = Vec::new();
26345                 if self.datalen == 0 { return Self::from(res); }
26346                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26347                 Self::from(res)
26348         }
26349 }
26350 #[repr(C)]
26351 /// The contents of CResult_BlindedPathDecodeErrorZ
26352 pub union CResult_BlindedPathDecodeErrorZPtr {
26353         /// A pointer to the contents in the success state.
26354         /// Reading from this pointer when `result_ok` is not set is undefined.
26355         pub result: *mut crate::lightning::blinded_path::BlindedPath,
26356         /// A pointer to the contents in the error state.
26357         /// Reading from this pointer when `result_ok` is set is undefined.
26358         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26359 }
26360 #[repr(C)]
26361 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
26362 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
26363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26364 pub struct CResult_BlindedPathDecodeErrorZ {
26365         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
26366         /// `err` or `result` depending on the state of `result_ok`.
26367         pub contents: CResult_BlindedPathDecodeErrorZPtr,
26368         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
26369         pub result_ok: bool,
26370 }
26371 #[no_mangle]
26372 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
26373 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
26374         CResult_BlindedPathDecodeErrorZ {
26375                 contents: CResult_BlindedPathDecodeErrorZPtr {
26376                         result: Box::into_raw(Box::new(o)),
26377                 },
26378                 result_ok: true,
26379         }
26380 }
26381 #[no_mangle]
26382 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
26383 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
26384         CResult_BlindedPathDecodeErrorZ {
26385                 contents: CResult_BlindedPathDecodeErrorZPtr {
26386                         err: Box::into_raw(Box::new(e)),
26387                 },
26388                 result_ok: false,
26389         }
26390 }
26391 /// Checks if the given object is currently in the success state
26392 #[no_mangle]
26393 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
26394         o.result_ok
26395 }
26396 #[no_mangle]
26397 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
26398 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
26399 impl Drop for CResult_BlindedPathDecodeErrorZ {
26400         fn drop(&mut self) {
26401                 if self.result_ok {
26402                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26403                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26404                         }
26405                 } else {
26406                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26407                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26408                         }
26409                 }
26410         }
26411 }
26412 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
26413         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
26414                 let contents = if o.result_ok {
26415                         let result = unsafe { o.contents.result };
26416                         unsafe { o.contents.result = core::ptr::null_mut() };
26417                         CResult_BlindedPathDecodeErrorZPtr { result }
26418                 } else {
26419                         let err = unsafe { o.contents.err };
26420                         unsafe { o.contents.err = core::ptr::null_mut(); }
26421                         CResult_BlindedPathDecodeErrorZPtr { err }
26422                 };
26423                 Self {
26424                         contents,
26425                         result_ok: o.result_ok,
26426                 }
26427         }
26428 }
26429 impl Clone for CResult_BlindedPathDecodeErrorZ {
26430         fn clone(&self) -> Self {
26431                 if self.result_ok {
26432                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
26433                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26434                         } }
26435                 } else {
26436                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
26437                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26438                         } }
26439                 }
26440         }
26441 }
26442 #[no_mangle]
26443 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
26444 /// but with all dynamically-allocated buffers duplicated in new buffers.
26445 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
26446 #[repr(C)]
26447 /// The contents of CResult_BlindedHopDecodeErrorZ
26448 pub union CResult_BlindedHopDecodeErrorZPtr {
26449         /// A pointer to the contents in the success state.
26450         /// Reading from this pointer when `result_ok` is not set is undefined.
26451         pub result: *mut crate::lightning::blinded_path::BlindedHop,
26452         /// A pointer to the contents in the error state.
26453         /// Reading from this pointer when `result_ok` is set is undefined.
26454         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26455 }
26456 #[repr(C)]
26457 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
26458 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
26459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26460 pub struct CResult_BlindedHopDecodeErrorZ {
26461         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
26462         /// `err` or `result` depending on the state of `result_ok`.
26463         pub contents: CResult_BlindedHopDecodeErrorZPtr,
26464         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
26465         pub result_ok: bool,
26466 }
26467 #[no_mangle]
26468 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
26469 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
26470         CResult_BlindedHopDecodeErrorZ {
26471                 contents: CResult_BlindedHopDecodeErrorZPtr {
26472                         result: Box::into_raw(Box::new(o)),
26473                 },
26474                 result_ok: true,
26475         }
26476 }
26477 #[no_mangle]
26478 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
26479 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
26480         CResult_BlindedHopDecodeErrorZ {
26481                 contents: CResult_BlindedHopDecodeErrorZPtr {
26482                         err: Box::into_raw(Box::new(e)),
26483                 },
26484                 result_ok: false,
26485         }
26486 }
26487 /// Checks if the given object is currently in the success state
26488 #[no_mangle]
26489 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
26490         o.result_ok
26491 }
26492 #[no_mangle]
26493 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
26494 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
26495 impl Drop for CResult_BlindedHopDecodeErrorZ {
26496         fn drop(&mut self) {
26497                 if self.result_ok {
26498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26500                         }
26501                 } else {
26502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26504                         }
26505                 }
26506         }
26507 }
26508 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
26509         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
26510                 let contents = if o.result_ok {
26511                         let result = unsafe { o.contents.result };
26512                         unsafe { o.contents.result = core::ptr::null_mut() };
26513                         CResult_BlindedHopDecodeErrorZPtr { result }
26514                 } else {
26515                         let err = unsafe { o.contents.err };
26516                         unsafe { o.contents.err = core::ptr::null_mut(); }
26517                         CResult_BlindedHopDecodeErrorZPtr { err }
26518                 };
26519                 Self {
26520                         contents,
26521                         result_ok: o.result_ok,
26522                 }
26523         }
26524 }
26525 impl Clone for CResult_BlindedHopDecodeErrorZ {
26526         fn clone(&self) -> Self {
26527                 if self.result_ok {
26528                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
26529                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
26530                         } }
26531                 } else {
26532                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
26533                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26534                         } }
26535                 }
26536         }
26537 }
26538 #[no_mangle]
26539 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
26540 /// but with all dynamically-allocated buffers duplicated in new buffers.
26541 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
26542 #[repr(C)]
26543 /// The contents of CResult_InvoiceErrorDecodeErrorZ
26544 pub union CResult_InvoiceErrorDecodeErrorZPtr {
26545         /// A pointer to the contents in the success state.
26546         /// Reading from this pointer when `result_ok` is not set is undefined.
26547         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
26548         /// A pointer to the contents in the error state.
26549         /// Reading from this pointer when `result_ok` is set is undefined.
26550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26551 }
26552 #[repr(C)]
26553 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
26554 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
26555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26556 pub struct CResult_InvoiceErrorDecodeErrorZ {
26557         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
26558         /// `err` or `result` depending on the state of `result_ok`.
26559         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
26560         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
26561         pub result_ok: bool,
26562 }
26563 #[no_mangle]
26564 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
26565 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
26566         CResult_InvoiceErrorDecodeErrorZ {
26567                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26568                         result: Box::into_raw(Box::new(o)),
26569                 },
26570                 result_ok: true,
26571         }
26572 }
26573 #[no_mangle]
26574 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
26575 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
26576         CResult_InvoiceErrorDecodeErrorZ {
26577                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26578                         err: Box::into_raw(Box::new(e)),
26579                 },
26580                 result_ok: false,
26581         }
26582 }
26583 /// Checks if the given object is currently in the success state
26584 #[no_mangle]
26585 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
26586         o.result_ok
26587 }
26588 #[no_mangle]
26589 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
26590 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
26591 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
26592         fn drop(&mut self) {
26593                 if self.result_ok {
26594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26596                         }
26597                 } else {
26598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26600                         }
26601                 }
26602         }
26603 }
26604 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
26605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
26606                 let contents = if o.result_ok {
26607                         let result = unsafe { o.contents.result };
26608                         unsafe { o.contents.result = core::ptr::null_mut() };
26609                         CResult_InvoiceErrorDecodeErrorZPtr { result }
26610                 } else {
26611                         let err = unsafe { o.contents.err };
26612                         unsafe { o.contents.err = core::ptr::null_mut(); }
26613                         CResult_InvoiceErrorDecodeErrorZPtr { err }
26614                 };
26615                 Self {
26616                         contents,
26617                         result_ok: o.result_ok,
26618                 }
26619         }
26620 }
26621 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
26622         fn clone(&self) -> Self {
26623                 if self.result_ok {
26624                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26625                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
26626                         } }
26627                 } else {
26628                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26630                         } }
26631                 }
26632         }
26633 }
26634 #[no_mangle]
26635 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
26636 /// but with all dynamically-allocated buffers duplicated in new buffers.
26637 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
26638 #[repr(C)]
26639 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
26640 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
26641         /// A pointer to the contents in the success state.
26642         /// Reading from this pointer when `result_ok` is not set is undefined.
26643         pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26644         /// A pointer to the contents in the error state.
26645         /// Reading from this pointer when `result_ok` is set is undefined.
26646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26647 }
26648 #[repr(C)]
26649 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
26650 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
26651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26652 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
26653         /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
26654         /// `err` or `result` depending on the state of `result_ok`.
26655         pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
26656         /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
26657         pub result_ok: bool,
26658 }
26659 #[no_mangle]
26660 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
26661 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26662         CResult_TrackedSpendableOutputDecodeErrorZ {
26663                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26664                         result: Box::into_raw(Box::new(o)),
26665                 },
26666                 result_ok: true,
26667         }
26668 }
26669 #[no_mangle]
26670 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
26671 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26672         CResult_TrackedSpendableOutputDecodeErrorZ {
26673                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26674                         err: Box::into_raw(Box::new(e)),
26675                 },
26676                 result_ok: false,
26677         }
26678 }
26679 /// Checks if the given object is currently in the success state
26680 #[no_mangle]
26681 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
26682         o.result_ok
26683 }
26684 #[no_mangle]
26685 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
26686 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
26687 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
26688         fn drop(&mut self) {
26689                 if self.result_ok {
26690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26692                         }
26693                 } else {
26694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26696                         }
26697                 }
26698         }
26699 }
26700 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
26701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
26702                 let contents = if o.result_ok {
26703                         let result = unsafe { o.contents.result };
26704                         unsafe { o.contents.result = core::ptr::null_mut() };
26705                         CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
26706                 } else {
26707                         let err = unsafe { o.contents.err };
26708                         unsafe { o.contents.err = core::ptr::null_mut(); }
26709                         CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
26710                 };
26711                 Self {
26712                         contents,
26713                         result_ok: o.result_ok,
26714                 }
26715         }
26716 }
26717 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
26718         fn clone(&self) -> Self {
26719                 if self.result_ok {
26720                         Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26721                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
26722                         } }
26723                 } else {
26724                         Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26726                         } }
26727                 }
26728         }
26729 }
26730 #[no_mangle]
26731 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
26732 /// but with all dynamically-allocated buffers duplicated in new buffers.
26733 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
26734 #[repr(C)]
26735 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
26736 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
26737         /// A pointer to the contents in the success state.
26738         /// Reading from this pointer when `result_ok` is not set is undefined.
26739         pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
26740         /// A pointer to the contents in the error state.
26741         /// Reading from this pointer when `result_ok` is set is undefined.
26742         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26743 }
26744 #[repr(C)]
26745 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
26746 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
26747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26748 pub struct CResult_OutputSpendStatusDecodeErrorZ {
26749         /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
26750         /// `err` or `result` depending on the state of `result_ok`.
26751         pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
26752         /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
26753         pub result_ok: bool,
26754 }
26755 #[no_mangle]
26756 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
26757 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
26758         CResult_OutputSpendStatusDecodeErrorZ {
26759                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26760                         result: Box::into_raw(Box::new(o)),
26761                 },
26762                 result_ok: true,
26763         }
26764 }
26765 #[no_mangle]
26766 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
26767 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
26768         CResult_OutputSpendStatusDecodeErrorZ {
26769                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26770                         err: Box::into_raw(Box::new(e)),
26771                 },
26772                 result_ok: false,
26773         }
26774 }
26775 /// Checks if the given object is currently in the success state
26776 #[no_mangle]
26777 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
26778         o.result_ok
26779 }
26780 #[no_mangle]
26781 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
26782 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
26783 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
26784         fn drop(&mut self) {
26785                 if self.result_ok {
26786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26788                         }
26789                 } else {
26790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26792                         }
26793                 }
26794         }
26795 }
26796 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
26797         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
26798                 let contents = if o.result_ok {
26799                         let result = unsafe { o.contents.result };
26800                         unsafe { o.contents.result = core::ptr::null_mut() };
26801                         CResult_OutputSpendStatusDecodeErrorZPtr { result }
26802                 } else {
26803                         let err = unsafe { o.contents.err };
26804                         unsafe { o.contents.err = core::ptr::null_mut(); }
26805                         CResult_OutputSpendStatusDecodeErrorZPtr { err }
26806                 };
26807                 Self {
26808                         contents,
26809                         result_ok: o.result_ok,
26810                 }
26811         }
26812 }
26813 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
26814         fn clone(&self) -> Self {
26815                 if self.result_ok {
26816                         Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26817                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
26818                         } }
26819                 } else {
26820                         Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26821                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26822                         } }
26823                 }
26824         }
26825 }
26826 #[no_mangle]
26827 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
26828 /// but with all dynamically-allocated buffers duplicated in new buffers.
26829 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
26830 #[repr(C)]
26831 /// An enum which can either contain a crate::lightning::chain::Filter or not
26832 pub enum COption_FilterZ {
26833         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
26834         Some(crate::lightning::chain::Filter),
26835         /// When we're in this state, this COption_FilterZ contains nothing
26836         None
26837 }
26838 impl COption_FilterZ {
26839         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
26840                 if let Self::None = self { false } else { true }
26841         }
26842         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
26843                 !self.is_some()
26844         }
26845         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
26846                 if let Self::Some(v) = self { v } else { unreachable!() }
26847         }
26848 }
26849 #[no_mangle]
26850 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
26851 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
26852         COption_FilterZ::Some(o)
26853 }
26854 #[no_mangle]
26855 /// Constructs a new COption_FilterZ containing nothing
26856 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
26857         COption_FilterZ::None
26858 }
26859 #[no_mangle]
26860 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
26861 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
26862 #[repr(C)]
26863 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
26864 /// This corresponds to std::vector in C++
26865 pub struct CVec_TrackedSpendableOutputZ {
26866         /// The elements in the array.
26867         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26868         pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26869         /// The number of elements pointed to by `data`.
26870         pub datalen: usize
26871 }
26872 impl CVec_TrackedSpendableOutputZ {
26873         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
26874                 if self.datalen == 0 { return Vec::new(); }
26875                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26876                 self.data = core::ptr::null_mut();
26877                 self.datalen = 0;
26878                 ret
26879         }
26880         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
26881                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26882         }
26883 }
26884 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
26885         fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
26886                 let datalen = v.len();
26887                 let data = Box::into_raw(v.into_boxed_slice());
26888                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26889         }
26890 }
26891 #[no_mangle]
26892 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26893 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
26894 impl Drop for CVec_TrackedSpendableOutputZ {
26895         fn drop(&mut self) {
26896                 if self.datalen == 0 { return; }
26897                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26898         }
26899 }
26900 impl Clone for CVec_TrackedSpendableOutputZ {
26901         fn clone(&self) -> Self {
26902                 let mut res = Vec::new();
26903                 if self.datalen == 0 { return Self::from(res); }
26904                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26905                 Self::from(res)
26906         }
26907 }
26908 #[repr(C)]
26909 /// The contents of CResult_OutputSweeperDecodeErrorZ
26910 pub union CResult_OutputSweeperDecodeErrorZPtr {
26911         /// A pointer to the contents in the success state.
26912         /// Reading from this pointer when `result_ok` is not set is undefined.
26913         pub result: *mut crate::lightning::util::sweep::OutputSweeper,
26914         /// A pointer to the contents in the error state.
26915         /// Reading from this pointer when `result_ok` is set is undefined.
26916         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26917 }
26918 #[repr(C)]
26919 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
26920 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
26921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26922 pub struct CResult_OutputSweeperDecodeErrorZ {
26923         /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
26924         /// `err` or `result` depending on the state of `result_ok`.
26925         pub contents: CResult_OutputSweeperDecodeErrorZPtr,
26926         /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
26927         pub result_ok: bool,
26928 }
26929 #[no_mangle]
26930 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
26931 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
26932         CResult_OutputSweeperDecodeErrorZ {
26933                 contents: CResult_OutputSweeperDecodeErrorZPtr {
26934                         result: Box::into_raw(Box::new(o)),
26935                 },
26936                 result_ok: true,
26937         }
26938 }
26939 #[no_mangle]
26940 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
26941 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
26942         CResult_OutputSweeperDecodeErrorZ {
26943                 contents: CResult_OutputSweeperDecodeErrorZPtr {
26944                         err: Box::into_raw(Box::new(e)),
26945                 },
26946                 result_ok: false,
26947         }
26948 }
26949 /// Checks if the given object is currently in the success state
26950 #[no_mangle]
26951 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
26952         o.result_ok
26953 }
26954 #[no_mangle]
26955 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
26956 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
26957 impl Drop for CResult_OutputSweeperDecodeErrorZ {
26958         fn drop(&mut self) {
26959                 if self.result_ok {
26960                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26961                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26962                         }
26963                 } else {
26964                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26965                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26966                         }
26967                 }
26968         }
26969 }
26970 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
26971         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
26972                 let contents = if o.result_ok {
26973                         let result = unsafe { o.contents.result };
26974                         unsafe { o.contents.result = core::ptr::null_mut() };
26975                         CResult_OutputSweeperDecodeErrorZPtr { result }
26976                 } else {
26977                         let err = unsafe { o.contents.err };
26978                         unsafe { o.contents.err = core::ptr::null_mut(); }
26979                         CResult_OutputSweeperDecodeErrorZPtr { err }
26980                 };
26981                 Self {
26982                         contents,
26983                         result_ok: o.result_ok,
26984                 }
26985         }
26986 }
26987 #[repr(C)]
26988 /// A tuple of 2 elements. See the individual fields for the types contained.
26989 pub struct C2Tuple_BestBlockOutputSweeperZ {
26990         /// The element at position 0
26991         pub a: crate::lightning::chain::BestBlock,
26992         /// The element at position 1
26993         pub b: crate::lightning::util::sweep::OutputSweeper,
26994 }
26995 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
26996         fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
26997                 Self {
26998                         a: tup.0,
26999                         b: tup.1,
27000                 }
27001         }
27002 }
27003 impl C2Tuple_BestBlockOutputSweeperZ {
27004         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
27005                 (self.a, self.b)
27006         }
27007 }
27008 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
27009 #[no_mangle]
27010 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
27011         C2Tuple_BestBlockOutputSweeperZ { a, b, }
27012 }
27013
27014 #[no_mangle]
27015 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
27016 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
27017 #[repr(C)]
27018 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
27019 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27020         /// A pointer to the contents in the success state.
27021         /// Reading from this pointer when `result_ok` is not set is undefined.
27022         pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
27023         /// A pointer to the contents in the error state.
27024         /// Reading from this pointer when `result_ok` is set is undefined.
27025         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27026 }
27027 #[repr(C)]
27028 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
27029 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
27030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27031 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27032         /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
27033         /// `err` or `result` depending on the state of `result_ok`.
27034         pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
27035         /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
27036         pub result_ok: bool,
27037 }
27038 #[no_mangle]
27039 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
27040 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27041         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27042                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27043                         result: Box::into_raw(Box::new(o)),
27044                 },
27045                 result_ok: true,
27046         }
27047 }
27048 #[no_mangle]
27049 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
27050 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27051         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27052                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27053                         err: Box::into_raw(Box::new(e)),
27054                 },
27055                 result_ok: false,
27056         }
27057 }
27058 /// Checks if the given object is currently in the success state
27059 #[no_mangle]
27060 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
27061         o.result_ok
27062 }
27063 #[no_mangle]
27064 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
27065 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
27066 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27067         fn drop(&mut self) {
27068                 if self.result_ok {
27069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27071                         }
27072                 } else {
27073                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27074                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27075                         }
27076                 }
27077         }
27078 }
27079 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27080         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
27081                 let contents = if o.result_ok {
27082                         let result = unsafe { o.contents.result };
27083                         unsafe { o.contents.result = core::ptr::null_mut() };
27084                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
27085                 } else {
27086                         let err = unsafe { o.contents.err };
27087                         unsafe { o.contents.err = core::ptr::null_mut(); }
27088                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
27089                 };
27090                 Self {
27091                         contents,
27092                         result_ok: o.result_ok,
27093                 }
27094         }
27095 }
27096 #[repr(C)]
27097 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
27098 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27099         /// A pointer to the contents in the success state.
27100         /// Reading from this pointer when `result_ok` is not set is undefined.
27101         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
27102         /// A pointer to the contents in the error state.
27103         /// Reading from this pointer when `result_ok` is set is undefined.
27104         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27105 }
27106 #[repr(C)]
27107 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
27108 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27110 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
27111         /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
27112         /// `err` or `result` depending on the state of `result_ok`.
27113         pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
27114         /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
27115         pub result_ok: bool,
27116 }
27117 #[no_mangle]
27118 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
27119 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27120         CResult_DelayedPaymentBasepointDecodeErrorZ {
27121                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27122                         result: Box::into_raw(Box::new(o)),
27123                 },
27124                 result_ok: true,
27125         }
27126 }
27127 #[no_mangle]
27128 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
27129 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27130         CResult_DelayedPaymentBasepointDecodeErrorZ {
27131                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27132                         err: Box::into_raw(Box::new(e)),
27133                 },
27134                 result_ok: false,
27135         }
27136 }
27137 /// Checks if the given object is currently in the success state
27138 #[no_mangle]
27139 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
27140         o.result_ok
27141 }
27142 #[no_mangle]
27143 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
27144 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
27145 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
27146         fn drop(&mut self) {
27147                 if self.result_ok {
27148                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27149                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27150                         }
27151                 } else {
27152                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27153                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27154                         }
27155                 }
27156         }
27157 }
27158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
27159         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27160                 let contents = if o.result_ok {
27161                         let result = unsafe { o.contents.result };
27162                         unsafe { o.contents.result = core::ptr::null_mut() };
27163                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
27164                 } else {
27165                         let err = unsafe { o.contents.err };
27166                         unsafe { o.contents.err = core::ptr::null_mut(); }
27167                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
27168                 };
27169                 Self {
27170                         contents,
27171                         result_ok: o.result_ok,
27172                 }
27173         }
27174 }
27175 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
27176         fn clone(&self) -> Self {
27177                 if self.result_ok {
27178                         Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27179                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
27180                         } }
27181                 } else {
27182                         Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27183                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27184                         } }
27185                 }
27186         }
27187 }
27188 #[no_mangle]
27189 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
27190 /// but with all dynamically-allocated buffers duplicated in new buffers.
27191 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
27192 #[repr(C)]
27193 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
27194 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
27195         /// A pointer to the contents in the success state.
27196         /// Reading from this pointer when `result_ok` is not set is undefined.
27197         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
27198         /// A pointer to the contents in the error state.
27199         /// Reading from this pointer when `result_ok` is set is undefined.
27200         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27201 }
27202 #[repr(C)]
27203 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
27204 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27206 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
27207         /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
27208         /// `err` or `result` depending on the state of `result_ok`.
27209         pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
27210         /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
27211         pub result_ok: bool,
27212 }
27213 #[no_mangle]
27214 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
27215 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27216         CResult_DelayedPaymentKeyDecodeErrorZ {
27217                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27218                         result: Box::into_raw(Box::new(o)),
27219                 },
27220                 result_ok: true,
27221         }
27222 }
27223 #[no_mangle]
27224 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
27225 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27226         CResult_DelayedPaymentKeyDecodeErrorZ {
27227                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27228                         err: Box::into_raw(Box::new(e)),
27229                 },
27230                 result_ok: false,
27231         }
27232 }
27233 /// Checks if the given object is currently in the success state
27234 #[no_mangle]
27235 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
27236         o.result_ok
27237 }
27238 #[no_mangle]
27239 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
27240 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
27241 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
27242         fn drop(&mut self) {
27243                 if self.result_ok {
27244                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27245                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27246                         }
27247                 } else {
27248                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27249                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27250                         }
27251                 }
27252         }
27253 }
27254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
27255         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27256                 let contents = if o.result_ok {
27257                         let result = unsafe { o.contents.result };
27258                         unsafe { o.contents.result = core::ptr::null_mut() };
27259                         CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
27260                 } else {
27261                         let err = unsafe { o.contents.err };
27262                         unsafe { o.contents.err = core::ptr::null_mut(); }
27263                         CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
27264                 };
27265                 Self {
27266                         contents,
27267                         result_ok: o.result_ok,
27268                 }
27269         }
27270 }
27271 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
27272         fn clone(&self) -> Self {
27273                 if self.result_ok {
27274                         Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27275                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
27276                         } }
27277                 } else {
27278                         Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27279                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27280                         } }
27281                 }
27282         }
27283 }
27284 #[no_mangle]
27285 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
27286 /// but with all dynamically-allocated buffers duplicated in new buffers.
27287 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
27288 #[repr(C)]
27289 /// The contents of CResult_HtlcBasepointDecodeErrorZ
27290 pub union CResult_HtlcBasepointDecodeErrorZPtr {
27291         /// A pointer to the contents in the success state.
27292         /// Reading from this pointer when `result_ok` is not set is undefined.
27293         pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
27294         /// A pointer to the contents in the error state.
27295         /// Reading from this pointer when `result_ok` is set is undefined.
27296         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27297 }
27298 #[repr(C)]
27299 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
27300 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27302 pub struct CResult_HtlcBasepointDecodeErrorZ {
27303         /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
27304         /// `err` or `result` depending on the state of `result_ok`.
27305         pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
27306         /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
27307         pub result_ok: bool,
27308 }
27309 #[no_mangle]
27310 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
27311 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
27312         CResult_HtlcBasepointDecodeErrorZ {
27313                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27314                         result: Box::into_raw(Box::new(o)),
27315                 },
27316                 result_ok: true,
27317         }
27318 }
27319 #[no_mangle]
27320 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
27321 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
27322         CResult_HtlcBasepointDecodeErrorZ {
27323                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27324                         err: Box::into_raw(Box::new(e)),
27325                 },
27326                 result_ok: false,
27327         }
27328 }
27329 /// Checks if the given object is currently in the success state
27330 #[no_mangle]
27331 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
27332         o.result_ok
27333 }
27334 #[no_mangle]
27335 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
27336 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
27337 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
27338         fn drop(&mut self) {
27339                 if self.result_ok {
27340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27342                         }
27343                 } else {
27344                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27345                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27346                         }
27347                 }
27348         }
27349 }
27350 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
27351         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27352                 let contents = if o.result_ok {
27353                         let result = unsafe { o.contents.result };
27354                         unsafe { o.contents.result = core::ptr::null_mut() };
27355                         CResult_HtlcBasepointDecodeErrorZPtr { result }
27356                 } else {
27357                         let err = unsafe { o.contents.err };
27358                         unsafe { o.contents.err = core::ptr::null_mut(); }
27359                         CResult_HtlcBasepointDecodeErrorZPtr { err }
27360                 };
27361                 Self {
27362                         contents,
27363                         result_ok: o.result_ok,
27364                 }
27365         }
27366 }
27367 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
27368         fn clone(&self) -> Self {
27369                 if self.result_ok {
27370                         Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27371                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
27372                         } }
27373                 } else {
27374                         Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27375                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27376                         } }
27377                 }
27378         }
27379 }
27380 #[no_mangle]
27381 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
27382 /// but with all dynamically-allocated buffers duplicated in new buffers.
27383 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
27384 #[repr(C)]
27385 /// The contents of CResult_HtlcKeyDecodeErrorZ
27386 pub union CResult_HtlcKeyDecodeErrorZPtr {
27387         /// A pointer to the contents in the success state.
27388         /// Reading from this pointer when `result_ok` is not set is undefined.
27389         pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
27390         /// A pointer to the contents in the error state.
27391         /// Reading from this pointer when `result_ok` is set is undefined.
27392         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27393 }
27394 #[repr(C)]
27395 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
27396 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27398 pub struct CResult_HtlcKeyDecodeErrorZ {
27399         /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
27400         /// `err` or `result` depending on the state of `result_ok`.
27401         pub contents: CResult_HtlcKeyDecodeErrorZPtr,
27402         /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
27403         pub result_ok: bool,
27404 }
27405 #[no_mangle]
27406 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
27407 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
27408         CResult_HtlcKeyDecodeErrorZ {
27409                 contents: CResult_HtlcKeyDecodeErrorZPtr {
27410                         result: Box::into_raw(Box::new(o)),
27411                 },
27412                 result_ok: true,
27413         }
27414 }
27415 #[no_mangle]
27416 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
27417 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
27418         CResult_HtlcKeyDecodeErrorZ {
27419                 contents: CResult_HtlcKeyDecodeErrorZPtr {
27420                         err: Box::into_raw(Box::new(e)),
27421                 },
27422                 result_ok: false,
27423         }
27424 }
27425 /// Checks if the given object is currently in the success state
27426 #[no_mangle]
27427 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
27428         o.result_ok
27429 }
27430 #[no_mangle]
27431 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
27432 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
27433 impl Drop for CResult_HtlcKeyDecodeErrorZ {
27434         fn drop(&mut self) {
27435                 if self.result_ok {
27436                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27437                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27438                         }
27439                 } else {
27440                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27441                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27442                         }
27443                 }
27444         }
27445 }
27446 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
27447         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27448                 let contents = if o.result_ok {
27449                         let result = unsafe { o.contents.result };
27450                         unsafe { o.contents.result = core::ptr::null_mut() };
27451                         CResult_HtlcKeyDecodeErrorZPtr { result }
27452                 } else {
27453                         let err = unsafe { o.contents.err };
27454                         unsafe { o.contents.err = core::ptr::null_mut(); }
27455                         CResult_HtlcKeyDecodeErrorZPtr { err }
27456                 };
27457                 Self {
27458                         contents,
27459                         result_ok: o.result_ok,
27460                 }
27461         }
27462 }
27463 impl Clone for CResult_HtlcKeyDecodeErrorZ {
27464         fn clone(&self) -> Self {
27465                 if self.result_ok {
27466                         Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
27467                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
27468                         } }
27469                 } else {
27470                         Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
27471                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27472                         } }
27473                 }
27474         }
27475 }
27476 #[no_mangle]
27477 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
27478 /// but with all dynamically-allocated buffers duplicated in new buffers.
27479 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
27480 #[repr(C)]
27481 /// The contents of CResult_RevocationBasepointDecodeErrorZ
27482 pub union CResult_RevocationBasepointDecodeErrorZPtr {
27483         /// A pointer to the contents in the success state.
27484         /// Reading from this pointer when `result_ok` is not set is undefined.
27485         pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
27486         /// A pointer to the contents in the error state.
27487         /// Reading from this pointer when `result_ok` is set is undefined.
27488         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27489 }
27490 #[repr(C)]
27491 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
27492 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27493 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27494 pub struct CResult_RevocationBasepointDecodeErrorZ {
27495         /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
27496         /// `err` or `result` depending on the state of `result_ok`.
27497         pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
27498         /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
27499         pub result_ok: bool,
27500 }
27501 #[no_mangle]
27502 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
27503 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
27504         CResult_RevocationBasepointDecodeErrorZ {
27505                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27506                         result: Box::into_raw(Box::new(o)),
27507                 },
27508                 result_ok: true,
27509         }
27510 }
27511 #[no_mangle]
27512 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
27513 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
27514         CResult_RevocationBasepointDecodeErrorZ {
27515                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27516                         err: Box::into_raw(Box::new(e)),
27517                 },
27518                 result_ok: false,
27519         }
27520 }
27521 /// Checks if the given object is currently in the success state
27522 #[no_mangle]
27523 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
27524         o.result_ok
27525 }
27526 #[no_mangle]
27527 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
27528 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
27529 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
27530         fn drop(&mut self) {
27531                 if self.result_ok {
27532                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27533                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27534                         }
27535                 } else {
27536                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27537                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27538                         }
27539                 }
27540         }
27541 }
27542 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
27543         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27544                 let contents = if o.result_ok {
27545                         let result = unsafe { o.contents.result };
27546                         unsafe { o.contents.result = core::ptr::null_mut() };
27547                         CResult_RevocationBasepointDecodeErrorZPtr { result }
27548                 } else {
27549                         let err = unsafe { o.contents.err };
27550                         unsafe { o.contents.err = core::ptr::null_mut(); }
27551                         CResult_RevocationBasepointDecodeErrorZPtr { err }
27552                 };
27553                 Self {
27554                         contents,
27555                         result_ok: o.result_ok,
27556                 }
27557         }
27558 }
27559 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
27560         fn clone(&self) -> Self {
27561                 if self.result_ok {
27562                         Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27563                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
27564                         } }
27565                 } else {
27566                         Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27567                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27568                         } }
27569                 }
27570         }
27571 }
27572 #[no_mangle]
27573 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
27574 /// but with all dynamically-allocated buffers duplicated in new buffers.
27575 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
27576 #[repr(C)]
27577 /// The contents of CResult_RevocationKeyDecodeErrorZ
27578 pub union CResult_RevocationKeyDecodeErrorZPtr {
27579         /// A pointer to the contents in the success state.
27580         /// Reading from this pointer when `result_ok` is not set is undefined.
27581         pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
27582         /// A pointer to the contents in the error state.
27583         /// Reading from this pointer when `result_ok` is set is undefined.
27584         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27585 }
27586 #[repr(C)]
27587 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
27588 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27590 pub struct CResult_RevocationKeyDecodeErrorZ {
27591         /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
27592         /// `err` or `result` depending on the state of `result_ok`.
27593         pub contents: CResult_RevocationKeyDecodeErrorZPtr,
27594         /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
27595         pub result_ok: bool,
27596 }
27597 #[no_mangle]
27598 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
27599 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
27600         CResult_RevocationKeyDecodeErrorZ {
27601                 contents: CResult_RevocationKeyDecodeErrorZPtr {
27602                         result: Box::into_raw(Box::new(o)),
27603                 },
27604                 result_ok: true,
27605         }
27606 }
27607 #[no_mangle]
27608 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
27609 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
27610         CResult_RevocationKeyDecodeErrorZ {
27611                 contents: CResult_RevocationKeyDecodeErrorZPtr {
27612                         err: Box::into_raw(Box::new(e)),
27613                 },
27614                 result_ok: false,
27615         }
27616 }
27617 /// Checks if the given object is currently in the success state
27618 #[no_mangle]
27619 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
27620         o.result_ok
27621 }
27622 #[no_mangle]
27623 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
27624 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
27625 impl Drop for CResult_RevocationKeyDecodeErrorZ {
27626         fn drop(&mut self) {
27627                 if self.result_ok {
27628                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27629                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27630                         }
27631                 } else {
27632                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27633                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27634                         }
27635                 }
27636         }
27637 }
27638 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
27639         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27640                 let contents = if o.result_ok {
27641                         let result = unsafe { o.contents.result };
27642                         unsafe { o.contents.result = core::ptr::null_mut() };
27643                         CResult_RevocationKeyDecodeErrorZPtr { result }
27644                 } else {
27645                         let err = unsafe { o.contents.err };
27646                         unsafe { o.contents.err = core::ptr::null_mut(); }
27647                         CResult_RevocationKeyDecodeErrorZPtr { err }
27648                 };
27649                 Self {
27650                         contents,
27651                         result_ok: o.result_ok,
27652                 }
27653         }
27654 }
27655 impl Clone for CResult_RevocationKeyDecodeErrorZ {
27656         fn clone(&self) -> Self {
27657                 if self.result_ok {
27658                         Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
27659                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
27660                         } }
27661                 } else {
27662                         Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
27663                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27664                         } }
27665                 }
27666         }
27667 }
27668 #[no_mangle]
27669 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
27670 /// but with all dynamically-allocated buffers duplicated in new buffers.
27671 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
27672 #[repr(C)]
27673 /// The contents of CResult_LockedChannelMonitorNoneZ
27674 pub union CResult_LockedChannelMonitorNoneZPtr {
27675         /// A pointer to the contents in the success state.
27676         /// Reading from this pointer when `result_ok` is not set is undefined.
27677         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
27678         /// Note that this value is always NULL, as there are no contents in the Err variant
27679         pub err: *mut core::ffi::c_void,
27680 }
27681 #[repr(C)]
27682 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
27683 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
27684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27685 pub struct CResult_LockedChannelMonitorNoneZ {
27686         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
27687         /// `err` or `result` depending on the state of `result_ok`.
27688         pub contents: CResult_LockedChannelMonitorNoneZPtr,
27689         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
27690         pub result_ok: bool,
27691 }
27692 #[no_mangle]
27693 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
27694 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
27695         CResult_LockedChannelMonitorNoneZ {
27696                 contents: CResult_LockedChannelMonitorNoneZPtr {
27697                         result: Box::into_raw(Box::new(o)),
27698                 },
27699                 result_ok: true,
27700         }
27701 }
27702 #[no_mangle]
27703 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
27704 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
27705         CResult_LockedChannelMonitorNoneZ {
27706                 contents: CResult_LockedChannelMonitorNoneZPtr {
27707                         err: core::ptr::null_mut(),
27708                 },
27709                 result_ok: false,
27710         }
27711 }
27712 /// Checks if the given object is currently in the success state
27713 #[no_mangle]
27714 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
27715         o.result_ok
27716 }
27717 #[no_mangle]
27718 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
27719 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
27720 impl Drop for CResult_LockedChannelMonitorNoneZ {
27721         fn drop(&mut self) {
27722                 if self.result_ok {
27723                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27724                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27725                         }
27726                 } else {
27727                 }
27728         }
27729 }
27730 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
27731         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
27732                 let contents = if o.result_ok {
27733                         let result = unsafe { o.contents.result };
27734                         unsafe { o.contents.result = core::ptr::null_mut() };
27735                         CResult_LockedChannelMonitorNoneZPtr { result }
27736                 } else {
27737                         let _ = unsafe { Box::from_raw(o.contents.err) };
27738                         o.contents.err = core::ptr::null_mut();
27739                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
27740                 };
27741                 Self {
27742                         contents,
27743                         result_ok: o.result_ok,
27744                 }
27745         }
27746 }
27747 #[repr(C)]
27748 /// A tuple of 2 elements. See the individual fields for the types contained.
27749 pub struct C2Tuple_OutPointChannelIdZ {
27750         /// The element at position 0
27751         pub a: crate::lightning::chain::transaction::OutPoint,
27752         /// The element at position 1
27753         pub b: crate::lightning::ln::types::ChannelId,
27754 }
27755 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
27756         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
27757                 Self {
27758                         a: tup.0,
27759                         b: tup.1,
27760                 }
27761         }
27762 }
27763 impl C2Tuple_OutPointChannelIdZ {
27764         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
27765                 (self.a, self.b)
27766         }
27767 }
27768 impl Clone for C2Tuple_OutPointChannelIdZ {
27769         fn clone(&self) -> Self {
27770                 Self {
27771                         a: Clone::clone(&self.a),
27772                         b: Clone::clone(&self.b),
27773                 }
27774         }
27775 }
27776 #[no_mangle]
27777 /// Creates a new tuple which has the same data as `orig`
27778 /// but with all dynamically-allocated buffers duplicated in new buffers.
27779 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
27780 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
27781 #[no_mangle]
27782 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
27783         C2Tuple_OutPointChannelIdZ { a, b, }
27784 }
27785
27786 #[no_mangle]
27787 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
27788 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
27789 #[repr(C)]
27790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
27791 /// This corresponds to std::vector in C++
27792 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
27793         /// The elements in the array.
27794         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27795         pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
27796         /// The number of elements pointed to by `data`.
27797         pub datalen: usize
27798 }
27799 impl CVec_C2Tuple_OutPointChannelIdZZ {
27800         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
27801                 if self.datalen == 0 { return Vec::new(); }
27802                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27803                 self.data = core::ptr::null_mut();
27804                 self.datalen = 0;
27805                 ret
27806         }
27807         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
27808                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27809         }
27810 }
27811 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
27812         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
27813                 let datalen = v.len();
27814                 let data = Box::into_raw(v.into_boxed_slice());
27815                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27816         }
27817 }
27818 #[no_mangle]
27819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27820 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
27821 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
27822         fn drop(&mut self) {
27823                 if self.datalen == 0 { return; }
27824                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27825         }
27826 }
27827 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
27828         fn clone(&self) -> Self {
27829                 let mut res = Vec::new();
27830                 if self.datalen == 0 { return Self::from(res); }
27831                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27832                 Self::from(res)
27833         }
27834 }
27835 #[repr(C)]
27836 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
27837 /// This corresponds to std::vector in C++
27838 pub struct CVec_MonitorUpdateIdZ {
27839         /// The elements in the array.
27840         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27841         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
27842         /// The number of elements pointed to by `data`.
27843         pub datalen: usize
27844 }
27845 impl CVec_MonitorUpdateIdZ {
27846         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
27847                 if self.datalen == 0 { return Vec::new(); }
27848                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27849                 self.data = core::ptr::null_mut();
27850                 self.datalen = 0;
27851                 ret
27852         }
27853         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
27854                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27855         }
27856 }
27857 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
27858         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
27859                 let datalen = v.len();
27860                 let data = Box::into_raw(v.into_boxed_slice());
27861                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27862         }
27863 }
27864 #[no_mangle]
27865 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27866 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
27867 impl Drop for CVec_MonitorUpdateIdZ {
27868         fn drop(&mut self) {
27869                 if self.datalen == 0 { return; }
27870                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27871         }
27872 }
27873 impl Clone for CVec_MonitorUpdateIdZ {
27874         fn clone(&self) -> Self {
27875                 let mut res = Vec::new();
27876                 if self.datalen == 0 { return Self::from(res); }
27877                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27878                 Self::from(res)
27879         }
27880 }
27881 #[repr(C)]
27882 /// A tuple of 2 elements. See the individual fields for the types contained.
27883 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27884         /// The element at position 0
27885         pub a: crate::lightning::chain::transaction::OutPoint,
27886         /// The element at position 1
27887         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
27888 }
27889 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27890         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
27891                 Self {
27892                         a: tup.0,
27893                         b: tup.1,
27894                 }
27895         }
27896 }
27897 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27898         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
27899                 (self.a, self.b)
27900         }
27901 }
27902 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27903         fn clone(&self) -> Self {
27904                 Self {
27905                         a: Clone::clone(&self.a),
27906                         b: Clone::clone(&self.b),
27907                 }
27908         }
27909 }
27910 #[no_mangle]
27911 /// Creates a new tuple which has the same data as `orig`
27912 /// but with all dynamically-allocated buffers duplicated in new buffers.
27913 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
27914 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
27915 #[no_mangle]
27916 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27917         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
27918 }
27919
27920 #[no_mangle]
27921 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
27922 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
27923 #[repr(C)]
27924 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
27925 /// This corresponds to std::vector in C++
27926 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27927         /// The elements in the array.
27928         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27929         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
27930         /// The number of elements pointed to by `data`.
27931         pub datalen: usize
27932 }
27933 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27934         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
27935                 if self.datalen == 0 { return Vec::new(); }
27936                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27937                 self.data = core::ptr::null_mut();
27938                 self.datalen = 0;
27939                 ret
27940         }
27941         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
27942                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27943         }
27944 }
27945 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27946         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
27947                 let datalen = v.len();
27948                 let data = Box::into_raw(v.into_boxed_slice());
27949                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27950         }
27951 }
27952 #[no_mangle]
27953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27954 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
27955 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27956         fn drop(&mut self) {
27957                 if self.datalen == 0 { return; }
27958                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27959         }
27960 }
27961 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27962         fn clone(&self) -> Self {
27963                 let mut res = Vec::new();
27964                 if self.datalen == 0 { return Self::from(res); }
27965                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27966                 Self::from(res)
27967         }
27968 }